diff --git a/packages/client-fetch/src/utils.ts b/packages/client-fetch/src/utils.ts index d5ae551d8..a1cbdabd3 100644 --- a/packages/client-fetch/src/utils.ts +++ b/packages/client-fetch/src/utils.ts @@ -440,6 +440,10 @@ class Interceptors { this._fns = []; } + clear() { + this._fns = []; + } + eject(fn: Interceptor) { const index = this._fns.indexOf(fn); if (index !== -1) { -- 2.51.2 From 4d525a4ba2e72118c514ac6652a9210fda34d05e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francisco=20Garc=C3=ADa?= Date: Wed, 4 Sep 2024 08:10:21 +0200 Subject: [PATCH 02/49] feat: Method to check if and interceptor function exist in client-fetch. --- packages/client-fetch/src/utils.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/client-fetch/src/utils.ts b/packages/client-fetch/src/utils.ts index a1cbdabd3..32f5cd688 100644 --- a/packages/client-fetch/src/utils.ts +++ b/packages/client-fetch/src/utils.ts @@ -444,6 +444,10 @@ class Interceptors { this._fns = []; } + exist(fn: Interceptor) { + return this._fns.indexOf(fn) !== -1; + } + eject(fn: Interceptor) { const index = this._fns.indexOf(fn); if (index !== -1) { -- 2.51.2 From 7ebc1d44af74db2522219d71d240325f6bc5689d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francisco=20Garc=C3=ADa?= Date: Thu, 5 Sep 2024 07:23:33 +0200 Subject: [PATCH 03/49] add changeset --- .changeset/tall-bees-cheer.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/tall-bees-cheer.md diff --git a/.changeset/tall-bees-cheer.md b/.changeset/tall-bees-cheer.md new file mode 100644 index 000000000..82610c181 --- /dev/null +++ b/.changeset/tall-bees-cheer.md @@ -0,0 +1,5 @@ +--- +'@hey-api/client-fetch': minor +--- + +feat: Function to clear and check if exist an interceptor in client-fetch -- 2.51.2 From 6b64718aadab6a1abe350fc37c65febbc4a5b05e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francisco=20Garc=C3=ADa?= Date: Thu, 5 Sep 2024 08:50:40 +0200 Subject: [PATCH 04/49] fix: typographical error --- packages/client-fetch/src/utils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/client-fetch/src/utils.ts b/packages/client-fetch/src/utils.ts index 32f5cd688..3fbc16855 100644 --- a/packages/client-fetch/src/utils.ts +++ b/packages/client-fetch/src/utils.ts @@ -444,7 +444,7 @@ class Interceptors { this._fns = []; } - exist(fn: Interceptor) { + exists(fn: Interceptor) { return this._fns.indexOf(fn) !== -1; } -- 2.51.2 From 1bf35cdd0aa30d7044848db1b6f2db3911aae949 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 9 Sep 2024 03:29:43 +0000 Subject: [PATCH 05/49] chore(deps): bump the prod-deps group with 7 updates Bumps the prod-deps group with 7 updates: | Package | From | To | | --- | --- | --- | | [@tanstack/react-query](https://github.com/TanStack/query/tree/HEAD/packages/react-query) | `5.53.2` | `5.55.2` | | [@tanstack/react-query-devtools](https://github.com/TanStack/query/tree/HEAD/packages/react-query-devtools) | `5.53.2` | `5.55.2` | | [@tanstack/svelte-query](https://github.com/TanStack/query/tree/HEAD/packages/svelte-query) | `5.53.2` | `5.55.2` | | [@tanstack/vue-query](https://github.com/TanStack/query/tree/HEAD/packages/vue-query) | `5.53.2` | `5.55.2` | | [@tanstack/vue-query-devtools](https://github.com/TanStack/query/tree/HEAD/packages/vue-query-devtools) | `5.53.2` | `5.55.2` | | [vue](https://github.com/vuejs/core) | `3.4.38` | `3.5.3` | | [c12](https://github.com/unjs/c12) | `1.11.1` | `1.11.2` | Updates `@tanstack/react-query` from 5.53.2 to 5.55.2 - [Release notes](https://github.com/TanStack/query/releases) - [Commits](https://github.com/TanStack/query/commits/v5.55.2/packages/react-query) Updates `@tanstack/react-query-devtools` from 5.53.2 to 5.55.2 - [Release notes](https://github.com/TanStack/query/releases) - [Commits](https://github.com/TanStack/query/commits/v5.55.2/packages/react-query-devtools) Updates `@tanstack/svelte-query` from 5.53.2 to 5.55.2 - [Release notes](https://github.com/TanStack/query/releases) - [Commits](https://github.com/TanStack/query/commits/v5.55.2/packages/svelte-query) Updates `@tanstack/vue-query` from 5.53.2 to 5.55.2 - [Release notes](https://github.com/TanStack/query/releases) - [Commits](https://github.com/TanStack/query/commits/v5.55.2/packages/vue-query) Updates `@tanstack/vue-query-devtools` from 5.53.2 to 5.55.2 - [Release notes](https://github.com/TanStack/query/releases) - [Commits](https://github.com/TanStack/query/commits/v5.55.2/packages/vue-query-devtools) Updates `vue` from 3.4.38 to 3.5.3 - [Release notes](https://github.com/vuejs/core/releases) - [Changelog](https://github.com/vuejs/core/blob/main/CHANGELOG.md) - [Commits](https://github.com/vuejs/core/compare/v3.4.38...v3.5.3) Updates `c12` from 1.11.1 to 1.11.2 - [Release notes](https://github.com/unjs/c12/releases) - [Changelog](https://github.com/unjs/c12/blob/v1.11.2/CHANGELOG.md) - [Commits](https://github.com/unjs/c12/compare/v1.11.1...v1.11.2) --- updated-dependencies: - dependency-name: "@tanstack/react-query" dependency-type: direct:production update-type: version-update:semver-minor dependency-group: prod-deps - dependency-name: "@tanstack/react-query-devtools" dependency-type: direct:production update-type: version-update:semver-minor dependency-group: prod-deps - dependency-name: "@tanstack/svelte-query" dependency-type: direct:production update-type: version-update:semver-minor dependency-group: prod-deps - dependency-name: "@tanstack/vue-query" dependency-type: direct:production update-type: version-update:semver-minor dependency-group: prod-deps - dependency-name: "@tanstack/vue-query-devtools" dependency-type: direct:production update-type: version-update:semver-minor dependency-group: prod-deps - dependency-name: vue dependency-type: direct:production update-type: version-update:semver-minor dependency-group: prod-deps - dependency-name: c12 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: prod-deps ... Signed-off-by: dependabot[bot] --- .../package.json | 4 +- .../package.json | 2 +- .../package.json | 6 +- packages/openapi-ts/package.json | 8 +- pnpm-lock.yaml | 397 ++++++++++-------- 5 files changed, 221 insertions(+), 196 deletions(-) diff --git a/examples/openapi-ts-tanstack-react-query/package.json b/examples/openapi-ts-tanstack-react-query/package.json index b1821f9d4..6e2638cc0 100644 --- a/examples/openapi-ts-tanstack-react-query/package.json +++ b/examples/openapi-ts-tanstack-react-query/package.json @@ -16,8 +16,8 @@ "@radix-ui/react-form": "0.1.0", "@radix-ui/react-icons": "1.3.0", "@radix-ui/themes": "3.1.3", - "@tanstack/react-query": "5.53.2", - "@tanstack/react-query-devtools": "5.53.2", + "@tanstack/react-query": "5.55.2", + "@tanstack/react-query-devtools": "5.55.2", "react": "18.3.1", "react-dom": "18.3.1" }, diff --git a/examples/openapi-ts-tanstack-svelte-query/package.json b/examples/openapi-ts-tanstack-svelte-query/package.json index 70c012dff..f2879198d 100644 --- a/examples/openapi-ts-tanstack-svelte-query/package.json +++ b/examples/openapi-ts-tanstack-svelte-query/package.json @@ -17,7 +17,7 @@ }, "dependencies": { "@hey-api/client-fetch": "workspace:*", - "@tanstack/svelte-query": "5.53.2" + "@tanstack/svelte-query": "5.55.2" }, "devDependencies": { "@fontsource/fira-mono": "5.0.0", diff --git a/examples/openapi-ts-tanstack-vue-query/package.json b/examples/openapi-ts-tanstack-vue-query/package.json index 9300f2f92..d3ea3e243 100644 --- a/examples/openapi-ts-tanstack-vue-query/package.json +++ b/examples/openapi-ts-tanstack-vue-query/package.json @@ -17,10 +17,10 @@ }, "dependencies": { "@hey-api/client-fetch": "workspace:*", - "@tanstack/vue-query": "5.53.2", - "@tanstack/vue-query-devtools": "5.53.2", + "@tanstack/vue-query": "5.55.2", + "@tanstack/vue-query-devtools": "5.55.2", "pinia": "2.2.2", - "vue": "3.4.38", + "vue": "3.5.3", "vue-router": "4.4.3" }, "devDependencies": { diff --git a/packages/openapi-ts/package.json b/packages/openapi-ts/package.json index 4e325a81d..63187f932 100644 --- a/packages/openapi-ts/package.json +++ b/packages/openapi-ts/package.json @@ -62,7 +62,7 @@ }, "dependencies": { "@apidevtools/json-schema-ref-parser": "11.7.0", - "c12": "1.11.1", + "c12": "1.11.2", "commander": "12.1.0", "handlebars": "4.7.8" }, @@ -85,10 +85,10 @@ "@hey-api/client-fetch": "workspace:*", "@rollup/plugin-json": "6.1.0", "@rollup/plugin-node-resolve": "15.2.3", - "@tanstack/react-query": "5.53.2", + "@tanstack/react-query": "5.55.2", "@tanstack/solid-query": "5.51.21", - "@tanstack/svelte-query": "5.53.2", - "@tanstack/vue-query": "5.53.2", + "@tanstack/svelte-query": "5.55.2", + "@tanstack/vue-query": "5.55.2", "@types/cross-spawn": "6.0.6", "@types/express": "4.17.21", "axios": "1.7.7", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 312a188f2..04d4c822b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -89,7 +89,7 @@ importers: devDependencies: vitepress: specifier: 1.3.0 - version: 1.3.0(@algolia/client-search@4.23.3)(@types/node@20.14.10)(@types/react@18.3.3)(axios@1.7.7)(less@4.2.0)(postcss@8.4.41)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.71.1)(search-insights@2.14.0)(terser@5.31.1)(typescript@5.5.3) + version: 1.3.0(@algolia/client-search@4.23.3)(@types/node@20.14.10)(@types/react@18.3.3)(axios@1.7.7)(less@4.2.0)(postcss@8.4.45)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.71.1)(search-insights@2.14.0)(terser@5.31.1)(typescript@5.5.3) examples/openapi-ts-axios: dependencies: @@ -243,11 +243,11 @@ importers: specifier: 3.1.3 version: 3.1.3(@types/react-dom@18.3.0)(@types/react@18.3.3)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) '@tanstack/react-query': - specifier: 5.53.2 - version: 5.53.2(react@18.3.1) + specifier: 5.55.2 + version: 5.55.2(react@18.3.1) '@tanstack/react-query-devtools': - specifier: 5.53.2 - version: 5.53.2(@tanstack/react-query@5.53.2(react@18.3.1))(react@18.3.1) + specifier: 5.55.2 + version: 5.55.2(@tanstack/react-query@5.55.2(react@18.3.1))(react@18.3.1) react: specifier: 18.3.1 version: 18.3.1 @@ -307,8 +307,8 @@ importers: specifier: workspace:* version: link:../../packages/client-fetch '@tanstack/svelte-query': - specifier: 5.53.2 - version: 5.53.2(svelte@4.2.7) + specifier: 5.55.2 + version: 5.55.2(svelte@4.2.7) devDependencies: '@fontsource/fira-mono': specifier: 5.0.0 @@ -374,20 +374,20 @@ importers: specifier: workspace:* version: link:../../packages/client-fetch '@tanstack/vue-query': - specifier: 5.53.2 - version: 5.53.2(vue@3.4.38(typescript@5.5.3)) + specifier: 5.55.2 + version: 5.55.2(vue@3.5.3(typescript@5.5.3)) '@tanstack/vue-query-devtools': - specifier: 5.53.2 - version: 5.53.2(@tanstack/vue-query@5.53.2(vue@3.4.38(typescript@5.5.3)))(vue@3.4.38(typescript@5.5.3)) + specifier: 5.55.2 + version: 5.55.2(@tanstack/vue-query@5.55.2(vue@3.5.3(typescript@5.5.3)))(vue@3.5.3(typescript@5.5.3)) pinia: specifier: 2.2.2 - version: 2.2.2(typescript@5.5.3)(vue@3.4.38(typescript@5.5.3)) + version: 2.2.2(typescript@5.5.3)(vue@3.5.3(typescript@5.5.3)) vue: - specifier: 3.4.38 - version: 3.4.38(typescript@5.5.3) + specifier: 3.5.3 + version: 3.5.3(typescript@5.5.3) vue-router: specifier: 4.4.3 - version: 4.4.3(vue@3.4.38(typescript@5.5.3)) + version: 4.4.3(vue@3.5.3(typescript@5.5.3)) devDependencies: '@hey-api/openapi-ts': specifier: workspace:* @@ -406,10 +406,10 @@ importers: version: 20.14.5 '@vitejs/plugin-vue': specifier: 5.0.5 - version: 5.0.5(vite@5.3.3(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1))(vue@3.4.38(typescript@5.5.3)) + version: 5.0.5(vite@5.3.3(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1))(vue@3.5.3(typescript@5.5.3)) '@vitejs/plugin-vue-jsx': specifier: 4.0.0 - version: 4.0.0(vite@5.3.3(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1))(vue@3.4.38(typescript@5.5.3)) + version: 4.0.0(vite@5.3.3(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1))(vue@3.5.3(typescript@5.5.3)) '@vue/eslint-config-prettier': specifier: 9.0.0 version: 9.0.0(@types/eslint@9.6.0)(eslint@9.6.0)(prettier@3.3.2) @@ -454,7 +454,7 @@ importers: version: 5.3.3(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1) vite-plugin-vue-devtools: specifier: 7.3.1 - version: 7.3.1(rollup@4.18.0)(vite@5.3.3(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1))(vue@3.4.38(typescript@5.5.3)) + version: 7.3.1(rollup@4.18.0)(vite@5.3.3(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1))(vue@3.5.3(typescript@5.5.3)) vitest: specifier: 1.6.0 version: 1.6.0(@types/node@20.14.5)(jsdom@24.1.0)(less@4.2.0)(sass@1.71.1)(terser@5.31.1) @@ -478,8 +478,8 @@ importers: specifier: 11.7.0 version: 11.7.0 c12: - specifier: 1.11.1 - version: 1.11.1(magicast@0.3.4) + specifier: 1.11.2 + version: 1.11.2(magicast@0.3.4) commander: specifier: 12.1.0 version: 12.1.0 @@ -533,17 +533,17 @@ importers: specifier: 15.2.3 version: 15.2.3(rollup@4.18.0) '@tanstack/react-query': - specifier: 5.53.2 - version: 5.53.2(react@18.3.1) + specifier: 5.55.2 + version: 5.55.2(react@18.3.1) '@tanstack/solid-query': specifier: 5.51.21 version: 5.51.21(solid-js@1.8.20) '@tanstack/svelte-query': - specifier: 5.53.2 - version: 5.53.2(svelte@4.2.7) + specifier: 5.55.2 + version: 5.55.2(svelte@4.2.7) '@tanstack/vue-query': - specifier: 5.53.2 - version: 5.53.2(vue@3.4.38(typescript@5.5.3)) + specifier: 5.55.2 + version: 5.55.2(vue@3.5.3(typescript@5.5.3)) '@types/cross-spawn': specifier: 6.0.6 version: 6.0.6 @@ -2108,6 +2108,9 @@ packages: '@jridgewell/sourcemap-codec@1.4.15': resolution: {integrity: sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==} + '@jridgewell/sourcemap-codec@1.5.0': + resolution: {integrity: sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==} + '@jridgewell/trace-mapping@0.3.25': resolution: {integrity: sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==} @@ -3015,20 +3018,20 @@ packages: '@tanstack/query-core@5.51.21': resolution: {integrity: sha512-POQxm42IUp6n89kKWF4IZi18v3fxQWFRolvBA6phNVmA8psdfB1MvDnGacCJdS+EOX12w/CyHM62z//rHmYmvw==} - '@tanstack/query-core@5.53.2': - resolution: {integrity: sha512-gCsABpRrYfLsmwcQ0JCE5I3LOQ9KYrDDSnseUDP3T7ukV8E7+lhlHDJS4Gegt1TSZCsxKhc1J5A7TkF5ePjDUQ==} + '@tanstack/query-core@5.55.2': + resolution: {integrity: sha512-WfuUx06sw/V3R2tRRQf4KZj0g4Q5EHrTdwJmCUovMFuHWVzDvLd5U+B7d5Pk8ni5w5SGpUuzGuQv3nN8xo1QbQ==} - '@tanstack/query-devtools@5.52.3': - resolution: {integrity: sha512-oGX9qJuNpr4vOQyeksqHr+FgLQGs5UooK87R1wTtcsUUdrRKGSgs3cBllZMtWBJxg+yVvg0TlHNGYLMjvqX3GA==} + '@tanstack/query-devtools@5.55.1': + resolution: {integrity: sha512-2g0TWQGlkyHs9maHIU5A7lRunG4Rj3Y5lOEenE+fydE4zk7GqRs7rKJBp7F74iqRo/cA9V6t1YYQWqd6YRBmcQ==} - '@tanstack/react-query-devtools@5.53.2': - resolution: {integrity: sha512-PvsJqEZMyj/Iur4y/UhxSmxjZaP/KvstO+bGiioI0FbjFerjaeZNRv0WzHU/iSs3TutBt7EMUMC2k9MSGeb3CA==} + '@tanstack/react-query-devtools@5.55.2': + resolution: {integrity: sha512-QkL5Saai7MqEEkGNjhtNB0F1iD4DjpKnvrBM3510L54N8/+4tBPXjMB5a2+ADTYgOrtm4Gn8sJQs/qWKmdpqIg==} peerDependencies: - '@tanstack/react-query': ^5.53.2 + '@tanstack/react-query': ^5.55.2 react: ^18 || ^19 - '@tanstack/react-query@5.53.2': - resolution: {integrity: sha512-ZxG/rspElkfqg2LElnNtsNgPtiCZ4Wl2XY43bATQqPvNgyrhzbCFzCjDwSQy9fJhSiDVALSlxYS8YOIiToqQmg==} + '@tanstack/react-query@5.55.2': + resolution: {integrity: sha512-PkbEmO64nphWPhufkE9aJ+iEScg8tNNCykYlH7vDwb2R6G8uJC+HTJgXc2n8cRaJe6ETVIeQLFFESVd+2N/tww==} peerDependencies: react: ^18 || ^19 @@ -3037,19 +3040,19 @@ packages: peerDependencies: solid-js: ^1.6.0 - '@tanstack/svelte-query@5.53.2': - resolution: {integrity: sha512-LZz4LIdJ0QuScXF4KZWD5LzY5yrDUGWzTPpUlvoJaI3QYyLSL4hrlb+k2Hps4fhOHnNCrMPD7QXl3/RttnWxKQ==} + '@tanstack/svelte-query@5.55.2': + resolution: {integrity: sha512-L4L8Ip83Ezi6XWsuDBKCo9Fv8BwAFkOBYl3xwcwUSnleDrfUsERDc/Rok6fTCxIuRXc0rpaq9jCYS822LIL9+w==} peerDependencies: svelte: ^3.54.0 || ^4.0.0 || ^5.0.0-next.0 - '@tanstack/vue-query-devtools@5.53.2': - resolution: {integrity: sha512-VUQkNiN77fPRjdGrccIQU96jUUVPoBZy8dTepSte7xvxUFlqhb7yAFoC4FNNJNC8FDwLYXnGETs3Euf7J3Edsw==} + '@tanstack/vue-query-devtools@5.55.2': + resolution: {integrity: sha512-99mTo+FxSdy0pukcqaSwheyVi8ZEkQ0PePWR/S2OpBDp9fvfTpL9y2Qm6FMagalnLzlKXECzrwjzLI2F2qkwPQ==} peerDependencies: - '@tanstack/vue-query': ^5.53.2 + '@tanstack/vue-query': ^5.55.2 vue: ^3.3.0 - '@tanstack/vue-query@5.53.2': - resolution: {integrity: sha512-ejQERQlaZBB0ZQz4xUSbMU+L/MXbrd5wIHf8wN48EqEhjhARFbnMBL5DKgl8BO7/uv5dopcSMuCKloR4nE+zbQ==} + '@tanstack/vue-query@5.55.2': + resolution: {integrity: sha512-DTxDW9usLRJ4qX3btHYRNdxnIBCjf5QCADD1ZZOyH3/dNocyfQxMSTlPTzkmPxHjFQgiVrudcjgfnD/QPGp8eQ==} peerDependencies: '@vue/composition-api': ^1.1.2 vue: ^2.6.0 || ^3.3.0 @@ -3455,30 +3458,30 @@ packages: peerDependencies: '@babel/core': ^7.0.0-0 - '@vue/compiler-core@3.4.37': - resolution: {integrity: sha512-ZDDT/KiLKuCRXyzWecNzC5vTcubGz4LECAtfGPENpo0nrmqJHwuWtRLxk/Sb9RAKtR9iFflFycbkjkY+W/PZUQ==} - '@vue/compiler-core@3.4.38': resolution: {integrity: sha512-8IQOTCWnLFqfHzOGm9+P8OPSEDukgg3Huc92qSG49if/xI2SAwLHQO2qaPQbjCWPBcQoO1WYfXfTACUrWV3c5A==} - '@vue/compiler-dom@3.4.37': - resolution: {integrity: sha512-rIiSmL3YrntvgYV84rekAtU/xfogMUJIclUMeIKEtVBFngOL3IeZHhsH3UaFEgB5iFGpj6IW+8YuM/2Up+vVag==} + '@vue/compiler-core@3.5.3': + resolution: {integrity: sha512-adAfy9boPkP233NTyvLbGEqVuIfK/R0ZsBsIOW4BZNfb4BRpRW41Do1u+ozJpsb+mdoy80O20IzAsHaihRb5qA==} '@vue/compiler-dom@3.4.38': resolution: {integrity: sha512-Osc/c7ABsHXTsETLgykcOwIxFktHfGSUDkb05V61rocEfsFDcjDLH/IHJSNJP+/Sv9KeN2Lx1V6McZzlSb9EhQ==} - '@vue/compiler-sfc@3.4.37': - resolution: {integrity: sha512-vCfetdas40Wk9aK/WWf8XcVESffsbNkBQwS5t13Y/PcfqKfIwJX2gF+82th6dOpnpbptNMlMjAny80li7TaCIg==} + '@vue/compiler-dom@3.5.3': + resolution: {integrity: sha512-wnzFArg9zpvk/811CDOZOadJRugf1Bgl/TQ3RfV4nKfSPok4hi0w10ziYUQR6LnnBAUlEXYLUfZ71Oj9ds/+QA==} '@vue/compiler-sfc@3.4.38': resolution: {integrity: sha512-s5QfZ+9PzPh3T5H4hsQDJtI8x7zdJaew/dCGgqZ2630XdzaZ3AD8xGZfBqpT8oaD/p2eedd+pL8tD5vvt5ZYJQ==} - '@vue/compiler-ssr@3.4.37': - resolution: {integrity: sha512-TyAgYBWrHlFrt4qpdACh8e9Ms6C/AZQ6A6xLJaWrCL8GCX5DxMzxyeFAEMfU/VFr4tylHm+a2NpfJpcd7+20XA==} + '@vue/compiler-sfc@3.5.3': + resolution: {integrity: sha512-P3uATLny2tfyvMB04OQFe7Sczteno7SLFxwrOA/dw01pBWQHB5HL15a8PosoNX2aG/EAMGqnXTu+1LnmzFhpTQ==} '@vue/compiler-ssr@3.4.38': resolution: {integrity: sha512-YXznKFQ8dxYpAz9zLuVvfcXhc31FSPFDcqr0kyujbOwNhlmaNvL2QfIy+RZeJgSn5Fk54CWoEUeW+NVBAogGaw==} + '@vue/compiler-ssr@3.5.3': + resolution: {integrity: sha512-F/5f+r2WzL/2YAPl7UlKcJWHrvoZN8XwEBLnT7S4BXwncH25iDOabhO2M2DWioyTguJAGavDOawejkFXj8EM1w==} + '@vue/compiler-vue2@2.7.16': resolution: {integrity: sha512-qYC3Psj9S/mfu9uVi5WvNZIzq+xnXMhOwbTFKKDD7b1lhpnn71jXSFdTQ+WsIEk0ONCd7VV2IMm7ONl6tbQ86A==} @@ -3527,43 +3530,43 @@ packages: typescript: optional: true - '@vue/reactivity@3.4.37': - resolution: {integrity: sha512-UmdKXGx0BZ5kkxPqQr3PK3tElz6adTey4307NzZ3whZu19i5VavYal7u2FfOmAzlcDVgE8+X0HZ2LxLb/jgbYw==} - '@vue/reactivity@3.4.38': resolution: {integrity: sha512-4vl4wMMVniLsSYYeldAKzbk72+D3hUnkw9z8lDeJacTxAkXeDAP1uE9xr2+aKIN0ipOL8EG2GPouVTH6yF7Gnw==} - '@vue/runtime-core@3.4.37': - resolution: {integrity: sha512-MNjrVoLV/sirHZoD7QAilU1Ifs7m/KJv4/84QVbE6nyAZGQNVOa1HGxaOzp9YqCG+GpLt1hNDC4RbH+KtanV7w==} + '@vue/reactivity@3.5.3': + resolution: {integrity: sha512-2w61UnRWTP7+rj1H/j6FH706gRBHdFVpIqEkSDAyIpafBXYH8xt4gttstbbCWdU3OlcSWO8/3mbKl/93/HSMpw==} '@vue/runtime-core@3.4.38': resolution: {integrity: sha512-21z3wA99EABtuf+O3IhdxP0iHgkBs1vuoCAsCKLVJPEjpVqvblwBnTj42vzHRlWDCyxu9ptDm7sI2ZMcWrQqlA==} - '@vue/runtime-dom@3.4.37': - resolution: {integrity: sha512-Mg2EwgGZqtwKrqdL/FKMF2NEaOHuH+Ks9TQn3DHKyX//hQTYOun+7Tqp1eo0P4Ds+SjltZshOSRq6VsU0baaNg==} + '@vue/runtime-core@3.5.3': + resolution: {integrity: sha512-5b2AQw5OZlmCzSsSBWYoZOsy75N4UdMWenTfDdI5bAzXnuVR7iR8Q4AOzQm2OGoA41xjk53VQKrqQhOz2ktWaw==} '@vue/runtime-dom@3.4.38': resolution: {integrity: sha512-afZzmUreU7vKwKsV17H1NDThEEmdYI+GCAK/KY1U957Ig2NATPVjCROv61R19fjZNzMmiU03n79OMnXyJVN0UA==} - '@vue/server-renderer@3.4.37': - resolution: {integrity: sha512-jZ5FAHDR2KBq2FsRUJW6GKDOAG9lUTX8aBEGq4Vf6B/35I9fPce66BornuwmqmKgfiSlecwuOb6oeoamYMohkg==} - peerDependencies: - vue: 3.4.37 + '@vue/runtime-dom@3.5.3': + resolution: {integrity: sha512-wPR1DEGc3XnQ7yHbmkTt3GoY0cEnVGQnARRdAkDzZ8MbUKEs26gogCQo6AOvvgahfjIcnvWJzkZArQ1fmWjcSg==} '@vue/server-renderer@3.4.38': resolution: {integrity: sha512-NggOTr82FbPEkkUvBm4fTGcwUY8UuTsnWC/L2YZBmvaQ4C4Jl/Ao4HHTB+l7WnFCt5M/dN3l0XLuyjzswGYVCA==} peerDependencies: vue: 3.4.38 + '@vue/server-renderer@3.5.3': + resolution: {integrity: sha512-28volmaZVG2PGO3V3+gBPKoSHvLlE8FGfG/GKXKkjjfxLuj/50B/0OQGakM/g6ehQeqCrZYM4eHC4Ks48eig1Q==} + peerDependencies: + vue: 3.5.3 + '@vue/shared@3.4.31': resolution: {integrity: sha512-Yp3wtJk//8cO4NItOPpi3QkLExAr/aLBGZMmTtW9WpdwBCJpRM6zj9WgWktXAl8IDIozwNMByT45JP3tO3ACWA==} - '@vue/shared@3.4.37': - resolution: {integrity: sha512-nIh8P2fc3DflG8+5Uw8PT/1i17ccFn0xxN/5oE9RfV5SVnd7G0XEFRwakrnNFE/jlS95fpGXDVG5zDETS26nmg==} - '@vue/shared@3.4.38': resolution: {integrity: sha512-q0xCiLkuWWQLzVrecPb0RMsNWyxICOjPrcrwxTUEHb1fsnvni4dcuyG7RT/Ie7VPTvnjzIaWzRMUBsrqNj/hhw==} + '@vue/shared@3.5.3': + resolution: {integrity: sha512-Jp2v8nylKBT+PlOUjun2Wp/f++TfJVFjshLzNtJDdmFJabJa7noGMncqXRM1vXGX+Yo2V7WykQFNxusSim8SCA==} + '@vue/test-utils@2.4.6': resolution: {integrity: sha512-FMxEjOpYNYiFe0GkaHsnJPXFHxQ6m4t8vI/ElPGpMWxZKpmRvQ33OIrvRXemy6yha03RxhOlQuy+gZMC3CQSow==} @@ -3997,8 +4000,8 @@ packages: resolution: {integrity: sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==} engines: {node: '>= 0.8'} - c12@1.11.1: - resolution: {integrity: sha512-KDU0TvSvVdaYcQKQ6iPHATGz/7p/KiVjPg4vQrB6Jg/wX9R0yl5RZxWm9IoZqaIHD2+6PZd81+KMGwRr/lRIUg==} + c12@1.11.2: + resolution: {integrity: sha512-oBs8a4uvSDO9dm8b7OCFW7+dgtVrwmwnrVXYzLm43ta7ep2jCn/0MhoUFygIWtxhyy6+/MG7/agvpY0U1Iemew==} peerDependencies: magicast: ^0.3.4 peerDependenciesMeta: @@ -4531,10 +4534,6 @@ packages: resolution: {integrity: sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==} engines: {node: '>=0.12'} - entities@5.0.0: - resolution: {integrity: sha512-BeJFvFRJddxobhvEdm5GqHzRV/X+ACeuw0/BuuxsCh1EUZcAIz8+kYmBp/LrQuloy6K1f3a0M7+IhmZ7QnkISA==} - engines: {node: '>=0.12'} - env-paths@2.2.1: resolution: {integrity: sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A==} engines: {node: '>=6'} @@ -5668,6 +5667,9 @@ packages: magic-string@0.30.10: resolution: {integrity: sha512-iIRwTIf0QKV3UAnYK4PU8uiEc4SRh5jX0mwpIwETPpHdhVM4f53RSwS/vXvN1JhGX+Cs7B8qIq3d6AH49O5fAQ==} + magic-string@0.30.11: + resolution: {integrity: sha512-+Wri9p0QHMy+545hKww7YAu5NyzF8iomPL/RQazugQ9+Ez4Ic3mERMd8ZTX5rfK944j+560ZJi8iAwgak1Ac7A==} + magic-string@0.30.8: resolution: {integrity: sha512-ISQTe55T2ao7XtlAStud6qwYPZjE4GK1S/BeVPus4jrq6JuOnQ00YKQC581RWhR122W7msZV263KzVeLoqidyQ==} engines: {node: '>=12'} @@ -6267,6 +6269,9 @@ packages: pkg-types@1.1.1: resolution: {integrity: sha512-ko14TjmDuQJ14zsotODv7dBlwxKhUKQEhuhmbqo1uCi9BB0Z2alo/wAXg6q1dTR5TyuqYyWhjtfe/Tsh+X28jQ==} + pkg-types@1.2.0: + resolution: {integrity: sha512-+ifYuSSqOQ8CqP4MbZA5hDpb97n3E8SVWdJe+Wms9kj745lmd3b7EZJiqvmLwAlmRfjrI7Hi5z3kdBJ93lFNPA==} + postcss-import@15.1.0: resolution: {integrity: sha512-hpr+J05B2FVYUAXHeK1YyI267J/dDDhMU6B6civm8hSY1jYJnBXxzKDKDswzJmtLHryrjhnDjqqp/49t8FALew==} engines: {node: '>=14.0.0'} @@ -6380,6 +6385,10 @@ packages: resolution: {integrity: sha512-TesUflQ0WKZqAvg52PWL6kHgLKP6xB6heTOdoYM0Wt2UHyxNa4K25EZZMgKns3BH1RLVbZCREPpLY0rhnNoHVQ==} engines: {node: ^10 || ^12 || >=14} + postcss@8.4.45: + resolution: {integrity: sha512-7KTLTdzdZZYscUc65XmjFiB73vBhBfbPztCYdUNvlaso9PrzjzcmjqBPR0lNGkcVlcO4BjiO5rK/qNz+XAen1Q==} + engines: {node: ^10 || ^12 || >=14} + preact@10.22.0: resolution: {integrity: sha512-RRurnSjJPj4rp5K6XoP45Ui33ncb7e4H7WiOHVpjbkvqvA3U+N8Z6Qbo0AE6leGYBV66n8EhEaFixvIu3SkxFw==} @@ -7734,16 +7743,16 @@ packages: peerDependencies: typescript: '>=5.0.0' - vue@3.4.37: - resolution: {integrity: sha512-3vXvNfkKTBsSJ7JP+LyR7GBuwQuckbWvuwAid3xbqK9ppsKt/DUvfqgZ48fgOLEfpy1IacL5f8QhUVl77RaI7A==} + vue@3.4.38: + resolution: {integrity: sha512-f0ZgN+mZ5KFgVv9wz0f4OgVKukoXtS3nwET4c2vLBGQR50aI8G0cqbFtLlX9Yiyg3LFGBitruPHt2PxwTduJEw==} peerDependencies: typescript: '*' peerDependenciesMeta: typescript: optional: true - vue@3.4.38: - resolution: {integrity: sha512-f0ZgN+mZ5KFgVv9wz0f4OgVKukoXtS3nwET4c2vLBGQR50aI8G0cqbFtLlX9Yiyg3LFGBitruPHt2PxwTduJEw==} + vue@3.5.3: + resolution: {integrity: sha512-xvRbd0HpuLovYbOHXRHlSBsSvmUJbo0pzbkKTApWnQGf3/cu5Z39mQeA5cZdLRVIoNf3zI6MSoOgHUT5i2jO+Q==} peerDependencies: typescript: '*' peerDependenciesMeta: @@ -9845,6 +9854,8 @@ snapshots: '@jridgewell/sourcemap-codec@1.4.15': {} + '@jridgewell/sourcemap-codec@1.5.0': {} + '@jridgewell/trace-mapping@0.3.25': dependencies: '@jridgewell/resolve-uri': 3.1.2 @@ -10839,19 +10850,19 @@ snapshots: '@tanstack/query-core@5.51.21': {} - '@tanstack/query-core@5.53.2': {} + '@tanstack/query-core@5.55.2': {} - '@tanstack/query-devtools@5.52.3': {} + '@tanstack/query-devtools@5.55.1': {} - '@tanstack/react-query-devtools@5.53.2(@tanstack/react-query@5.53.2(react@18.3.1))(react@18.3.1)': + '@tanstack/react-query-devtools@5.55.2(@tanstack/react-query@5.55.2(react@18.3.1))(react@18.3.1)': dependencies: - '@tanstack/query-devtools': 5.52.3 - '@tanstack/react-query': 5.53.2(react@18.3.1) + '@tanstack/query-devtools': 5.55.1 + '@tanstack/react-query': 5.55.2(react@18.3.1) react: 18.3.1 - '@tanstack/react-query@5.53.2(react@18.3.1)': + '@tanstack/react-query@5.55.2(react@18.3.1)': dependencies: - '@tanstack/query-core': 5.53.2 + '@tanstack/query-core': 5.55.2 react: 18.3.1 '@tanstack/solid-query@5.51.21(solid-js@1.8.20)': @@ -10859,24 +10870,24 @@ snapshots: '@tanstack/query-core': 5.51.21 solid-js: 1.8.20 - '@tanstack/svelte-query@5.53.2(svelte@4.2.7)': + '@tanstack/svelte-query@5.55.2(svelte@4.2.7)': dependencies: - '@tanstack/query-core': 5.53.2 + '@tanstack/query-core': 5.55.2 svelte: 4.2.7 - '@tanstack/vue-query-devtools@5.53.2(@tanstack/vue-query@5.53.2(vue@3.4.38(typescript@5.5.3)))(vue@3.4.38(typescript@5.5.3))': + '@tanstack/vue-query-devtools@5.55.2(@tanstack/vue-query@5.55.2(vue@3.5.3(typescript@5.5.3)))(vue@3.5.3(typescript@5.5.3))': dependencies: - '@tanstack/query-devtools': 5.52.3 - '@tanstack/vue-query': 5.53.2(vue@3.4.38(typescript@5.5.3)) - vue: 3.4.38(typescript@5.5.3) + '@tanstack/query-devtools': 5.55.1 + '@tanstack/vue-query': 5.55.2(vue@3.5.3(typescript@5.5.3)) + vue: 3.5.3(typescript@5.5.3) - '@tanstack/vue-query@5.53.2(vue@3.4.38(typescript@5.5.3))': + '@tanstack/vue-query@5.55.2(vue@3.5.3(typescript@5.5.3))': dependencies: '@tanstack/match-sorter-utils': 8.19.4 - '@tanstack/query-core': 5.53.2 + '@tanstack/query-core': 5.55.2 '@vue/devtools-api': 6.6.3 - vue: 3.4.38(typescript@5.5.3) - vue-demi: 0.14.10(vue@3.4.38(typescript@5.5.3)) + vue: 3.5.3(typescript@5.5.3) + vue-demi: 0.14.10(vue@3.5.3(typescript@5.5.3)) '@tootallnate/quickjs-emscripten@0.23.0': {} @@ -11294,25 +11305,25 @@ snapshots: transitivePeerDependencies: - supports-color - '@vitejs/plugin-vue-jsx@4.0.0(vite@5.3.3(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1))(vue@3.4.38(typescript@5.5.3))': + '@vitejs/plugin-vue-jsx@4.0.0(vite@5.3.3(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1))(vue@3.5.3(typescript@5.5.3))': dependencies: '@babel/core': 7.24.7 '@babel/plugin-transform-typescript': 7.25.2(@babel/core@7.24.7) '@vue/babel-plugin-jsx': 1.2.2(@babel/core@7.24.7) vite: 5.3.3(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1) - vue: 3.4.38(typescript@5.5.3) + vue: 3.5.3(typescript@5.5.3) transitivePeerDependencies: - supports-color - '@vitejs/plugin-vue@5.0.5(vite@5.3.3(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1))(vue@3.4.37(typescript@5.5.3))': + '@vitejs/plugin-vue@5.0.5(vite@5.3.3(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1))(vue@3.4.38(typescript@5.5.3))': dependencies: vite: 5.3.3(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1) - vue: 3.4.37(typescript@5.5.3) + vue: 3.4.38(typescript@5.5.3) - '@vitejs/plugin-vue@5.0.5(vite@5.3.3(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1))(vue@3.4.38(typescript@5.5.3))': + '@vitejs/plugin-vue@5.0.5(vite@5.3.3(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1))(vue@3.5.3(typescript@5.5.3))': dependencies: vite: 5.3.3(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1) - vue: 3.4.38(typescript@5.5.3) + vue: 3.5.3(typescript@5.5.3) '@vitest/coverage-v8@1.6.0(vitest@1.6.0(@types/node@20.14.10)(jsdom@24.1.0)(less@4.2.0)(sass@1.71.1)(terser@5.31.1))': dependencies: @@ -11429,45 +11440,33 @@ snapshots: '@babel/helper-module-imports': 7.22.15 '@babel/helper-plugin-utils': 7.24.8 '@babel/parser': 7.25.3 - '@vue/compiler-sfc': 3.4.38 + '@vue/compiler-sfc': 3.5.3 - '@vue/compiler-core@3.4.37': + '@vue/compiler-core@3.4.38': dependencies: '@babel/parser': 7.25.3 - '@vue/shared': 3.4.37 - entities: 5.0.0 + '@vue/shared': 3.4.38 + entities: 4.5.0 estree-walker: 2.0.2 source-map-js: 1.2.0 - '@vue/compiler-core@3.4.38': + '@vue/compiler-core@3.5.3': dependencies: '@babel/parser': 7.25.3 - '@vue/shared': 3.4.38 + '@vue/shared': 3.5.3 entities: 4.5.0 estree-walker: 2.0.2 source-map-js: 1.2.0 - '@vue/compiler-dom@3.4.37': - dependencies: - '@vue/compiler-core': 3.4.37 - '@vue/shared': 3.4.37 - '@vue/compiler-dom@3.4.38': dependencies: '@vue/compiler-core': 3.4.38 '@vue/shared': 3.4.38 - '@vue/compiler-sfc@3.4.37': + '@vue/compiler-dom@3.5.3': dependencies: - '@babel/parser': 7.25.3 - '@vue/compiler-core': 3.4.37 - '@vue/compiler-dom': 3.4.37 - '@vue/compiler-ssr': 3.4.37 - '@vue/shared': 3.4.37 - estree-walker: 2.0.2 - magic-string: 0.30.10 - postcss: 8.4.41 - source-map-js: 1.2.0 + '@vue/compiler-core': 3.5.3 + '@vue/shared': 3.5.3 '@vue/compiler-sfc@3.4.38': dependencies: @@ -11481,16 +11480,28 @@ snapshots: postcss: 8.4.41 source-map-js: 1.2.0 - '@vue/compiler-ssr@3.4.37': + '@vue/compiler-sfc@3.5.3': dependencies: - '@vue/compiler-dom': 3.4.37 - '@vue/shared': 3.4.37 + '@babel/parser': 7.25.3 + '@vue/compiler-core': 3.5.3 + '@vue/compiler-dom': 3.5.3 + '@vue/compiler-ssr': 3.5.3 + '@vue/shared': 3.5.3 + estree-walker: 2.0.2 + magic-string: 0.30.11 + postcss: 8.4.45 + source-map-js: 1.2.0 '@vue/compiler-ssr@3.4.38': dependencies: '@vue/compiler-dom': 3.4.38 '@vue/shared': 3.4.38 + '@vue/compiler-ssr@3.5.3': + dependencies: + '@vue/compiler-dom': 3.5.3 + '@vue/shared': 3.5.3 + '@vue/compiler-vue2@2.7.16': dependencies: de-indent: 1.0.2 @@ -11502,7 +11513,7 @@ snapshots: dependencies: '@vue/devtools-kit': 7.3.5 - '@vue/devtools-core@7.3.7(vite@5.3.3(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1))(vue@3.4.38(typescript@5.5.3))': + '@vue/devtools-core@7.3.7(vite@5.3.3(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1))(vue@3.5.3(typescript@5.5.3))': dependencies: '@vue/devtools-kit': 7.3.7 '@vue/devtools-shared': 7.3.7 @@ -11510,7 +11521,7 @@ snapshots: nanoid: 3.3.7 pathe: 1.1.2 vite-hot-client: 0.2.3(vite@5.3.3(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1)) - vue: 3.4.38(typescript@5.5.3) + vue: 3.5.3(typescript@5.5.3) transitivePeerDependencies: - vite @@ -11562,9 +11573,9 @@ snapshots: '@vue/language-core@2.0.29(typescript@5.5.3)': dependencies: '@volar/language-core': 2.4.0-alpha.18 - '@vue/compiler-dom': 3.4.37 + '@vue/compiler-dom': 3.4.38 '@vue/compiler-vue2': 2.7.16 - '@vue/shared': 3.4.37 + '@vue/shared': 3.4.38 computeds: 0.0.1 minimatch: 9.0.5 muggle-string: 0.4.1 @@ -11572,30 +11583,23 @@ snapshots: optionalDependencies: typescript: 5.5.3 - '@vue/reactivity@3.4.37': - dependencies: - '@vue/shared': 3.4.37 - '@vue/reactivity@3.4.38': dependencies: '@vue/shared': 3.4.38 - '@vue/runtime-core@3.4.37': + '@vue/reactivity@3.5.3': dependencies: - '@vue/reactivity': 3.4.37 - '@vue/shared': 3.4.37 + '@vue/shared': 3.5.3 '@vue/runtime-core@3.4.38': dependencies: '@vue/reactivity': 3.4.38 '@vue/shared': 3.4.38 - '@vue/runtime-dom@3.4.37': + '@vue/runtime-core@3.5.3': dependencies: - '@vue/reactivity': 3.4.37 - '@vue/runtime-core': 3.4.37 - '@vue/shared': 3.4.37 - csstype: 3.1.3 + '@vue/reactivity': 3.5.3 + '@vue/shared': 3.5.3 '@vue/runtime-dom@3.4.38': dependencies: @@ -11604,11 +11608,12 @@ snapshots: '@vue/shared': 3.4.38 csstype: 3.1.3 - '@vue/server-renderer@3.4.37(vue@3.4.37(typescript@5.5.3))': + '@vue/runtime-dom@3.5.3': dependencies: - '@vue/compiler-ssr': 3.4.37 - '@vue/shared': 3.4.37 - vue: 3.4.37(typescript@5.5.3) + '@vue/reactivity': 3.5.3 + '@vue/runtime-core': 3.5.3 + '@vue/shared': 3.5.3 + csstype: 3.1.3 '@vue/server-renderer@3.4.38(vue@3.4.38(typescript@5.5.3))': dependencies: @@ -11616,12 +11621,18 @@ snapshots: '@vue/shared': 3.4.38 vue: 3.4.38(typescript@5.5.3) - '@vue/shared@3.4.31': {} + '@vue/server-renderer@3.5.3(vue@3.5.3(typescript@5.5.3))': + dependencies: + '@vue/compiler-ssr': 3.5.3 + '@vue/shared': 3.5.3 + vue: 3.5.3(typescript@5.5.3) - '@vue/shared@3.4.37': {} + '@vue/shared@3.4.31': {} '@vue/shared@3.4.38': {} + '@vue/shared@3.5.3': {} + '@vue/test-utils@2.4.6': dependencies: js-beautify: 1.15.1 @@ -11629,21 +11640,21 @@ snapshots: '@vue/tsconfig@0.5.1': {} - '@vueuse/core@10.11.0(vue@3.4.37(typescript@5.5.3))': + '@vueuse/core@10.11.0(vue@3.4.38(typescript@5.5.3))': dependencies: '@types/web-bluetooth': 0.0.20 '@vueuse/metadata': 10.11.0 - '@vueuse/shared': 10.11.0(vue@3.4.37(typescript@5.5.3)) - vue-demi: 0.14.10(vue@3.4.37(typescript@5.5.3)) + '@vueuse/shared': 10.11.0(vue@3.4.38(typescript@5.5.3)) + vue-demi: 0.14.10(vue@3.4.38(typescript@5.5.3)) transitivePeerDependencies: - '@vue/composition-api' - vue - '@vueuse/integrations@10.11.0(axios@1.7.7)(focus-trap@7.5.4)(vue@3.4.37(typescript@5.5.3))': + '@vueuse/integrations@10.11.0(axios@1.7.7)(focus-trap@7.5.4)(vue@3.4.38(typescript@5.5.3))': dependencies: - '@vueuse/core': 10.11.0(vue@3.4.37(typescript@5.5.3)) - '@vueuse/shared': 10.11.0(vue@3.4.37(typescript@5.5.3)) - vue-demi: 0.14.10(vue@3.4.37(typescript@5.5.3)) + '@vueuse/core': 10.11.0(vue@3.4.38(typescript@5.5.3)) + '@vueuse/shared': 10.11.0(vue@3.4.38(typescript@5.5.3)) + vue-demi: 0.14.10(vue@3.4.38(typescript@5.5.3)) optionalDependencies: axios: 1.7.7 focus-trap: 7.5.4 @@ -11653,9 +11664,9 @@ snapshots: '@vueuse/metadata@10.11.0': {} - '@vueuse/shared@10.11.0(vue@3.4.37(typescript@5.5.3))': + '@vueuse/shared@10.11.0(vue@3.4.38(typescript@5.5.3))': dependencies: - vue-demi: 0.14.10(vue@3.4.37(typescript@5.5.3)) + vue-demi: 0.14.10(vue@3.4.38(typescript@5.5.3)) transitivePeerDependencies: - '@vue/composition-api' - vue @@ -12108,7 +12119,7 @@ snapshots: bytes@3.1.2: {} - c12@1.11.1(magicast@0.3.4): + c12@1.11.2(magicast@0.3.4): dependencies: chokidar: 3.6.0 confbox: 0.1.7 @@ -12120,7 +12131,7 @@ snapshots: ohash: 1.1.3 pathe: 1.1.2 perfect-debounce: 1.0.0 - pkg-types: 1.1.1 + pkg-types: 1.2.0 rc9: 2.1.2 optionalDependencies: magicast: 0.3.4 @@ -12617,8 +12628,6 @@ snapshots: entities@4.5.0: {} - entities@5.0.0: {} - env-paths@2.2.1: {} err-code@2.0.3: {} @@ -13945,6 +13954,10 @@ snapshots: dependencies: '@jridgewell/sourcemap-codec': 1.4.15 + magic-string@0.30.11: + dependencies: + '@jridgewell/sourcemap-codec': 1.5.0 + magic-string@0.30.8: dependencies: '@jridgewell/sourcemap-codec': 1.4.15 @@ -14101,7 +14114,7 @@ snapshots: dependencies: acorn: 8.12.0 pathe: 1.1.2 - pkg-types: 1.1.1 + pkg-types: 1.2.0 ufo: 1.5.3 mri@1.2.0: {} @@ -14521,11 +14534,11 @@ snapshots: pify@4.0.1: {} - pinia@2.2.2(typescript@5.5.3)(vue@3.4.38(typescript@5.5.3)): + pinia@2.2.2(typescript@5.5.3)(vue@3.5.3(typescript@5.5.3)): dependencies: '@vue/devtools-api': 6.6.3 - vue: 3.4.38(typescript@5.5.3) - vue-demi: 0.14.10(vue@3.4.38(typescript@5.5.3)) + vue: 3.5.3(typescript@5.5.3) + vue-demi: 0.14.10(vue@3.5.3(typescript@5.5.3)) optionalDependencies: typescript: 5.5.3 @@ -14549,6 +14562,12 @@ snapshots: mlly: 1.7.1 pathe: 1.1.2 + pkg-types@1.2.0: + dependencies: + confbox: 0.1.7 + mlly: 1.7.1 + pathe: 1.1.2 + postcss-import@15.1.0(postcss@8.4.39): dependencies: postcss: 8.4.39 @@ -14657,6 +14676,12 @@ snapshots: picocolors: 1.0.1 source-map-js: 1.2.0 + postcss@8.4.45: + dependencies: + nanoid: 3.3.7 + picocolors: 1.0.1 + source-map-js: 1.2.0 + preact@10.22.0: {} preferred-pm@3.1.4: @@ -15967,9 +15992,9 @@ snapshots: - rollup - supports-color - vite-plugin-vue-devtools@7.3.1(rollup@4.18.0)(vite@5.3.3(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1))(vue@3.4.38(typescript@5.5.3)): + vite-plugin-vue-devtools@7.3.1(rollup@4.18.0)(vite@5.3.3(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1))(vue@3.5.3(typescript@5.5.3)): dependencies: - '@vue/devtools-core': 7.3.7(vite@5.3.3(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1))(vue@3.4.38(typescript@5.5.3)) + '@vue/devtools-core': 7.3.7(vite@5.3.3(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1))(vue@3.5.3(typescript@5.5.3)) '@vue/devtools-kit': 7.3.7 '@vue/devtools-shared': 7.3.7 execa: 8.0.1 @@ -15991,7 +16016,7 @@ snapshots: '@babel/plugin-syntax-import-meta': 7.10.4(@babel/core@7.24.7) '@babel/plugin-transform-typescript': 7.25.2(@babel/core@7.24.7) '@vue/babel-plugin-jsx': 1.2.2(@babel/core@7.24.7) - '@vue/compiler-dom': 3.4.37 + '@vue/compiler-dom': 3.4.38 kolorist: 1.8.0 magic-string: 0.30.10 vite: 5.3.3(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1) @@ -16050,26 +16075,26 @@ snapshots: optionalDependencies: vite: 5.0.3(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1) - vitepress@1.3.0(@algolia/client-search@4.23.3)(@types/node@20.14.10)(@types/react@18.3.3)(axios@1.7.7)(less@4.2.0)(postcss@8.4.41)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.71.1)(search-insights@2.14.0)(terser@5.31.1)(typescript@5.5.3): + vitepress@1.3.0(@algolia/client-search@4.23.3)(@types/node@20.14.10)(@types/react@18.3.3)(axios@1.7.7)(less@4.2.0)(postcss@8.4.45)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.71.1)(search-insights@2.14.0)(terser@5.31.1)(typescript@5.5.3): dependencies: '@docsearch/css': 3.6.0 '@docsearch/js': 3.6.0(@algolia/client-search@4.23.3)(@types/react@18.3.3)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(search-insights@2.14.0) '@shikijs/core': 1.10.3 '@shikijs/transformers': 1.10.3 '@types/markdown-it': 14.1.1 - '@vitejs/plugin-vue': 5.0.5(vite@5.3.3(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1))(vue@3.4.37(typescript@5.5.3)) + '@vitejs/plugin-vue': 5.0.5(vite@5.3.3(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1))(vue@3.4.38(typescript@5.5.3)) '@vue/devtools-api': 7.3.5 '@vue/shared': 3.4.31 - '@vueuse/core': 10.11.0(vue@3.4.37(typescript@5.5.3)) - '@vueuse/integrations': 10.11.0(axios@1.7.7)(focus-trap@7.5.4)(vue@3.4.37(typescript@5.5.3)) + '@vueuse/core': 10.11.0(vue@3.4.38(typescript@5.5.3)) + '@vueuse/integrations': 10.11.0(axios@1.7.7)(focus-trap@7.5.4)(vue@3.4.38(typescript@5.5.3)) focus-trap: 7.5.4 mark.js: 8.11.1 minisearch: 6.3.0 shiki: 1.10.3 vite: 5.3.3(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1) - vue: 3.4.37(typescript@5.5.3) + vue: 3.4.38(typescript@5.5.3) optionalDependencies: - postcss: 8.4.41 + postcss: 8.4.45 transitivePeerDependencies: - '@algolia/client-search' - '@types/node' @@ -16201,14 +16226,14 @@ snapshots: vue-component-type-helpers@2.0.29: {} - vue-demi@0.14.10(vue@3.4.37(typescript@5.5.3)): - dependencies: - vue: 3.4.37(typescript@5.5.3) - vue-demi@0.14.10(vue@3.4.38(typescript@5.5.3)): dependencies: vue: 3.4.38(typescript@5.5.3) + vue-demi@0.14.10(vue@3.5.3(typescript@5.5.3)): + dependencies: + vue: 3.5.3(typescript@5.5.3) + vue-eslint-parser@9.4.3(eslint@9.6.0): dependencies: debug: 4.3.5 @@ -16222,10 +16247,10 @@ snapshots: transitivePeerDependencies: - supports-color - vue-router@4.4.3(vue@3.4.38(typescript@5.5.3)): + vue-router@4.4.3(vue@3.5.3(typescript@5.5.3)): dependencies: '@vue/devtools-api': 6.6.3 - vue: 3.4.38(typescript@5.5.3) + vue: 3.5.3(typescript@5.5.3) vue-tsc@2.0.29(typescript@5.5.3): dependencies: @@ -16234,16 +16259,6 @@ snapshots: semver: 7.6.2 typescript: 5.5.3 - vue@3.4.37(typescript@5.5.3): - dependencies: - '@vue/compiler-dom': 3.4.37 - '@vue/compiler-sfc': 3.4.37 - '@vue/runtime-dom': 3.4.37 - '@vue/server-renderer': 3.4.37(vue@3.4.37(typescript@5.5.3)) - '@vue/shared': 3.4.37 - optionalDependencies: - typescript: 5.5.3 - vue@3.4.38(typescript@5.5.3): dependencies: '@vue/compiler-dom': 3.4.38 @@ -16254,6 +16269,16 @@ snapshots: optionalDependencies: typescript: 5.5.3 + vue@3.5.3(typescript@5.5.3): + dependencies: + '@vue/compiler-dom': 3.5.3 + '@vue/compiler-sfc': 3.5.3 + '@vue/runtime-dom': 3.5.3 + '@vue/server-renderer': 3.5.3(vue@3.5.3(typescript@5.5.3)) + '@vue/shared': 3.5.3 + optionalDependencies: + typescript: 5.5.3 + w3c-xmlserializer@5.0.0: dependencies: xml-name-validator: 5.0.0 -- 2.51.2 From deaf901bb7bc3301eed7e5bf2596e367cad03bd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francisco=20Garc=C3=ADa?= Date: Wed, 11 Sep 2024 07:22:04 +0200 Subject: [PATCH 06/49] update snapshot test --- .../v3-hey-api-client-fetch-bundle/core/utils.ts.snap | 8 ++++++++ .../core/utils.ts.snap | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle/core/utils.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle/core/utils.ts.snap index d5ae551d8..3fbc16855 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle/core/utils.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle/core/utils.ts.snap @@ -440,6 +440,14 @@ class Interceptors { this._fns = []; } + clear() { + this._fns = []; + } + + exists(fn: Interceptor) { + return this._fns.indexOf(fn) !== -1; + } + eject(fn: Interceptor) { const index = this._fns.indexOf(fn); if (index !== -1) { diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle_transform/core/utils.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle_transform/core/utils.ts.snap index d5ae551d8..3fbc16855 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle_transform/core/utils.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle_transform/core/utils.ts.snap @@ -440,6 +440,14 @@ class Interceptors { this._fns = []; } + clear() { + this._fns = []; + } + + exists(fn: Interceptor) { + return this._fns.indexOf(fn) !== -1; + } + eject(fn: Interceptor) { const index = this._fns.indexOf(fn); if (index !== -1) { -- 2.51.2 From 0f7dbe72a870b22349ade26825bec15456327b91 Mon Sep 17 00:00:00 2001 From: Mika Vilpas Date: Thu, 12 Sep 2024 07:49:10 +0300 Subject: [PATCH 07/49] refactor: remove unnecessary type assertion --- packages/client-fetch/src/index.ts | 2 +- .../v3-hey-api-client-fetch-bundle_transform/core/index.ts.snap | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/client-fetch/src/index.ts b/packages/client-fetch/src/index.ts index f1be83f2e..ab5cd4a1f 100644 --- a/packages/client-fetch/src/index.ts +++ b/packages/client-fetch/src/index.ts @@ -142,5 +142,5 @@ export const createClient = (config: Config = {}): Client => { request, setConfig, trace: (options) => request({ ...options, method: 'TRACE' }), - } as Client; + }; }; diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle_transform/core/index.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle_transform/core/index.ts.snap index f1be83f2e..ab5cd4a1f 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle_transform/core/index.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle_transform/core/index.ts.snap @@ -142,5 +142,5 @@ export const createClient = (config: Config = {}): Client => { request, setConfig, trace: (options) => request({ ...options, method: 'TRACE' }), - } as Client; + }; }; -- 2.51.2 From 1e49b284023ca126740dc382189e261ffae07e39 Mon Sep 17 00:00:00 2001 From: Mika Vilpas Date: Thu, 12 Sep 2024 07:54:49 +0300 Subject: [PATCH 08/49] refactor: eslint uses `import type` where possible This commit adds an eslint rule `@typescript-eslint/consistent-type-imports` that warns (and automatically fixes) when `import` is used instead of `import type` for importing types. This has minor performance benefits at build time and maybe at runtime, but can also communicate the intent of the import more clearly. For a nice developer experience, it's recommended to enable autofixing fixable eslint issues so that the developer never has to worry about this - it's done completely automatically when the file is saved. Autoformatting with prettier is also recommended. - https://typescript-eslint.io/blog/consistent-type-imports-and-exports-why-and-how/ - https://typescript-eslint.io/rules/consistent-type-imports/ --- eslint.config.js | 7 +++++++ packages/client-axios/src/index.ts | 3 ++- packages/openapi-ts/src/compiler/classes.ts | 8 ++------ packages/openapi-ts/src/compiler/index.ts | 2 +- packages/openapi-ts/src/generate/services.ts | 9 ++++----- packages/openapi-ts/src/generate/types.ts | 2 +- packages/openapi-ts/src/openApi/common/parser/getRef.ts | 2 +- .../src/plugins/@tanstack/query-core/plugin.ts | 2 +- .../v3-hey-api-client-axios-bundle/core/index.ts.snap | 3 ++- .../core/index.ts.snap | 3 ++- .../v3-hey-api-client-fetch-bundle/core/index.ts.snap | 2 +- packages/openapi-ts/test/e2e/scripts/browser.ts | 3 ++- packages/openapi-ts/test/e2e/scripts/server.ts | 5 +++-- 13 files changed, 29 insertions(+), 22 deletions(-) diff --git a/eslint.config.js b/eslint.config.js index 09b7e5a45..e36c19669 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -25,6 +25,7 @@ export default tseslint.config( rules: { '@typescript-eslint/ban-ts-comment': 'off', '@typescript-eslint/ban-ts-ignore': 'off', + '@typescript-eslint/consistent-type-imports': 'warn', '@typescript-eslint/explicit-function-return-type': 'off', '@typescript-eslint/explicit-module-boundary-types': 'off', '@typescript-eslint/no-explicit-any': 'off', @@ -43,6 +44,12 @@ export default tseslint.config( 'typescript-sort-keys/string-enum': 'warn', }, }, + { + files: ['packages/openapi-ts/test/e2e/assets/main-angular-module.ts'], + rules: { + '@typescript-eslint/consistent-type-imports': 'off', + }, + }, configPrettier, { ignores: [ diff --git a/packages/client-axios/src/index.ts b/packages/client-axios/src/index.ts index 8ff7d218d..afe16e6a1 100644 --- a/packages/client-axios/src/index.ts +++ b/packages/client-axios/src/index.ts @@ -1,4 +1,5 @@ -import axios, { AxiosError } from 'axios'; +import type { AxiosError } from 'axios'; +import axios from 'axios'; import type { Client, Config, RequestOptions } from './types'; import { createConfig, getUrl, mergeConfigs, mergeHeaders } from './utils'; diff --git a/packages/openapi-ts/src/compiler/classes.ts b/packages/openapi-ts/src/compiler/classes.ts index 10641b485..6484aa85a 100644 --- a/packages/openapi-ts/src/compiler/classes.ts +++ b/packages/openapi-ts/src/compiler/classes.ts @@ -11,12 +11,8 @@ import { toParameterDeclarations, toTypeParameters, } from './types'; -import { - addLeadingComments, - Comments, - createIdentifier, - isType, -} from './utils'; +import type { Comments } from './utils'; +import { addLeadingComments, createIdentifier, isType } from './utils'; /** * Create a class constructor declaration. diff --git a/packages/openapi-ts/src/compiler/index.ts b/packages/openapi-ts/src/compiler/index.ts index 00bd1cb66..66305890b 100644 --- a/packages/openapi-ts/src/compiler/index.ts +++ b/packages/openapi-ts/src/compiler/index.ts @@ -1,7 +1,7 @@ import { type PathLike, rmSync, writeFileSync } from 'node:fs'; import path from 'node:path'; -import ts from 'typescript'; +import type ts from 'typescript'; import { ensureDirSync } from '../generate/utils'; import * as classes from './classes'; diff --git a/packages/openapi-ts/src/generate/services.ts b/packages/openapi-ts/src/generate/services.ts index e0ba95254..e97a5f15a 100644 --- a/packages/openapi-ts/src/generate/services.ts +++ b/packages/openapi-ts/src/generate/services.ts @@ -1,11 +1,10 @@ -import { +import type { ClassElement, - type Comments, - compiler, + Comments, FunctionParameter, - type Node, - TypeScriptFile, + Node, } from '../compiler'; +import { compiler, TypeScriptFile } from '../compiler'; import type { FunctionTypeParameter, ObjectValue } from '../compiler/types'; import { isOperationParameterRequired } from '../openApi'; import type { diff --git a/packages/openapi-ts/src/generate/types.ts b/packages/openapi-ts/src/generate/types.ts index c69aab42a..864a82c02 100644 --- a/packages/openapi-ts/src/generate/types.ts +++ b/packages/openapi-ts/src/generate/types.ts @@ -1,4 +1,4 @@ -import { EnumDeclaration } from 'typescript'; +import type { EnumDeclaration } from 'typescript'; import { type Comments, diff --git a/packages/openapi-ts/src/openApi/common/parser/getRef.ts b/packages/openapi-ts/src/openApi/common/parser/getRef.ts index 8e1bad995..e2b089b04 100644 --- a/packages/openapi-ts/src/openApi/common/parser/getRef.ts +++ b/packages/openapi-ts/src/openApi/common/parser/getRef.ts @@ -1,6 +1,6 @@ import type { OpenApiReference as OpenApiReferenceV2 } from '../../v2/interfaces/OpenApiReference'; import type { OpenApiReference as OpenApiReferenceV3 } from '../../v3/interfaces/OpenApiReference'; -import { OpenApi } from '../interfaces/OpenApi'; +import type { OpenApi } from '../interfaces/OpenApi'; const ESCAPED_REF_SLASH = /~1/g; const ESCAPED_REF_TILDE = /~0/g; diff --git a/packages/openapi-ts/src/plugins/@tanstack/query-core/plugin.ts b/packages/openapi-ts/src/plugins/@tanstack/query-core/plugin.ts index 4231987a1..112680f5f 100644 --- a/packages/openapi-ts/src/plugins/@tanstack/query-core/plugin.ts +++ b/packages/openapi-ts/src/plugins/@tanstack/query-core/plugin.ts @@ -2,7 +2,7 @@ import ts from 'typescript'; import { compiler, type Property } from '../../../compiler'; import type { ImportExportItem } from '../../../compiler/module'; -import { ImportExportItemObject } from '../../../compiler/utils'; +import type { ImportExportItemObject } from '../../../compiler/utils'; import { clientModulePath, clientOptionsTypeName, diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle/core/index.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle/core/index.ts.snap index 8ff7d218d..afe16e6a1 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle/core/index.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle/core/index.ts.snap @@ -1,4 +1,5 @@ -import axios, { AxiosError } from 'axios'; +import type { AxiosError } from 'axios'; +import axios from 'axios'; import type { Client, Config, RequestOptions } from './types'; import { createConfig, getUrl, mergeConfigs, mergeHeaders } from './utils'; diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle_transform/core/index.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle_transform/core/index.ts.snap index 8ff7d218d..afe16e6a1 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle_transform/core/index.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle_transform/core/index.ts.snap @@ -1,4 +1,5 @@ -import axios, { AxiosError } from 'axios'; +import type { AxiosError } from 'axios'; +import axios from 'axios'; import type { Client, Config, RequestOptions } from './types'; import { createConfig, getUrl, mergeConfigs, mergeHeaders } from './utils'; diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle/core/index.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle/core/index.ts.snap index f1be83f2e..ab5cd4a1f 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle/core/index.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle/core/index.ts.snap @@ -142,5 +142,5 @@ export const createClient = (config: Config = {}): Client => { request, setConfig, trace: (options) => request({ ...options, method: 'TRACE' }), - } as Client; + }; }; diff --git a/packages/openapi-ts/test/e2e/scripts/browser.ts b/packages/openapi-ts/test/e2e/scripts/browser.ts index 70d5adad6..cf5a03067 100644 --- a/packages/openapi-ts/test/e2e/scripts/browser.ts +++ b/packages/openapi-ts/test/e2e/scripts/browser.ts @@ -1,4 +1,5 @@ -import puppeteer, { Browser, EvaluateFunc, Page } from 'puppeteer' +import type { Browser, EvaluateFunc, Page } from 'puppeteer'; +import puppeteer from 'puppeteer' let _browser: Browser let _page: Page diff --git a/packages/openapi-ts/test/e2e/scripts/server.ts b/packages/openapi-ts/test/e2e/scripts/server.ts index 261630fe8..da1c5517e 100644 --- a/packages/openapi-ts/test/e2e/scripts/server.ts +++ b/packages/openapi-ts/test/e2e/scripts/server.ts @@ -1,7 +1,8 @@ -import { Server } from 'node:http' +import type { Server } from 'node:http' import path from 'node:path' -import express, { Express } from 'express' +import type { Express } from 'express'; +import express from 'express' let _app: Express let _server: Server -- 2.51.2 From e72d2980c125bfa561209f0a4b8bdbe091d762e1 Mon Sep 17 00:00:00 2001 From: RndUsername <39034509+RndUsername@users.noreply.github.com> Date: Sun, 15 Sep 2024 20:58:22 +0200 Subject: [PATCH 09/49] Update fetch.md --- docs/openapi-ts/clients/fetch.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/openapi-ts/clients/fetch.md b/docs/openapi-ts/clients/fetch.md index d6a3aacf1..24b01d20c 100644 --- a/docs/openapi-ts/clients/fetch.md +++ b/docs/openapi-ts/clients/fetch.md @@ -79,7 +79,7 @@ const client = createClient({ ## Interceptors -Interceptors (middleware) can be used to modify requests before they're sent or responses before they're returned to the rest of your application. Fetch API does not have the interceptor functionality, so we implement our own. Below is an example request interceptor +Interceptors (middleware) can be used to modify requests before they're sent or responses before they're returned to the rest of your application. They can be added with `use` or removed with `eject`. Fetch API does not have the interceptor functionality, so we implement our own. Below is an example request interceptor ::: code-group -- 2.51.2 From a3135e7f4108da19de311676c8adec849217a424 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 16 Sep 2024 03:46:34 +0000 Subject: [PATCH 10/49] chore(deps): bump the prod-deps group with 7 updates Bumps the prod-deps group with 7 updates: | Package | From | To | | --- | --- | --- | | [@tanstack/react-query](https://github.com/TanStack/query/tree/HEAD/packages/react-query) | `5.55.2` | `5.56.2` | | [@tanstack/react-query-devtools](https://github.com/TanStack/query/tree/HEAD/packages/react-query-devtools) | `5.55.2` | `5.56.2` | | [@tanstack/svelte-query](https://github.com/TanStack/query/tree/HEAD/packages/svelte-query) | `5.55.2` | `5.56.2` | | [@tanstack/vue-query](https://github.com/TanStack/query/tree/HEAD/packages/vue-query) | `5.55.2` | `5.56.2` | | [@tanstack/vue-query-devtools](https://github.com/TanStack/query/tree/HEAD/packages/vue-query-devtools) | `5.55.2` | `5.56.2` | | [vue](https://github.com/vuejs/core) | `3.5.3` | `3.5.5` | | [vue-router](https://github.com/vuejs/router) | `4.4.3` | `4.4.5` | Updates `@tanstack/react-query` from 5.55.2 to 5.56.2 - [Release notes](https://github.com/TanStack/query/releases) - [Commits](https://github.com/TanStack/query/commits/v5.56.2/packages/react-query) Updates `@tanstack/react-query-devtools` from 5.55.2 to 5.56.2 - [Release notes](https://github.com/TanStack/query/releases) - [Commits](https://github.com/TanStack/query/commits/v5.56.2/packages/react-query-devtools) Updates `@tanstack/svelte-query` from 5.55.2 to 5.56.2 - [Release notes](https://github.com/TanStack/query/releases) - [Commits](https://github.com/TanStack/query/commits/v5.56.2/packages/svelte-query) Updates `@tanstack/vue-query` from 5.55.2 to 5.56.2 - [Release notes](https://github.com/TanStack/query/releases) - [Commits](https://github.com/TanStack/query/commits/v5.56.2/packages/vue-query) Updates `@tanstack/vue-query-devtools` from 5.55.2 to 5.56.2 - [Release notes](https://github.com/TanStack/query/releases) - [Commits](https://github.com/TanStack/query/commits/v5.56.2/packages/vue-query-devtools) Updates `vue` from 3.5.3 to 3.5.5 - [Release notes](https://github.com/vuejs/core/releases) - [Changelog](https://github.com/vuejs/core/blob/main/CHANGELOG.md) - [Commits](https://github.com/vuejs/core/compare/v3.5.3...v3.5.5) Updates `vue-router` from 4.4.3 to 4.4.5 - [Release notes](https://github.com/vuejs/router/releases) - [Commits](https://github.com/vuejs/router/compare/v4.4.3...v4.4.5) --- updated-dependencies: - dependency-name: "@tanstack/react-query" dependency-type: direct:production update-type: version-update:semver-minor dependency-group: prod-deps - dependency-name: "@tanstack/react-query-devtools" dependency-type: direct:production update-type: version-update:semver-minor dependency-group: prod-deps - dependency-name: "@tanstack/svelte-query" dependency-type: direct:production update-type: version-update:semver-minor dependency-group: prod-deps - dependency-name: "@tanstack/vue-query" dependency-type: direct:production update-type: version-update:semver-minor dependency-group: prod-deps - dependency-name: "@tanstack/vue-query-devtools" dependency-type: direct:production update-type: version-update:semver-minor dependency-group: prod-deps - dependency-name: vue dependency-type: direct:production update-type: version-update:semver-patch dependency-group: prod-deps - dependency-name: vue-router dependency-type: direct:production update-type: version-update:semver-patch dependency-group: prod-deps ... Signed-off-by: dependabot[bot] --- .../package.json | 4 +- .../package.json | 2 +- .../package.json | 8 +- packages/openapi-ts/package.json | 6 +- pnpm-lock.yaml | 351 +++++++++--------- 5 files changed, 188 insertions(+), 183 deletions(-) diff --git a/examples/openapi-ts-tanstack-react-query/package.json b/examples/openapi-ts-tanstack-react-query/package.json index 6e2638cc0..8b7218428 100644 --- a/examples/openapi-ts-tanstack-react-query/package.json +++ b/examples/openapi-ts-tanstack-react-query/package.json @@ -16,8 +16,8 @@ "@radix-ui/react-form": "0.1.0", "@radix-ui/react-icons": "1.3.0", "@radix-ui/themes": "3.1.3", - "@tanstack/react-query": "5.55.2", - "@tanstack/react-query-devtools": "5.55.2", + "@tanstack/react-query": "5.56.2", + "@tanstack/react-query-devtools": "5.56.2", "react": "18.3.1", "react-dom": "18.3.1" }, diff --git a/examples/openapi-ts-tanstack-svelte-query/package.json b/examples/openapi-ts-tanstack-svelte-query/package.json index f2879198d..ae9aac44b 100644 --- a/examples/openapi-ts-tanstack-svelte-query/package.json +++ b/examples/openapi-ts-tanstack-svelte-query/package.json @@ -17,7 +17,7 @@ }, "dependencies": { "@hey-api/client-fetch": "workspace:*", - "@tanstack/svelte-query": "5.55.2" + "@tanstack/svelte-query": "5.56.2" }, "devDependencies": { "@fontsource/fira-mono": "5.0.0", diff --git a/examples/openapi-ts-tanstack-vue-query/package.json b/examples/openapi-ts-tanstack-vue-query/package.json index d3ea3e243..6d2493167 100644 --- a/examples/openapi-ts-tanstack-vue-query/package.json +++ b/examples/openapi-ts-tanstack-vue-query/package.json @@ -17,11 +17,11 @@ }, "dependencies": { "@hey-api/client-fetch": "workspace:*", - "@tanstack/vue-query": "5.55.2", - "@tanstack/vue-query-devtools": "5.55.2", + "@tanstack/vue-query": "5.56.2", + "@tanstack/vue-query-devtools": "5.56.2", "pinia": "2.2.2", - "vue": "3.5.3", - "vue-router": "4.4.3" + "vue": "3.5.5", + "vue-router": "4.4.5" }, "devDependencies": { "@hey-api/openapi-ts": "workspace:*", diff --git a/packages/openapi-ts/package.json b/packages/openapi-ts/package.json index 63187f932..79a54fef2 100644 --- a/packages/openapi-ts/package.json +++ b/packages/openapi-ts/package.json @@ -85,10 +85,10 @@ "@hey-api/client-fetch": "workspace:*", "@rollup/plugin-json": "6.1.0", "@rollup/plugin-node-resolve": "15.2.3", - "@tanstack/react-query": "5.55.2", + "@tanstack/react-query": "5.56.2", "@tanstack/solid-query": "5.51.21", - "@tanstack/svelte-query": "5.55.2", - "@tanstack/vue-query": "5.55.2", + "@tanstack/svelte-query": "5.56.2", + "@tanstack/vue-query": "5.56.2", "@types/cross-spawn": "6.0.6", "@types/express": "4.17.21", "axios": "1.7.7", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 04d4c822b..1f39333ac 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -243,11 +243,11 @@ importers: specifier: 3.1.3 version: 3.1.3(@types/react-dom@18.3.0)(@types/react@18.3.3)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) '@tanstack/react-query': - specifier: 5.55.2 - version: 5.55.2(react@18.3.1) + specifier: 5.56.2 + version: 5.56.2(react@18.3.1) '@tanstack/react-query-devtools': - specifier: 5.55.2 - version: 5.55.2(@tanstack/react-query@5.55.2(react@18.3.1))(react@18.3.1) + specifier: 5.56.2 + version: 5.56.2(@tanstack/react-query@5.56.2(react@18.3.1))(react@18.3.1) react: specifier: 18.3.1 version: 18.3.1 @@ -307,8 +307,8 @@ importers: specifier: workspace:* version: link:../../packages/client-fetch '@tanstack/svelte-query': - specifier: 5.55.2 - version: 5.55.2(svelte@4.2.7) + specifier: 5.56.2 + version: 5.56.2(svelte@4.2.7) devDependencies: '@fontsource/fira-mono': specifier: 5.0.0 @@ -374,20 +374,20 @@ importers: specifier: workspace:* version: link:../../packages/client-fetch '@tanstack/vue-query': - specifier: 5.55.2 - version: 5.55.2(vue@3.5.3(typescript@5.5.3)) + specifier: 5.56.2 + version: 5.56.2(vue@3.5.5(typescript@5.5.3)) '@tanstack/vue-query-devtools': - specifier: 5.55.2 - version: 5.55.2(@tanstack/vue-query@5.55.2(vue@3.5.3(typescript@5.5.3)))(vue@3.5.3(typescript@5.5.3)) + specifier: 5.56.2 + version: 5.56.2(@tanstack/vue-query@5.56.2(vue@3.5.5(typescript@5.5.3)))(vue@3.5.5(typescript@5.5.3)) pinia: specifier: 2.2.2 - version: 2.2.2(typescript@5.5.3)(vue@3.5.3(typescript@5.5.3)) + version: 2.2.2(typescript@5.5.3)(vue@3.5.5(typescript@5.5.3)) vue: - specifier: 3.5.3 - version: 3.5.3(typescript@5.5.3) + specifier: 3.5.5 + version: 3.5.5(typescript@5.5.3) vue-router: - specifier: 4.4.3 - version: 4.4.3(vue@3.5.3(typescript@5.5.3)) + specifier: 4.4.5 + version: 4.4.5(vue@3.5.5(typescript@5.5.3)) devDependencies: '@hey-api/openapi-ts': specifier: workspace:* @@ -406,10 +406,10 @@ importers: version: 20.14.5 '@vitejs/plugin-vue': specifier: 5.0.5 - version: 5.0.5(vite@5.3.3(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1))(vue@3.5.3(typescript@5.5.3)) + version: 5.0.5(vite@5.3.3(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1))(vue@3.5.5(typescript@5.5.3)) '@vitejs/plugin-vue-jsx': specifier: 4.0.0 - version: 4.0.0(vite@5.3.3(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1))(vue@3.5.3(typescript@5.5.3)) + version: 4.0.0(vite@5.3.3(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1))(vue@3.5.5(typescript@5.5.3)) '@vue/eslint-config-prettier': specifier: 9.0.0 version: 9.0.0(@types/eslint@9.6.0)(eslint@9.6.0)(prettier@3.3.2) @@ -454,7 +454,7 @@ importers: version: 5.3.3(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1) vite-plugin-vue-devtools: specifier: 7.3.1 - version: 7.3.1(rollup@4.18.0)(vite@5.3.3(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1))(vue@3.5.3(typescript@5.5.3)) + version: 7.3.1(rollup@4.18.0)(vite@5.3.3(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1))(vue@3.5.5(typescript@5.5.3)) vitest: specifier: 1.6.0 version: 1.6.0(@types/node@20.14.5)(jsdom@24.1.0)(less@4.2.0)(sass@1.71.1)(terser@5.31.1) @@ -533,17 +533,17 @@ importers: specifier: 15.2.3 version: 15.2.3(rollup@4.18.0) '@tanstack/react-query': - specifier: 5.55.2 - version: 5.55.2(react@18.3.1) + specifier: 5.56.2 + version: 5.56.2(react@18.3.1) '@tanstack/solid-query': specifier: 5.51.21 version: 5.51.21(solid-js@1.8.20) '@tanstack/svelte-query': - specifier: 5.55.2 - version: 5.55.2(svelte@4.2.7) + specifier: 5.56.2 + version: 5.56.2(svelte@4.2.7) '@tanstack/vue-query': - specifier: 5.55.2 - version: 5.55.2(vue@3.5.3(typescript@5.5.3)) + specifier: 5.56.2 + version: 5.56.2(vue@3.5.5(typescript@5.5.3)) '@types/cross-spawn': specifier: 6.0.6 version: 6.0.6 @@ -3018,20 +3018,20 @@ packages: '@tanstack/query-core@5.51.21': resolution: {integrity: sha512-POQxm42IUp6n89kKWF4IZi18v3fxQWFRolvBA6phNVmA8psdfB1MvDnGacCJdS+EOX12w/CyHM62z//rHmYmvw==} - '@tanstack/query-core@5.55.2': - resolution: {integrity: sha512-WfuUx06sw/V3R2tRRQf4KZj0g4Q5EHrTdwJmCUovMFuHWVzDvLd5U+B7d5Pk8ni5w5SGpUuzGuQv3nN8xo1QbQ==} + '@tanstack/query-core@5.56.2': + resolution: {integrity: sha512-gor0RI3/R5rVV3gXfddh1MM+hgl0Z4G7tj6Xxpq6p2I03NGPaJ8dITY9Gz05zYYb/EJq9vPas/T4wn9EaDPd4Q==} - '@tanstack/query-devtools@5.55.1': - resolution: {integrity: sha512-2g0TWQGlkyHs9maHIU5A7lRunG4Rj3Y5lOEenE+fydE4zk7GqRs7rKJBp7F74iqRo/cA9V6t1YYQWqd6YRBmcQ==} + '@tanstack/query-devtools@5.56.1': + resolution: {integrity: sha512-xnp9jq/9dHfSCDmmf+A5DjbIjYqbnnUL2ToqlaaviUQGRTapXQ8J+GxusYUu1IG0vZMaWdiVUA4HRGGZYAUU+A==} - '@tanstack/react-query-devtools@5.55.2': - resolution: {integrity: sha512-QkL5Saai7MqEEkGNjhtNB0F1iD4DjpKnvrBM3510L54N8/+4tBPXjMB5a2+ADTYgOrtm4Gn8sJQs/qWKmdpqIg==} + '@tanstack/react-query-devtools@5.56.2': + resolution: {integrity: sha512-7nINJtRZZVwhTTyDdMIcSaXo+EHMLYJu1S2e6FskvvD5prx87LlAXXWZDfU24Qm4HjshEtM5lS3HIOszNGblcw==} peerDependencies: - '@tanstack/react-query': ^5.55.2 + '@tanstack/react-query': ^5.56.2 react: ^18 || ^19 - '@tanstack/react-query@5.55.2': - resolution: {integrity: sha512-PkbEmO64nphWPhufkE9aJ+iEScg8tNNCykYlH7vDwb2R6G8uJC+HTJgXc2n8cRaJe6ETVIeQLFFESVd+2N/tww==} + '@tanstack/react-query@5.56.2': + resolution: {integrity: sha512-SR0GzHVo6yzhN72pnRhkEFRAHMsUo5ZPzAxfTMvUxFIDVS6W9LYUp6nXW3fcHVdg0ZJl8opSH85jqahvm6DSVg==} peerDependencies: react: ^18 || ^19 @@ -3040,19 +3040,19 @@ packages: peerDependencies: solid-js: ^1.6.0 - '@tanstack/svelte-query@5.55.2': - resolution: {integrity: sha512-L4L8Ip83Ezi6XWsuDBKCo9Fv8BwAFkOBYl3xwcwUSnleDrfUsERDc/Rok6fTCxIuRXc0rpaq9jCYS822LIL9+w==} + '@tanstack/svelte-query@5.56.2': + resolution: {integrity: sha512-3oPvqr9y+WAryqWLgp2Vam/vZAJ1uS7nIxZd4SJeS5A3XolKC/8L2eDmLTSPFmRwu1W95uweWe907e1eoAJZiQ==} peerDependencies: svelte: ^3.54.0 || ^4.0.0 || ^5.0.0-next.0 - '@tanstack/vue-query-devtools@5.55.2': - resolution: {integrity: sha512-99mTo+FxSdy0pukcqaSwheyVi8ZEkQ0PePWR/S2OpBDp9fvfTpL9y2Qm6FMagalnLzlKXECzrwjzLI2F2qkwPQ==} + '@tanstack/vue-query-devtools@5.56.2': + resolution: {integrity: sha512-XyMZTMsrAGlPfU5Fa9OQwMbdIhrq1rbpGgW5VxQ8Rxckwjd2VS7wMxZJUgWanPbYqRy/x9iA1hnwo8MDJnNuDQ==} peerDependencies: - '@tanstack/vue-query': ^5.55.2 + '@tanstack/vue-query': ^5.56.2 vue: ^3.3.0 - '@tanstack/vue-query@5.55.2': - resolution: {integrity: sha512-DTxDW9usLRJ4qX3btHYRNdxnIBCjf5QCADD1ZZOyH3/dNocyfQxMSTlPTzkmPxHjFQgiVrudcjgfnD/QPGp8eQ==} + '@tanstack/vue-query@5.56.2': + resolution: {integrity: sha512-VW7qS8JXwC3SZpawJHxQ+mWwWa5WVIQUUOh/OD6WI85eLcbJPg83ezjGupPXGKF9h31gl7CIRrnJDi4g5pK3Jg==} peerDependencies: '@vue/composition-api': ^1.1.2 vue: ^2.6.0 || ^3.3.0 @@ -3458,36 +3458,39 @@ packages: peerDependencies: '@babel/core': ^7.0.0-0 - '@vue/compiler-core@3.4.38': - resolution: {integrity: sha512-8IQOTCWnLFqfHzOGm9+P8OPSEDukgg3Huc92qSG49if/xI2SAwLHQO2qaPQbjCWPBcQoO1WYfXfTACUrWV3c5A==} - '@vue/compiler-core@3.5.3': resolution: {integrity: sha512-adAfy9boPkP233NTyvLbGEqVuIfK/R0ZsBsIOW4BZNfb4BRpRW41Do1u+ozJpsb+mdoy80O20IzAsHaihRb5qA==} - '@vue/compiler-dom@3.4.38': - resolution: {integrity: sha512-Osc/c7ABsHXTsETLgykcOwIxFktHfGSUDkb05V61rocEfsFDcjDLH/IHJSNJP+/Sv9KeN2Lx1V6McZzlSb9EhQ==} + '@vue/compiler-core@3.5.5': + resolution: {integrity: sha512-ZrxcY8JMoV+kgDrmRwlDufz0SjDZ7jfoNZiIBluAACMBmgr55o/jTbxnyrccH6VSJXnFaDI4Ik1UFCiq9r8i7w==} '@vue/compiler-dom@3.5.3': resolution: {integrity: sha512-wnzFArg9zpvk/811CDOZOadJRugf1Bgl/TQ3RfV4nKfSPok4hi0w10ziYUQR6LnnBAUlEXYLUfZ71Oj9ds/+QA==} - '@vue/compiler-sfc@3.4.38': - resolution: {integrity: sha512-s5QfZ+9PzPh3T5H4hsQDJtI8x7zdJaew/dCGgqZ2630XdzaZ3AD8xGZfBqpT8oaD/p2eedd+pL8tD5vvt5ZYJQ==} + '@vue/compiler-dom@3.5.5': + resolution: {integrity: sha512-HSvK5q1gmBbxRse3S0Wt34RcKuOyjDJKDDMuF3i7NC+QkDFrbAqw8NnrEm/z7zFDxWZa4/5eUwsBOMQzm1RHBA==} '@vue/compiler-sfc@3.5.3': resolution: {integrity: sha512-P3uATLny2tfyvMB04OQFe7Sczteno7SLFxwrOA/dw01pBWQHB5HL15a8PosoNX2aG/EAMGqnXTu+1LnmzFhpTQ==} - '@vue/compiler-ssr@3.4.38': - resolution: {integrity: sha512-YXznKFQ8dxYpAz9zLuVvfcXhc31FSPFDcqr0kyujbOwNhlmaNvL2QfIy+RZeJgSn5Fk54CWoEUeW+NVBAogGaw==} + '@vue/compiler-sfc@3.5.5': + resolution: {integrity: sha512-MzBHDxwZhgQPHrwJ5tj92gdTYRCuPDSZr8PY3+JFv8cv2UD5/WayH5yo0kKCkKfrtJhc39jNSMityHrkMSbfnA==} '@vue/compiler-ssr@3.5.3': resolution: {integrity: sha512-F/5f+r2WzL/2YAPl7UlKcJWHrvoZN8XwEBLnT7S4BXwncH25iDOabhO2M2DWioyTguJAGavDOawejkFXj8EM1w==} + '@vue/compiler-ssr@3.5.5': + resolution: {integrity: sha512-oFasHnpv/upubjJEmqiTKQYb4qS3ziJddf4UVWuFw6ebk/QTrTUc+AUoTJdo39x9g+AOQBzhOU0ICCRuUjvkmw==} + '@vue/compiler-vue2@2.7.16': resolution: {integrity: sha512-qYC3Psj9S/mfu9uVi5WvNZIzq+xnXMhOwbTFKKDD7b1lhpnn71jXSFdTQ+WsIEk0ONCd7VV2IMm7ONl6tbQ86A==} '@vue/devtools-api@6.6.3': resolution: {integrity: sha512-0MiMsFma/HqA6g3KLKn+AGpL1kgKhFWszC9U29NfpWK5LE7bjeXxySWJrOJ77hBz+TBrBQ7o4QJqbPbqbs8rJw==} + '@vue/devtools-api@6.6.4': + resolution: {integrity: sha512-sGhTPMuXqZ1rVOk32RylztWkfXTRhuS7vgAKv0zjqk8gbsHkJ7xfFf+jbySxt7tWObEJwyKaHMikV/WGDiQm8g==} + '@vue/devtools-api@7.3.5': resolution: {integrity: sha512-BSdBBu5hOIv+gBJC9jzYMh5bC27FQwjWLSb8fVAniqlL9gvsqvK27xTgczMf+hgctlszMYQnRm3bpY/j8vhPqw==} @@ -3530,43 +3533,43 @@ packages: typescript: optional: true - '@vue/reactivity@3.4.38': - resolution: {integrity: sha512-4vl4wMMVniLsSYYeldAKzbk72+D3hUnkw9z8lDeJacTxAkXeDAP1uE9xr2+aKIN0ipOL8EG2GPouVTH6yF7Gnw==} - '@vue/reactivity@3.5.3': resolution: {integrity: sha512-2w61UnRWTP7+rj1H/j6FH706gRBHdFVpIqEkSDAyIpafBXYH8xt4gttstbbCWdU3OlcSWO8/3mbKl/93/HSMpw==} - '@vue/runtime-core@3.4.38': - resolution: {integrity: sha512-21z3wA99EABtuf+O3IhdxP0iHgkBs1vuoCAsCKLVJPEjpVqvblwBnTj42vzHRlWDCyxu9ptDm7sI2ZMcWrQqlA==} + '@vue/reactivity@3.5.5': + resolution: {integrity: sha512-V4tTWElZQhT73PSK3Wnax9R9m4qvMX+LeKHnfylZc6SLh4Jc5/BPakp6e3zEhKWi5AN8TDzRkGnLkp8OqycYng==} '@vue/runtime-core@3.5.3': resolution: {integrity: sha512-5b2AQw5OZlmCzSsSBWYoZOsy75N4UdMWenTfDdI5bAzXnuVR7iR8Q4AOzQm2OGoA41xjk53VQKrqQhOz2ktWaw==} - '@vue/runtime-dom@3.4.38': - resolution: {integrity: sha512-afZzmUreU7vKwKsV17H1NDThEEmdYI+GCAK/KY1U957Ig2NATPVjCROv61R19fjZNzMmiU03n79OMnXyJVN0UA==} + '@vue/runtime-core@3.5.5': + resolution: {integrity: sha512-2/CFaRN17jgsXy4MpigWFBCAMmLkXPb4CjaHrndglwYSra7ajvkH2cat21dscuXaH91G8fXAeg5gCyxWJ+wCRA==} '@vue/runtime-dom@3.5.3': resolution: {integrity: sha512-wPR1DEGc3XnQ7yHbmkTt3GoY0cEnVGQnARRdAkDzZ8MbUKEs26gogCQo6AOvvgahfjIcnvWJzkZArQ1fmWjcSg==} - '@vue/server-renderer@3.4.38': - resolution: {integrity: sha512-NggOTr82FbPEkkUvBm4fTGcwUY8UuTsnWC/L2YZBmvaQ4C4Jl/Ao4HHTB+l7WnFCt5M/dN3l0XLuyjzswGYVCA==} - peerDependencies: - vue: 3.4.38 + '@vue/runtime-dom@3.5.5': + resolution: {integrity: sha512-0bQGgCuL+4Muz5PsCLgF4Ata9BTdhHi5VjsxtTDyI0Wy4MgoSvBGaA6bDc7W7CGgZOyirf9LNeetMYHQ05pgpw==} '@vue/server-renderer@3.5.3': resolution: {integrity: sha512-28volmaZVG2PGO3V3+gBPKoSHvLlE8FGfG/GKXKkjjfxLuj/50B/0OQGakM/g6ehQeqCrZYM4eHC4Ks48eig1Q==} peerDependencies: vue: 3.5.3 + '@vue/server-renderer@3.5.5': + resolution: {integrity: sha512-XjRamLIq5f47cxgy+hiX7zUIY+4RHdPDVrPvvMDAUTdW5RJWX/S0ji/rCbm3LWTT/9Co9bvQME8ZI15ahL4/Qw==} + peerDependencies: + vue: 3.5.5 + '@vue/shared@3.4.31': resolution: {integrity: sha512-Yp3wtJk//8cO4NItOPpi3QkLExAr/aLBGZMmTtW9WpdwBCJpRM6zj9WgWktXAl8IDIozwNMByT45JP3tO3ACWA==} - '@vue/shared@3.4.38': - resolution: {integrity: sha512-q0xCiLkuWWQLzVrecPb0RMsNWyxICOjPrcrwxTUEHb1fsnvni4dcuyG7RT/Ie7VPTvnjzIaWzRMUBsrqNj/hhw==} - '@vue/shared@3.5.3': resolution: {integrity: sha512-Jp2v8nylKBT+PlOUjun2Wp/f++TfJVFjshLzNtJDdmFJabJa7noGMncqXRM1vXGX+Yo2V7WykQFNxusSim8SCA==} + '@vue/shared@3.5.5': + resolution: {integrity: sha512-0KyMXyEgnmFAs6rNUL+6eUHtUCqCaNrVd+AW3MX3LyA0Yry5SA0Km03CDKiOua1x1WWnIr+W9+S0GMFoSDWERQ==} + '@vue/test-utils@2.4.6': resolution: {integrity: sha512-FMxEjOpYNYiFe0GkaHsnJPXFHxQ6m4t8vI/ElPGpMWxZKpmRvQ33OIrvRXemy6yha03RxhOlQuy+gZMC3CQSow==} @@ -7732,8 +7735,8 @@ packages: peerDependencies: eslint: '>=6.0.0' - vue-router@4.4.3: - resolution: {integrity: sha512-sv6wmNKx2j3aqJQDMxLFzs/u/mjA9Z5LCgy6BE0f7yFWMjrPLnS/sPNn8ARY/FXw6byV18EFutn5lTO6+UsV5A==} + vue-router@4.4.5: + resolution: {integrity: sha512-4fKZygS8cH1yCyuabAXGUAsyi1b2/o/OKgu/RUb+znIYOxPRxdkytJEx+0wGcpBE1pX6vUgh5jwWOKRGvuA/7Q==} peerDependencies: vue: ^3.2.0 @@ -7743,16 +7746,16 @@ packages: peerDependencies: typescript: '>=5.0.0' - vue@3.4.38: - resolution: {integrity: sha512-f0ZgN+mZ5KFgVv9wz0f4OgVKukoXtS3nwET4c2vLBGQR50aI8G0cqbFtLlX9Yiyg3LFGBitruPHt2PxwTduJEw==} + vue@3.5.3: + resolution: {integrity: sha512-xvRbd0HpuLovYbOHXRHlSBsSvmUJbo0pzbkKTApWnQGf3/cu5Z39mQeA5cZdLRVIoNf3zI6MSoOgHUT5i2jO+Q==} peerDependencies: typescript: '*' peerDependenciesMeta: typescript: optional: true - vue@3.5.3: - resolution: {integrity: sha512-xvRbd0HpuLovYbOHXRHlSBsSvmUJbo0pzbkKTApWnQGf3/cu5Z39mQeA5cZdLRVIoNf3zI6MSoOgHUT5i2jO+Q==} + vue@3.5.5: + resolution: {integrity: sha512-ybC+xn67K4+df1yVeov4UjBGyVcXM0a1g7JVZr+pWVUX3xF6ntXU0wIjkTkduZBUIpxTlsftJSxz2kwhsT7dgA==} peerDependencies: typescript: '*' peerDependenciesMeta: @@ -10850,19 +10853,19 @@ snapshots: '@tanstack/query-core@5.51.21': {} - '@tanstack/query-core@5.55.2': {} + '@tanstack/query-core@5.56.2': {} - '@tanstack/query-devtools@5.55.1': {} + '@tanstack/query-devtools@5.56.1': {} - '@tanstack/react-query-devtools@5.55.2(@tanstack/react-query@5.55.2(react@18.3.1))(react@18.3.1)': + '@tanstack/react-query-devtools@5.56.2(@tanstack/react-query@5.56.2(react@18.3.1))(react@18.3.1)': dependencies: - '@tanstack/query-devtools': 5.55.1 - '@tanstack/react-query': 5.55.2(react@18.3.1) + '@tanstack/query-devtools': 5.56.1 + '@tanstack/react-query': 5.56.2(react@18.3.1) react: 18.3.1 - '@tanstack/react-query@5.55.2(react@18.3.1)': + '@tanstack/react-query@5.56.2(react@18.3.1)': dependencies: - '@tanstack/query-core': 5.55.2 + '@tanstack/query-core': 5.56.2 react: 18.3.1 '@tanstack/solid-query@5.51.21(solid-js@1.8.20)': @@ -10870,24 +10873,24 @@ snapshots: '@tanstack/query-core': 5.51.21 solid-js: 1.8.20 - '@tanstack/svelte-query@5.55.2(svelte@4.2.7)': + '@tanstack/svelte-query@5.56.2(svelte@4.2.7)': dependencies: - '@tanstack/query-core': 5.55.2 + '@tanstack/query-core': 5.56.2 svelte: 4.2.7 - '@tanstack/vue-query-devtools@5.55.2(@tanstack/vue-query@5.55.2(vue@3.5.3(typescript@5.5.3)))(vue@3.5.3(typescript@5.5.3))': + '@tanstack/vue-query-devtools@5.56.2(@tanstack/vue-query@5.56.2(vue@3.5.5(typescript@5.5.3)))(vue@3.5.5(typescript@5.5.3))': dependencies: - '@tanstack/query-devtools': 5.55.1 - '@tanstack/vue-query': 5.55.2(vue@3.5.3(typescript@5.5.3)) - vue: 3.5.3(typescript@5.5.3) + '@tanstack/query-devtools': 5.56.1 + '@tanstack/vue-query': 5.56.2(vue@3.5.5(typescript@5.5.3)) + vue: 3.5.5(typescript@5.5.3) - '@tanstack/vue-query@5.55.2(vue@3.5.3(typescript@5.5.3))': + '@tanstack/vue-query@5.56.2(vue@3.5.5(typescript@5.5.3))': dependencies: '@tanstack/match-sorter-utils': 8.19.4 - '@tanstack/query-core': 5.55.2 + '@tanstack/query-core': 5.56.2 '@vue/devtools-api': 6.6.3 - vue: 3.5.3(typescript@5.5.3) - vue-demi: 0.14.10(vue@3.5.3(typescript@5.5.3)) + vue: 3.5.5(typescript@5.5.3) + vue-demi: 0.14.10(vue@3.5.5(typescript@5.5.3)) '@tootallnate/quickjs-emscripten@0.23.0': {} @@ -11305,25 +11308,25 @@ snapshots: transitivePeerDependencies: - supports-color - '@vitejs/plugin-vue-jsx@4.0.0(vite@5.3.3(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1))(vue@3.5.3(typescript@5.5.3))': + '@vitejs/plugin-vue-jsx@4.0.0(vite@5.3.3(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1))(vue@3.5.5(typescript@5.5.3))': dependencies: '@babel/core': 7.24.7 '@babel/plugin-transform-typescript': 7.25.2(@babel/core@7.24.7) '@vue/babel-plugin-jsx': 1.2.2(@babel/core@7.24.7) vite: 5.3.3(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1) - vue: 3.5.3(typescript@5.5.3) + vue: 3.5.5(typescript@5.5.3) transitivePeerDependencies: - supports-color - '@vitejs/plugin-vue@5.0.5(vite@5.3.3(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1))(vue@3.4.38(typescript@5.5.3))': + '@vitejs/plugin-vue@5.0.5(vite@5.3.3(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1))(vue@3.5.3(typescript@5.5.3))': dependencies: vite: 5.3.3(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1) - vue: 3.4.38(typescript@5.5.3) + vue: 3.5.3(typescript@5.5.3) - '@vitejs/plugin-vue@5.0.5(vite@5.3.3(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1))(vue@3.5.3(typescript@5.5.3))': + '@vitejs/plugin-vue@5.0.5(vite@5.3.3(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1))(vue@3.5.5(typescript@5.5.3))': dependencies: vite: 5.3.3(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1) - vue: 3.5.3(typescript@5.5.3) + vue: 3.5.5(typescript@5.5.3) '@vitest/coverage-v8@1.6.0(vitest@1.6.0(@types/node@20.14.10)(jsdom@24.1.0)(less@4.2.0)(sass@1.71.1)(terser@5.31.1))': dependencies: @@ -11440,45 +11443,33 @@ snapshots: '@babel/helper-module-imports': 7.22.15 '@babel/helper-plugin-utils': 7.24.8 '@babel/parser': 7.25.3 - '@vue/compiler-sfc': 3.5.3 + '@vue/compiler-sfc': 3.5.5 - '@vue/compiler-core@3.4.38': + '@vue/compiler-core@3.5.3': dependencies: '@babel/parser': 7.25.3 - '@vue/shared': 3.4.38 + '@vue/shared': 3.5.3 entities: 4.5.0 estree-walker: 2.0.2 source-map-js: 1.2.0 - '@vue/compiler-core@3.5.3': + '@vue/compiler-core@3.5.5': dependencies: '@babel/parser': 7.25.3 - '@vue/shared': 3.5.3 + '@vue/shared': 3.5.5 entities: 4.5.0 estree-walker: 2.0.2 source-map-js: 1.2.0 - '@vue/compiler-dom@3.4.38': - dependencies: - '@vue/compiler-core': 3.4.38 - '@vue/shared': 3.4.38 - '@vue/compiler-dom@3.5.3': dependencies: '@vue/compiler-core': 3.5.3 '@vue/shared': 3.5.3 - '@vue/compiler-sfc@3.4.38': + '@vue/compiler-dom@3.5.5': dependencies: - '@babel/parser': 7.25.3 - '@vue/compiler-core': 3.4.38 - '@vue/compiler-dom': 3.4.38 - '@vue/compiler-ssr': 3.4.38 - '@vue/shared': 3.4.38 - estree-walker: 2.0.2 - magic-string: 0.30.10 - postcss: 8.4.41 - source-map-js: 1.2.0 + '@vue/compiler-core': 3.5.5 + '@vue/shared': 3.5.5 '@vue/compiler-sfc@3.5.3': dependencies: @@ -11492,16 +11483,28 @@ snapshots: postcss: 8.4.45 source-map-js: 1.2.0 - '@vue/compiler-ssr@3.4.38': + '@vue/compiler-sfc@3.5.5': dependencies: - '@vue/compiler-dom': 3.4.38 - '@vue/shared': 3.4.38 + '@babel/parser': 7.25.3 + '@vue/compiler-core': 3.5.5 + '@vue/compiler-dom': 3.5.5 + '@vue/compiler-ssr': 3.5.5 + '@vue/shared': 3.5.5 + estree-walker: 2.0.2 + magic-string: 0.30.11 + postcss: 8.4.45 + source-map-js: 1.2.0 '@vue/compiler-ssr@3.5.3': dependencies: '@vue/compiler-dom': 3.5.3 '@vue/shared': 3.5.3 + '@vue/compiler-ssr@3.5.5': + dependencies: + '@vue/compiler-dom': 3.5.5 + '@vue/shared': 3.5.5 + '@vue/compiler-vue2@2.7.16': dependencies: de-indent: 1.0.2 @@ -11509,11 +11512,13 @@ snapshots: '@vue/devtools-api@6.6.3': {} + '@vue/devtools-api@6.6.4': {} + '@vue/devtools-api@7.3.5': dependencies: '@vue/devtools-kit': 7.3.5 - '@vue/devtools-core@7.3.7(vite@5.3.3(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1))(vue@3.5.3(typescript@5.5.3))': + '@vue/devtools-core@7.3.7(vite@5.3.3(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1))(vue@3.5.5(typescript@5.5.3))': dependencies: '@vue/devtools-kit': 7.3.7 '@vue/devtools-shared': 7.3.7 @@ -11521,7 +11526,7 @@ snapshots: nanoid: 3.3.7 pathe: 1.1.2 vite-hot-client: 0.2.3(vite@5.3.3(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1)) - vue: 3.5.3(typescript@5.5.3) + vue: 3.5.5(typescript@5.5.3) transitivePeerDependencies: - vite @@ -11573,9 +11578,9 @@ snapshots: '@vue/language-core@2.0.29(typescript@5.5.3)': dependencies: '@volar/language-core': 2.4.0-alpha.18 - '@vue/compiler-dom': 3.4.38 + '@vue/compiler-dom': 3.5.3 '@vue/compiler-vue2': 2.7.16 - '@vue/shared': 3.4.38 + '@vue/shared': 3.5.3 computeds: 0.0.1 minimatch: 9.0.5 muggle-string: 0.4.1 @@ -11583,30 +11588,23 @@ snapshots: optionalDependencies: typescript: 5.5.3 - '@vue/reactivity@3.4.38': - dependencies: - '@vue/shared': 3.4.38 - '@vue/reactivity@3.5.3': dependencies: '@vue/shared': 3.5.3 - '@vue/runtime-core@3.4.38': + '@vue/reactivity@3.5.5': dependencies: - '@vue/reactivity': 3.4.38 - '@vue/shared': 3.4.38 + '@vue/shared': 3.5.5 '@vue/runtime-core@3.5.3': dependencies: '@vue/reactivity': 3.5.3 '@vue/shared': 3.5.3 - '@vue/runtime-dom@3.4.38': + '@vue/runtime-core@3.5.5': dependencies: - '@vue/reactivity': 3.4.38 - '@vue/runtime-core': 3.4.38 - '@vue/shared': 3.4.38 - csstype: 3.1.3 + '@vue/reactivity': 3.5.5 + '@vue/shared': 3.5.5 '@vue/runtime-dom@3.5.3': dependencies: @@ -11615,11 +11613,12 @@ snapshots: '@vue/shared': 3.5.3 csstype: 3.1.3 - '@vue/server-renderer@3.4.38(vue@3.4.38(typescript@5.5.3))': + '@vue/runtime-dom@3.5.5': dependencies: - '@vue/compiler-ssr': 3.4.38 - '@vue/shared': 3.4.38 - vue: 3.4.38(typescript@5.5.3) + '@vue/reactivity': 3.5.5 + '@vue/runtime-core': 3.5.5 + '@vue/shared': 3.5.5 + csstype: 3.1.3 '@vue/server-renderer@3.5.3(vue@3.5.3(typescript@5.5.3))': dependencies: @@ -11627,12 +11626,18 @@ snapshots: '@vue/shared': 3.5.3 vue: 3.5.3(typescript@5.5.3) - '@vue/shared@3.4.31': {} + '@vue/server-renderer@3.5.5(vue@3.5.5(typescript@5.5.3))': + dependencies: + '@vue/compiler-ssr': 3.5.5 + '@vue/shared': 3.5.5 + vue: 3.5.5(typescript@5.5.3) - '@vue/shared@3.4.38': {} + '@vue/shared@3.4.31': {} '@vue/shared@3.5.3': {} + '@vue/shared@3.5.5': {} + '@vue/test-utils@2.4.6': dependencies: js-beautify: 1.15.1 @@ -11640,21 +11645,21 @@ snapshots: '@vue/tsconfig@0.5.1': {} - '@vueuse/core@10.11.0(vue@3.4.38(typescript@5.5.3))': + '@vueuse/core@10.11.0(vue@3.5.3(typescript@5.5.3))': dependencies: '@types/web-bluetooth': 0.0.20 '@vueuse/metadata': 10.11.0 - '@vueuse/shared': 10.11.0(vue@3.4.38(typescript@5.5.3)) - vue-demi: 0.14.10(vue@3.4.38(typescript@5.5.3)) + '@vueuse/shared': 10.11.0(vue@3.5.3(typescript@5.5.3)) + vue-demi: 0.14.10(vue@3.5.3(typescript@5.5.3)) transitivePeerDependencies: - '@vue/composition-api' - vue - '@vueuse/integrations@10.11.0(axios@1.7.7)(focus-trap@7.5.4)(vue@3.4.38(typescript@5.5.3))': + '@vueuse/integrations@10.11.0(axios@1.7.7)(focus-trap@7.5.4)(vue@3.5.3(typescript@5.5.3))': dependencies: - '@vueuse/core': 10.11.0(vue@3.4.38(typescript@5.5.3)) - '@vueuse/shared': 10.11.0(vue@3.4.38(typescript@5.5.3)) - vue-demi: 0.14.10(vue@3.4.38(typescript@5.5.3)) + '@vueuse/core': 10.11.0(vue@3.5.3(typescript@5.5.3)) + '@vueuse/shared': 10.11.0(vue@3.5.3(typescript@5.5.3)) + vue-demi: 0.14.10(vue@3.5.3(typescript@5.5.3)) optionalDependencies: axios: 1.7.7 focus-trap: 7.5.4 @@ -11664,9 +11669,9 @@ snapshots: '@vueuse/metadata@10.11.0': {} - '@vueuse/shared@10.11.0(vue@3.4.38(typescript@5.5.3))': + '@vueuse/shared@10.11.0(vue@3.5.3(typescript@5.5.3))': dependencies: - vue-demi: 0.14.10(vue@3.4.38(typescript@5.5.3)) + vue-demi: 0.14.10(vue@3.5.3(typescript@5.5.3)) transitivePeerDependencies: - '@vue/composition-api' - vue @@ -14534,11 +14539,11 @@ snapshots: pify@4.0.1: {} - pinia@2.2.2(typescript@5.5.3)(vue@3.5.3(typescript@5.5.3)): + pinia@2.2.2(typescript@5.5.3)(vue@3.5.5(typescript@5.5.3)): dependencies: '@vue/devtools-api': 6.6.3 - vue: 3.5.3(typescript@5.5.3) - vue-demi: 0.14.10(vue@3.5.3(typescript@5.5.3)) + vue: 3.5.5(typescript@5.5.3) + vue-demi: 0.14.10(vue@3.5.5(typescript@5.5.3)) optionalDependencies: typescript: 5.5.3 @@ -15992,9 +15997,9 @@ snapshots: - rollup - supports-color - vite-plugin-vue-devtools@7.3.1(rollup@4.18.0)(vite@5.3.3(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1))(vue@3.5.3(typescript@5.5.3)): + vite-plugin-vue-devtools@7.3.1(rollup@4.18.0)(vite@5.3.3(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1))(vue@3.5.5(typescript@5.5.3)): dependencies: - '@vue/devtools-core': 7.3.7(vite@5.3.3(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1))(vue@3.5.3(typescript@5.5.3)) + '@vue/devtools-core': 7.3.7(vite@5.3.3(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1))(vue@3.5.5(typescript@5.5.3)) '@vue/devtools-kit': 7.3.7 '@vue/devtools-shared': 7.3.7 execa: 8.0.1 @@ -16016,7 +16021,7 @@ snapshots: '@babel/plugin-syntax-import-meta': 7.10.4(@babel/core@7.24.7) '@babel/plugin-transform-typescript': 7.25.2(@babel/core@7.24.7) '@vue/babel-plugin-jsx': 1.2.2(@babel/core@7.24.7) - '@vue/compiler-dom': 3.4.38 + '@vue/compiler-dom': 3.5.3 kolorist: 1.8.0 magic-string: 0.30.10 vite: 5.3.3(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1) @@ -16082,17 +16087,17 @@ snapshots: '@shikijs/core': 1.10.3 '@shikijs/transformers': 1.10.3 '@types/markdown-it': 14.1.1 - '@vitejs/plugin-vue': 5.0.5(vite@5.3.3(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1))(vue@3.4.38(typescript@5.5.3)) + '@vitejs/plugin-vue': 5.0.5(vite@5.3.3(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1))(vue@3.5.3(typescript@5.5.3)) '@vue/devtools-api': 7.3.5 '@vue/shared': 3.4.31 - '@vueuse/core': 10.11.0(vue@3.4.38(typescript@5.5.3)) - '@vueuse/integrations': 10.11.0(axios@1.7.7)(focus-trap@7.5.4)(vue@3.4.38(typescript@5.5.3)) + '@vueuse/core': 10.11.0(vue@3.5.3(typescript@5.5.3)) + '@vueuse/integrations': 10.11.0(axios@1.7.7)(focus-trap@7.5.4)(vue@3.5.3(typescript@5.5.3)) focus-trap: 7.5.4 mark.js: 8.11.1 minisearch: 6.3.0 shiki: 1.10.3 vite: 5.3.3(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1) - vue: 3.4.38(typescript@5.5.3) + vue: 3.5.3(typescript@5.5.3) optionalDependencies: postcss: 8.4.45 transitivePeerDependencies: @@ -16226,14 +16231,14 @@ snapshots: vue-component-type-helpers@2.0.29: {} - vue-demi@0.14.10(vue@3.4.38(typescript@5.5.3)): - dependencies: - vue: 3.4.38(typescript@5.5.3) - vue-demi@0.14.10(vue@3.5.3(typescript@5.5.3)): dependencies: vue: 3.5.3(typescript@5.5.3) + vue-demi@0.14.10(vue@3.5.5(typescript@5.5.3)): + dependencies: + vue: 3.5.5(typescript@5.5.3) + vue-eslint-parser@9.4.3(eslint@9.6.0): dependencies: debug: 4.3.5 @@ -16247,10 +16252,10 @@ snapshots: transitivePeerDependencies: - supports-color - vue-router@4.4.3(vue@3.5.3(typescript@5.5.3)): + vue-router@4.4.5(vue@3.5.5(typescript@5.5.3)): dependencies: - '@vue/devtools-api': 6.6.3 - vue: 3.5.3(typescript@5.5.3) + '@vue/devtools-api': 6.6.4 + vue: 3.5.5(typescript@5.5.3) vue-tsc@2.0.29(typescript@5.5.3): dependencies: @@ -16259,16 +16264,6 @@ snapshots: semver: 7.6.2 typescript: 5.5.3 - vue@3.4.38(typescript@5.5.3): - dependencies: - '@vue/compiler-dom': 3.4.38 - '@vue/compiler-sfc': 3.4.38 - '@vue/runtime-dom': 3.4.38 - '@vue/server-renderer': 3.4.38(vue@3.4.38(typescript@5.5.3)) - '@vue/shared': 3.4.38 - optionalDependencies: - typescript: 5.5.3 - vue@3.5.3(typescript@5.5.3): dependencies: '@vue/compiler-dom': 3.5.3 @@ -16279,6 +16274,16 @@ snapshots: optionalDependencies: typescript: 5.5.3 + vue@3.5.5(typescript@5.5.3): + dependencies: + '@vue/compiler-dom': 3.5.5 + '@vue/compiler-sfc': 3.5.5 + '@vue/runtime-dom': 3.5.5 + '@vue/server-renderer': 3.5.5(vue@3.5.5(typescript@5.5.3)) + '@vue/shared': 3.5.5 + optionalDependencies: + typescript: 5.5.3 + w3c-xmlserializer@5.0.0: dependencies: xml-name-validator: 5.0.0 -- 2.51.2 From b08de6d725d9c99a2cd9218394a84bcacbe99141 Mon Sep 17 00:00:00 2001 From: Lubos Date: Tue, 17 Sep 2024 02:23:48 -0400 Subject: [PATCH 11/49] chore: scaffold other plugins --- packages/openapi-ts/src/index.ts | 72 ++++++++-------- packages/openapi-ts/src/openApi/3.1/index.ts | 2 + .../src/openApi/3.1/parser/index.ts | 82 +++++++++++++++++++ .../src/openApi/3.1/parser/operation.ts | 39 +++++++++ .../openapi-ts/src/openApi/3.1/types/spec.ts | 5 +- .../src/openApi/__tests__/index.spec.ts | 2 +- packages/openapi-ts/src/openApi/index.ts | 18 +++- .../src/plugins/@hey-api/schemas/config.ts | 7 ++ .../src/plugins/@hey-api/schemas/index.ts | 13 +++ .../src/plugins/@hey-api/schemas/types.ts | 15 ++++ .../src/plugins/@hey-api/services/config.ts | 7 ++ .../src/plugins/@hey-api/services/index.ts | 13 +++ .../src/plugins/@hey-api/services/types.ts | 15 ++++ .../src/plugins/@hey-api/types/config.ts | 7 ++ .../src/plugins/@hey-api/types/index.ts | 13 +++ .../src/plugins/@hey-api/types/types.ts | 15 ++++ .../plugins/@tanstack/react-query/config.ts | 47 ++--------- .../plugins/@tanstack/react-query/index.ts | 13 +++ .../plugins/@tanstack/react-query/types.ts | 35 ++++++++ .../plugins/@tanstack/solid-query/config.ts | 47 ++--------- .../plugins/@tanstack/solid-query/index.ts | 13 +++ .../plugins/@tanstack/solid-query/types.ts | 35 ++++++++ .../plugins/@tanstack/svelte-query/config.ts | 47 ++--------- .../plugins/@tanstack/svelte-query/index.ts | 13 +++ .../plugins/@tanstack/svelte-query/types.ts | 35 ++++++++ .../src/plugins/@tanstack/vue-query/config.ts | 47 ++--------- .../src/plugins/@tanstack/vue-query/index.ts | 13 +++ .../src/plugins/@tanstack/vue-query/types.ts | 35 ++++++++ packages/openapi-ts/src/plugins/index.ts | 58 ++++++++----- packages/openapi-ts/test/sample.cjs | 5 +- packages/openapi-ts/test/spec/v3.json | 2 +- 31 files changed, 555 insertions(+), 215 deletions(-) create mode 100644 packages/openapi-ts/src/openApi/3.1/index.ts create mode 100644 packages/openapi-ts/src/openApi/3.1/parser/index.ts create mode 100644 packages/openapi-ts/src/openApi/3.1/parser/operation.ts create mode 100644 packages/openapi-ts/src/plugins/@hey-api/schemas/config.ts create mode 100644 packages/openapi-ts/src/plugins/@hey-api/schemas/index.ts create mode 100644 packages/openapi-ts/src/plugins/@hey-api/schemas/types.ts create mode 100644 packages/openapi-ts/src/plugins/@hey-api/services/config.ts create mode 100644 packages/openapi-ts/src/plugins/@hey-api/services/index.ts create mode 100644 packages/openapi-ts/src/plugins/@hey-api/services/types.ts create mode 100644 packages/openapi-ts/src/plugins/@hey-api/types/config.ts create mode 100644 packages/openapi-ts/src/plugins/@hey-api/types/index.ts create mode 100644 packages/openapi-ts/src/plugins/@hey-api/types/types.ts create mode 100644 packages/openapi-ts/src/plugins/@tanstack/react-query/index.ts create mode 100644 packages/openapi-ts/src/plugins/@tanstack/react-query/types.ts create mode 100644 packages/openapi-ts/src/plugins/@tanstack/solid-query/index.ts create mode 100644 packages/openapi-ts/src/plugins/@tanstack/solid-query/types.ts create mode 100644 packages/openapi-ts/src/plugins/@tanstack/svelte-query/index.ts create mode 100644 packages/openapi-ts/src/plugins/@tanstack/svelte-query/types.ts create mode 100644 packages/openapi-ts/src/plugins/@tanstack/vue-query/index.ts create mode 100644 packages/openapi-ts/src/plugins/@tanstack/vue-query/types.ts diff --git a/packages/openapi-ts/src/index.ts b/packages/openapi-ts/src/index.ts index 3488aac48..09de7f97e 100644 --- a/packages/openapi-ts/src/index.ts +++ b/packages/openapi-ts/src/index.ts @@ -4,7 +4,7 @@ import { loadConfig } from 'c12'; import { sync } from 'cross-spawn'; import { generateOutput } from './generate/output'; -import { parse } from './openApi'; +import { parse, parseExperimental } from './openApi'; import { defaultPluginConfigs } from './plugins'; import type { Client } from './types/client'; import type { ClientConfig, Config, UserConfig } from './types/config'; @@ -143,7 +143,7 @@ const getPlugins = (userConfig: ClientConfig): Config['plugins'] => { ? defaultPluginConfigs[plugin] : { ...defaultPluginConfigs[plugin.name], - ...plugin, + ...(plugin as (typeof defaultPluginConfigs)[(typeof plugin)['name']]), }, ); return plugins; @@ -309,7 +309,9 @@ const initConfigs = async (userConfig: UserConfig): Promise => { * service layer, etc. * @param userConfig {@link UserConfig} passed to the `createClient()` method */ -export async function createClient(userConfig: UserConfig): Promise { +export async function createClient( + userConfig: UserConfig, +): Promise> { Performance.start('createClient'); const configs = await initConfigs(userConfig); @@ -324,46 +326,50 @@ export async function createClient(userConfig: UserConfig): Promise { ReturnType >); - Performance.start('parser'); - const parsed = parse({ - config: { - filterFn: { - operation: operationFilterFn, - operationParameter: operationParameterFilterFn, - }, - nameFn: { - operation: operationNameFn, - operationParameter: operationParameterNameFn, - }, - }, - openApi, - }); - const client = postProcessClient(parsed); - Performance.end('parser'); - if (config.experimental_parser) { Performance.start('experimental_parser'); - // TODO: experimental parser + parseExperimental({ + spec: openApi, + }); Performance.end('experimental_parser'); - } + } else { + Performance.start('parser'); + const parsed = parse({ + config: { + filterFn: { + operation: operationFilterFn, + operationParameter: operationParameterFilterFn, + }, + nameFn: { + operation: operationNameFn, + operationParameter: operationParameterNameFn, + }, + }, + openApi, + }); + const client = postProcessClient(parsed); + Performance.end('parser'); - if (!config.dryRun) { - logClientMessage(); - await generateOutput(openApi, client, templates); - processOutput(); - } + if (!config.dryRun) { + logClientMessage(); + await generateOutput(openApi, client, templates); + processOutput(); + } - console.log('✨ Done! Your client is located in:', config.output.path); + console.log('✨ Done! Your client is located in:', config.output.path); - return client; + return client; + } }; - const clients: Client[] = []; + const clients: Array = []; const pClients = configs.map((config) => pCreateClient(config)); for (const pClient of pClients) { const client = await pClient(); - clients.push(client); + if (client) { + clients.push(client); + } } Performance.end('createClient'); @@ -374,9 +380,7 @@ export async function createClient(userConfig: UserConfig): Promise { /** * Type helper for openapi-ts.config.ts, returns {@link UserConfig} object */ -export function defineConfig(config: UserConfig): UserConfig { - return config; -} +export const defineConfig = (config: UserConfig): UserConfig => config; export default { createClient, diff --git a/packages/openapi-ts/src/openApi/3.1/index.ts b/packages/openapi-ts/src/openApi/3.1/index.ts new file mode 100644 index 000000000..89a9e7a9a --- /dev/null +++ b/packages/openapi-ts/src/openApi/3.1/index.ts @@ -0,0 +1,2 @@ +export { parseV3_1 } from './parser'; +export type { OpenApiV3_1 } from './types/spec'; diff --git a/packages/openapi-ts/src/openApi/3.1/parser/index.ts b/packages/openapi-ts/src/openApi/3.1/parser/index.ts new file mode 100644 index 000000000..0b68141a9 --- /dev/null +++ b/packages/openapi-ts/src/openApi/3.1/parser/index.ts @@ -0,0 +1,82 @@ +import type { OpenApiV3_1 } from '../types/spec'; +import { parseOperation } from './operation'; + +export const parseV3_1 = (spec: OpenApiV3_1) => { + const operationIds = new Map(); + + for (const path in spec.paths) { + const pathItem = spec.paths[path]; + + if (pathItem.delete) { + parseOperation({ + method: 'DELETE', + operation: pathItem.delete, + operationIds, + path, + }); + } + + if (pathItem.get) { + parseOperation({ + method: 'GET', + operation: pathItem.get, + operationIds, + path, + }); + } + + if (pathItem.head) { + parseOperation({ + method: 'HEAD', + operation: pathItem.head, + operationIds, + path, + }); + } + + if (pathItem.options) { + parseOperation({ + method: 'OPTIONS', + operation: pathItem.options, + operationIds, + path, + }); + } + + if (pathItem.patch) { + parseOperation({ + method: 'PATCH', + operation: pathItem.patch, + operationIds, + path, + }); + } + + if (pathItem.post) { + parseOperation({ + method: 'POST', + operation: pathItem.post, + operationIds, + path, + }); + } + + if (pathItem.put) { + parseOperation({ + method: 'PUT', + operation: pathItem.put, + operationIds, + path, + }); + } + + if (pathItem.trace) { + parseOperation({ + method: 'TRACE', + operation: pathItem.trace, + operationIds, + path, + }); + } + } +}; diff --git a/packages/openapi-ts/src/openApi/3.1/parser/operation.ts b/packages/openapi-ts/src/openApi/3.1/parser/operation.ts new file mode 100644 index 000000000..cc7e86538 --- /dev/null +++ b/packages/openapi-ts/src/openApi/3.1/parser/operation.ts @@ -0,0 +1,39 @@ +import { getConfig } from '../../../utils/config'; +import type { OperationObject } from '../types/spec'; + +export const parseOperation = ({ + method, + operation, + operationIds, + path, +}: { + method: string; + operation: OperationObject; + operationIds: Map; + path: string; +}) => { + const operationKey = `${method} ${path}`; + + const config = getConfig(); + + // TODO: filter function, move services to plugin, cleaner syntax + const regexp = config.services.filter + ? new RegExp(config.services.filter) + : undefined; + if (regexp && !regexp.test(operationKey)) { + return; + } + + // TODO: support throw on duplicate + if (operation.operationId) { + if (operationIds.has(operation.operationId)) { + console.warn( + `❗️ Duplicate operationId: ${operation.operationId} in ${operationKey}. Please ensure your operation IDs are unique. This behavior is not supported and will likely lead to unexpected results.`, + ); + } else { + operationIds.set(operation.operationId, operationKey); + } + } + + console.log(operation); +}; diff --git a/packages/openapi-ts/src/openApi/3.1/types/spec.ts b/packages/openapi-ts/src/openApi/3.1/types/spec.ts index 593d5d320..08503b7c0 100644 --- a/packages/openapi-ts/src/openApi/3.1/types/spec.ts +++ b/packages/openapi-ts/src/openApi/3.1/types/spec.ts @@ -27,7 +27,8 @@ export interface OpenApiV3_1 { /** * The available paths and operations for the API. */ - paths?: any; + // paths?: any; + paths?: Record; /** * A declaration of which security mechanisms can be used across the API. The list of values includes alternative security requirement objects that can be used. Only one of the security requirement objects need to be satisfied to authorize a request. Individual operations can override this definition. To make security optional, an empty security requirement (`{}`) can be included in the array. */ @@ -288,7 +289,7 @@ interface MediaTypeObject { * - read:pets * ``` */ -interface OperationObject { +export interface OperationObject { /** * A map of possible out-of band callbacks related to the parent operation. The key is a unique identifier for the Callback Object. Each value in the map is a {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#callback-object Callback Object} that describes a request that may be initiated by the API provider and the expected responses. */ diff --git a/packages/openapi-ts/src/openApi/__tests__/index.spec.ts b/packages/openapi-ts/src/openApi/__tests__/index.spec.ts index 40cf4aa94..30e0ca4e7 100644 --- a/packages/openapi-ts/src/openApi/__tests__/index.spec.ts +++ b/packages/openapi-ts/src/openApi/__tests__/index.spec.ts @@ -83,7 +83,7 @@ describe('parse', () => { it('throws on unknown version', () => { // @ts-expect-error expect(() => parse({ config, openApi: { foo: 'bar' } })).toThrow( - `Unsupported Open API specification: ${JSON.stringify({ foo: 'bar' }, null, 2)}`, + `Unsupported OpenAPI specification: ${JSON.stringify({ foo: 'bar' }, null, 2)}`, ); }); }); diff --git a/packages/openapi-ts/src/openApi/index.ts b/packages/openapi-ts/src/openApi/index.ts index 5f9ec857b..44eea94fd 100644 --- a/packages/openapi-ts/src/openApi/index.ts +++ b/packages/openapi-ts/src/openApi/index.ts @@ -1,9 +1,10 @@ +import { type OpenApiV3_1, parseV3_1 } from './3.1'; import type { Client } from './common/interfaces/client'; import type { Config } from './common/interfaces/config'; import type { OpenApi } from './common/interfaces/OpenApi'; import { setConfig } from './config'; -import { parse as parseV2 } from './v2/index'; -import { parse as parseV3 } from './v3/index'; +import { parse as parseV2 } from './v2'; +import { parse as parseV3 } from './v3'; export type { Client, @@ -50,6 +51,17 @@ export function parse({ } throw new Error( - `Unsupported Open API specification: ${JSON.stringify(openApi, null, 2)}`, + `Unsupported OpenAPI specification: ${JSON.stringify(openApi, null, 2)}`, ); } + +export const parseExperimental = ({ spec }: { spec: unknown }) => { + const s = spec as OpenApiV3_1; + + switch (s.openapi) { + case '3.1.0': + return parseV3_1(s); + default: + throw new Error('Unsupported OpenAPI specification'); + } +}; diff --git a/packages/openapi-ts/src/plugins/@hey-api/schemas/config.ts b/packages/openapi-ts/src/plugins/@hey-api/schemas/config.ts new file mode 100644 index 000000000..93402a94d --- /dev/null +++ b/packages/openapi-ts/src/plugins/@hey-api/schemas/config.ts @@ -0,0 +1,7 @@ +import type { PluginConfig } from './types'; + +export const defaultConfig: Required = { + handler: () => {}, + name: '@hey-api/schemas', + output: 'schemas', +}; diff --git a/packages/openapi-ts/src/plugins/@hey-api/schemas/index.ts b/packages/openapi-ts/src/plugins/@hey-api/schemas/index.ts new file mode 100644 index 000000000..de19d0cb9 --- /dev/null +++ b/packages/openapi-ts/src/plugins/@hey-api/schemas/index.ts @@ -0,0 +1,13 @@ +import { defaultConfig } from './config'; +import type { PluginConfig, UserConfig } from './types'; + +export { defaultConfig } from './config'; +export type { PluginConfig, UserConfig } from './types'; + +/** + * Type helper for Hey API schemas plugin, returns {@link PluginConfig} object + */ +export const defineConfig = (config?: UserConfig): PluginConfig => ({ + ...defaultConfig, + ...config, +}); diff --git a/packages/openapi-ts/src/plugins/@hey-api/schemas/types.ts b/packages/openapi-ts/src/plugins/@hey-api/schemas/types.ts new file mode 100644 index 000000000..22dbf0916 --- /dev/null +++ b/packages/openapi-ts/src/plugins/@hey-api/schemas/types.ts @@ -0,0 +1,15 @@ +import type { PluginDefinition } from '../../types'; + +export interface PluginConfig extends PluginDefinition { + /** + * Generate Hey API schemas from the provided input. + */ + name: '@hey-api/schemas'; + /** + * Name of the generated file. + * @default 'schemas' + */ + output?: string; +} + +export interface UserConfig extends Pick {} diff --git a/packages/openapi-ts/src/plugins/@hey-api/services/config.ts b/packages/openapi-ts/src/plugins/@hey-api/services/config.ts new file mode 100644 index 000000000..cbab7d1a3 --- /dev/null +++ b/packages/openapi-ts/src/plugins/@hey-api/services/config.ts @@ -0,0 +1,7 @@ +import type { PluginConfig } from './types'; + +export const defaultConfig: Required = { + handler: () => {}, + name: '@hey-api/services', + output: 'services', +}; diff --git a/packages/openapi-ts/src/plugins/@hey-api/services/index.ts b/packages/openapi-ts/src/plugins/@hey-api/services/index.ts new file mode 100644 index 000000000..3dadb457b --- /dev/null +++ b/packages/openapi-ts/src/plugins/@hey-api/services/index.ts @@ -0,0 +1,13 @@ +import { defaultConfig } from './config'; +import type { PluginConfig, UserConfig } from './types'; + +export { defaultConfig } from './config'; +export type { PluginConfig, UserConfig } from './types'; + +/** + * Type helper for Hey API services plugin, returns {@link PluginConfig} object + */ +export const defineConfig = (config?: UserConfig): PluginConfig => ({ + ...defaultConfig, + ...config, +}); diff --git a/packages/openapi-ts/src/plugins/@hey-api/services/types.ts b/packages/openapi-ts/src/plugins/@hey-api/services/types.ts new file mode 100644 index 000000000..c186ffb92 --- /dev/null +++ b/packages/openapi-ts/src/plugins/@hey-api/services/types.ts @@ -0,0 +1,15 @@ +import type { PluginDefinition } from '../../types'; + +export interface PluginConfig extends PluginDefinition { + /** + * Generate Hey API services from the provided input. + */ + name: '@hey-api/services'; + /** + * Name of the generated file. + * @default 'services' + */ + output?: string; +} + +export interface UserConfig extends Pick {} diff --git a/packages/openapi-ts/src/plugins/@hey-api/types/config.ts b/packages/openapi-ts/src/plugins/@hey-api/types/config.ts new file mode 100644 index 000000000..1780178d1 --- /dev/null +++ b/packages/openapi-ts/src/plugins/@hey-api/types/config.ts @@ -0,0 +1,7 @@ +import type { PluginConfig } from './types'; + +export const defaultConfig: Required = { + handler: () => {}, + name: '@hey-api/types', + output: 'types', +}; diff --git a/packages/openapi-ts/src/plugins/@hey-api/types/index.ts b/packages/openapi-ts/src/plugins/@hey-api/types/index.ts new file mode 100644 index 000000000..09a39f768 --- /dev/null +++ b/packages/openapi-ts/src/plugins/@hey-api/types/index.ts @@ -0,0 +1,13 @@ +import { defaultConfig } from './config'; +import type { PluginConfig, UserConfig } from './types'; + +export { defaultConfig } from './config'; +export type { PluginConfig, UserConfig } from './types'; + +/** + * Type helper for Hey API types plugin, returns {@link PluginConfig} object + */ +export const defineConfig = (config?: UserConfig): PluginConfig => ({ + ...defaultConfig, + ...config, +}); diff --git a/packages/openapi-ts/src/plugins/@hey-api/types/types.ts b/packages/openapi-ts/src/plugins/@hey-api/types/types.ts new file mode 100644 index 000000000..90f6cd91a --- /dev/null +++ b/packages/openapi-ts/src/plugins/@hey-api/types/types.ts @@ -0,0 +1,15 @@ +import type { PluginDefinition } from '../../types'; + +export interface PluginConfig extends PluginDefinition { + /** + * Generate Hey API types from the provided input. + */ + name: '@hey-api/types'; + /** + * Name of the generated file. + * @default 'types' + */ + output?: string; +} + +export interface UserConfig extends Pick {} diff --git a/packages/openapi-ts/src/plugins/@tanstack/react-query/config.ts b/packages/openapi-ts/src/plugins/@tanstack/react-query/config.ts index a63e850f8..201ea42bd 100644 --- a/packages/openapi-ts/src/plugins/@tanstack/react-query/config.ts +++ b/packages/openapi-ts/src/plugins/@tanstack/react-query/config.ts @@ -1,40 +1,11 @@ -import type { PluginDefinition } from '../../types'; import { handler } from '../query-core/plugin'; +import type { PluginConfig } from './types'; -export interface PluginTanStackReactQuery extends PluginDefinition { - /** - * Generate {@link https://tanstack.com/query/v5/docs/framework/react/reference/infiniteQueryOptions `infiniteQueryOptions()`} helpers? These will be generated from GET and POST requests where a pagination parameter is detected. - * @default true - */ - infiniteQueryOptions?: boolean; - /** - * Generate {@link https://tanstack.com/query/v5/docs/framework/react/reference/useMutation `useMutation()`} helpers? These will be generated from DELETE, PATCH, POST, and PUT requests. - * @default true - */ - mutationOptions?: boolean; - /** - * Generate TanStack React Query output from the provided input. - */ - name: '@tanstack/react-query'; - /** - * Name of the generated file. - * @default '@tanstack/react-query' - */ - output?: string; - /** - * Generate {@link https://tanstack.com/query/v5/docs/framework/react/reference/queryOptions `queryOptions()`} helpers? - * These will be generated from all requests. - * @default true - */ - queryOptions?: boolean; -} - -export const pluginTanStackReactQueryDefaultConfig: Required = - { - handler, - infiniteQueryOptions: true, - mutationOptions: true, - name: '@tanstack/react-query', - output: '@tanstack/react-query', - queryOptions: true, - }; +export const defaultConfig: Required = { + handler, + infiniteQueryOptions: true, + mutationOptions: true, + name: '@tanstack/react-query', + output: '@tanstack/react-query', + queryOptions: true, +}; diff --git a/packages/openapi-ts/src/plugins/@tanstack/react-query/index.ts b/packages/openapi-ts/src/plugins/@tanstack/react-query/index.ts new file mode 100644 index 000000000..05be8ac85 --- /dev/null +++ b/packages/openapi-ts/src/plugins/@tanstack/react-query/index.ts @@ -0,0 +1,13 @@ +import { defaultConfig } from './config'; +import type { PluginConfig, UserConfig } from './types'; + +export { defaultConfig } from './config'; +export type { PluginConfig, UserConfig } from './types'; + +/** + * Type helper for TanStack React Query plugin, returns {@link PluginConfig} object + */ +export const defineConfig = (config?: UserConfig): PluginConfig => ({ + ...defaultConfig, + ...config, +}); diff --git a/packages/openapi-ts/src/plugins/@tanstack/react-query/types.ts b/packages/openapi-ts/src/plugins/@tanstack/react-query/types.ts new file mode 100644 index 000000000..7764dbfa4 --- /dev/null +++ b/packages/openapi-ts/src/plugins/@tanstack/react-query/types.ts @@ -0,0 +1,35 @@ +import type { PluginDefinition } from '../../types'; + +export interface PluginConfig extends PluginDefinition { + /** + * Generate {@link https://tanstack.com/query/v5/docs/framework/react/reference/infiniteQueryOptions `infiniteQueryOptions()`} helpers? These will be generated from GET and POST requests where a pagination parameter is detected. + * @default true + */ + infiniteQueryOptions?: boolean; + /** + * Generate {@link https://tanstack.com/query/v5/docs/framework/react/reference/useMutation `useMutation()`} helpers? These will be generated from DELETE, PATCH, POST, and PUT requests. + * @default true + */ + mutationOptions?: boolean; + /** + * Generate TanStack React Query output from the provided input. + */ + name: '@tanstack/react-query'; + /** + * Name of the generated file. + * @default '@tanstack/react-query' + */ + output?: string; + /** + * Generate {@link https://tanstack.com/query/v5/docs/framework/react/reference/queryOptions `queryOptions()`} helpers? + * These will be generated from all requests. + * @default true + */ + queryOptions?: boolean; +} + +export interface UserConfig + extends Pick< + PluginConfig, + 'infiniteQueryOptions' | 'mutationOptions' | 'output' | 'queryOptions' + > {} diff --git a/packages/openapi-ts/src/plugins/@tanstack/solid-query/config.ts b/packages/openapi-ts/src/plugins/@tanstack/solid-query/config.ts index f594160ac..ea62b47ce 100644 --- a/packages/openapi-ts/src/plugins/@tanstack/solid-query/config.ts +++ b/packages/openapi-ts/src/plugins/@tanstack/solid-query/config.ts @@ -1,40 +1,11 @@ -import type { PluginDefinition } from '../../types'; import { handler } from '../query-core/plugin'; +import type { PluginConfig } from './types'; -export interface PluginTanStackSolidQuery extends PluginDefinition { - /** - * Generate `createInfiniteQuery()` helpers? These will be generated from GET and POST requests where a pagination parameter is detected. - * @default true - */ - infiniteQueryOptions?: boolean; - /** - * Generate `createMutation()` helpers? These will be generated from DELETE, PATCH, POST, and PUT requests. - * @default true - */ - mutationOptions?: boolean; - /** - * Generate TanStack Solid Query output from the provided input. - */ - name: '@tanstack/solid-query'; - /** - * Name of the generated file. - * @default '@tanstack/solid-query' - */ - output?: string; - /** - * Generate {@link https://tanstack.com/query/v5/docs/framework/solid/reference/createQuery `createQuery()`} helpers? - * These will be generated from all requests. - * @default true - */ - queryOptions?: boolean; -} - -export const pluginTanStackSolidQueryDefaultConfig: Required = - { - handler, - infiniteQueryOptions: true, - mutationOptions: true, - name: '@tanstack/solid-query', - output: '@tanstack/solid-query', - queryOptions: true, - }; +export const defaultConfig: Required = { + handler, + infiniteQueryOptions: true, + mutationOptions: true, + name: '@tanstack/solid-query', + output: '@tanstack/solid-query', + queryOptions: true, +}; diff --git a/packages/openapi-ts/src/plugins/@tanstack/solid-query/index.ts b/packages/openapi-ts/src/plugins/@tanstack/solid-query/index.ts new file mode 100644 index 000000000..d0aa30ed5 --- /dev/null +++ b/packages/openapi-ts/src/plugins/@tanstack/solid-query/index.ts @@ -0,0 +1,13 @@ +import { defaultConfig } from './config'; +import type { PluginConfig, UserConfig } from './types'; + +export { defaultConfig } from './config'; +export type { PluginConfig, UserConfig } from './types'; + +/** + * Type helper for TanStack Solid Query plugin, returns {@link PluginConfig} object + */ +export const defineConfig = (config?: UserConfig): PluginConfig => ({ + ...defaultConfig, + ...config, +}); diff --git a/packages/openapi-ts/src/plugins/@tanstack/solid-query/types.ts b/packages/openapi-ts/src/plugins/@tanstack/solid-query/types.ts new file mode 100644 index 000000000..6c06db797 --- /dev/null +++ b/packages/openapi-ts/src/plugins/@tanstack/solid-query/types.ts @@ -0,0 +1,35 @@ +import type { PluginDefinition } from '../../types'; + +export interface PluginConfig extends PluginDefinition { + /** + * Generate `createInfiniteQuery()` helpers? These will be generated from GET and POST requests where a pagination parameter is detected. + * @default true + */ + infiniteQueryOptions?: boolean; + /** + * Generate `createMutation()` helpers? These will be generated from DELETE, PATCH, POST, and PUT requests. + * @default true + */ + mutationOptions?: boolean; + /** + * Generate TanStack Solid Query output from the provided input. + */ + name: '@tanstack/solid-query'; + /** + * Name of the generated file. + * @default '@tanstack/solid-query' + */ + output?: string; + /** + * Generate {@link https://tanstack.com/query/v5/docs/framework/solid/reference/createQuery `createQuery()`} helpers? + * These will be generated from all requests. + * @default true + */ + queryOptions?: boolean; +} + +export interface UserConfig + extends Pick< + PluginConfig, + 'infiniteQueryOptions' | 'mutationOptions' | 'output' | 'queryOptions' + > {} diff --git a/packages/openapi-ts/src/plugins/@tanstack/svelte-query/config.ts b/packages/openapi-ts/src/plugins/@tanstack/svelte-query/config.ts index 06301b914..cd6f0f6a4 100644 --- a/packages/openapi-ts/src/plugins/@tanstack/svelte-query/config.ts +++ b/packages/openapi-ts/src/plugins/@tanstack/svelte-query/config.ts @@ -1,40 +1,11 @@ -import type { PluginDefinition } from '../../types'; import { handler } from '../query-core/plugin'; +import type { PluginConfig } from './types'; -export interface PluginTanStackSvelteQuery extends PluginDefinition { - /** - * Generate `createInfiniteQuery()` helpers? These will be generated from GET and POST requests where a pagination parameter is detected. - * @default true - */ - infiniteQueryOptions?: boolean; - /** - * Generate {@link https://tanstack.com/query/v5/docs/framework/svelte/reference/functions/createmutation `createMutation()`} helpers? These will be generated from DELETE, PATCH, POST, and PUT requests. - * @default true - */ - mutationOptions?: boolean; - /** - * Generate TanStack Svelte Query output from the provided input. - */ - name: '@tanstack/svelte-query'; - /** - * Name of the generated file. - * @default '@tanstack/svelte-query' - */ - output?: string; - /** - * Generate {@link https://tanstack.com/query/v5/docs/framework/svelte/reference/functions/createquery `createQuery()`} helpers? - * These will be generated from all requests. - * @default true - */ - queryOptions?: boolean; -} - -export const pluginTanStackSvelteQueryDefaultConfig: Required = - { - handler, - infiniteQueryOptions: true, - mutationOptions: true, - name: '@tanstack/svelte-query', - output: '@tanstack/svelte-query', - queryOptions: true, - }; +export const defaultConfig: Required = { + handler, + infiniteQueryOptions: true, + mutationOptions: true, + name: '@tanstack/svelte-query', + output: '@tanstack/svelte-query', + queryOptions: true, +}; diff --git a/packages/openapi-ts/src/plugins/@tanstack/svelte-query/index.ts b/packages/openapi-ts/src/plugins/@tanstack/svelte-query/index.ts new file mode 100644 index 000000000..f9f05557b --- /dev/null +++ b/packages/openapi-ts/src/plugins/@tanstack/svelte-query/index.ts @@ -0,0 +1,13 @@ +import { defaultConfig } from './config'; +import type { PluginConfig, UserConfig } from './types'; + +export { defaultConfig } from './config'; +export type { PluginConfig, UserConfig } from './types'; + +/** + * Type helper for TanStack Svelte Query plugin, returns {@link PluginConfig} object + */ +export const defineConfig = (config?: UserConfig): PluginConfig => ({ + ...defaultConfig, + ...config, +}); diff --git a/packages/openapi-ts/src/plugins/@tanstack/svelte-query/types.ts b/packages/openapi-ts/src/plugins/@tanstack/svelte-query/types.ts new file mode 100644 index 000000000..244e03688 --- /dev/null +++ b/packages/openapi-ts/src/plugins/@tanstack/svelte-query/types.ts @@ -0,0 +1,35 @@ +import type { PluginDefinition } from '../../types'; + +export interface PluginConfig extends PluginDefinition { + /** + * Generate `createInfiniteQuery()` helpers? These will be generated from GET and POST requests where a pagination parameter is detected. + * @default true + */ + infiniteQueryOptions?: boolean; + /** + * Generate {@link https://tanstack.com/query/v5/docs/framework/svelte/reference/functions/createmutation `createMutation()`} helpers? These will be generated from DELETE, PATCH, POST, and PUT requests. + * @default true + */ + mutationOptions?: boolean; + /** + * Generate TanStack Svelte Query output from the provided input. + */ + name: '@tanstack/svelte-query'; + /** + * Name of the generated file. + * @default '@tanstack/svelte-query' + */ + output?: string; + /** + * Generate {@link https://tanstack.com/query/v5/docs/framework/svelte/reference/functions/createquery `createQuery()`} helpers? + * These will be generated from all requests. + * @default true + */ + queryOptions?: boolean; +} + +export interface UserConfig + extends Pick< + PluginConfig, + 'infiniteQueryOptions' | 'mutationOptions' | 'output' | 'queryOptions' + > {} diff --git a/packages/openapi-ts/src/plugins/@tanstack/vue-query/config.ts b/packages/openapi-ts/src/plugins/@tanstack/vue-query/config.ts index bc587d6df..2e516cfc5 100644 --- a/packages/openapi-ts/src/plugins/@tanstack/vue-query/config.ts +++ b/packages/openapi-ts/src/plugins/@tanstack/vue-query/config.ts @@ -1,40 +1,11 @@ -import type { PluginDefinition } from '../../types'; import { handler } from '../query-core/plugin'; +import type { PluginConfig } from './types'; -export interface PluginTanStackVueQuery extends PluginDefinition { - /** - * Generate {@link https://tanstack.com/query/v5/docs/framework/vue/reference/infiniteQueryOptions `infiniteQueryOptions()`} helpers? These will be generated from GET and POST requests where a pagination parameter is detected. - * @default true - */ - infiniteQueryOptions?: boolean; - /** - * Generate {@link https://tanstack.com/query/v5/docs/framework/vue/reference/useMutation `useMutation()`} helpers? These will be generated from DELETE, PATCH, POST, and PUT requests. - * @default true - */ - mutationOptions?: boolean; - /** - * Generate TanStack Vue Query output from the provided input. - */ - name: '@tanstack/vue-query'; - /** - * Name of the generated file. - * @default '@tanstack/vue-query' - */ - output?: string; - /** - * Generate {@link https://tanstack.com/query/v5/docs/framework/vue/guides/query-options `queryOptions()`} helpers? - * These will be generated from all requests. - * @default true - */ - queryOptions?: boolean; -} - -export const pluginTanStackVueQueryDefaultConfig: Required = - { - handler, - infiniteQueryOptions: true, - mutationOptions: true, - name: '@tanstack/vue-query', - output: '@tanstack/vue-query', - queryOptions: true, - }; +export const defaultConfig: Required = { + handler, + infiniteQueryOptions: true, + mutationOptions: true, + name: '@tanstack/vue-query', + output: '@tanstack/vue-query', + queryOptions: true, +}; diff --git a/packages/openapi-ts/src/plugins/@tanstack/vue-query/index.ts b/packages/openapi-ts/src/plugins/@tanstack/vue-query/index.ts new file mode 100644 index 000000000..e41a2109f --- /dev/null +++ b/packages/openapi-ts/src/plugins/@tanstack/vue-query/index.ts @@ -0,0 +1,13 @@ +import { defaultConfig } from './config'; +import type { PluginConfig, UserConfig } from './types'; + +export { defaultConfig } from './config'; +export type { PluginConfig, UserConfig } from './types'; + +/** + * Type helper for TanStack Vue Query plugin, returns {@link PluginConfig} object + */ +export const defineConfig = (config?: UserConfig): PluginConfig => ({ + ...defaultConfig, + ...config, +}); diff --git a/packages/openapi-ts/src/plugins/@tanstack/vue-query/types.ts b/packages/openapi-ts/src/plugins/@tanstack/vue-query/types.ts new file mode 100644 index 000000000..858ba2869 --- /dev/null +++ b/packages/openapi-ts/src/plugins/@tanstack/vue-query/types.ts @@ -0,0 +1,35 @@ +import type { PluginDefinition } from '../../types'; + +export interface PluginConfig extends PluginDefinition { + /** + * Generate {@link https://tanstack.com/query/v5/docs/framework/vue/reference/infiniteQueryOptions `infiniteQueryOptions()`} helpers? These will be generated from GET and POST requests where a pagination parameter is detected. + * @default true + */ + infiniteQueryOptions?: boolean; + /** + * Generate {@link https://tanstack.com/query/v5/docs/framework/vue/reference/useMutation `useMutation()`} helpers? These will be generated from DELETE, PATCH, POST, and PUT requests. + * @default true + */ + mutationOptions?: boolean; + /** + * Generate TanStack Vue Query output from the provided input. + */ + name: '@tanstack/vue-query'; + /** + * Name of the generated file. + * @default '@tanstack/vue-query' + */ + output?: string; + /** + * Generate {@link https://tanstack.com/query/v5/docs/framework/vue/guides/query-options `queryOptions()`} helpers? + * These will be generated from all requests. + * @default true + */ + queryOptions?: boolean; +} + +export interface UserConfig + extends Pick< + PluginConfig, + 'infiniteQueryOptions' | 'mutationOptions' | 'output' | 'queryOptions' + > {} diff --git a/packages/openapi-ts/src/plugins/index.ts b/packages/openapi-ts/src/plugins/index.ts index 6fe878967..e2612ff8c 100644 --- a/packages/openapi-ts/src/plugins/index.ts +++ b/packages/openapi-ts/src/plugins/index.ts @@ -1,30 +1,48 @@ import { - type PluginTanStackReactQuery, - pluginTanStackReactQueryDefaultConfig, -} from './@tanstack/react-query/config'; + defaultConfig as heyApiSchemasDefaultConfig, + type PluginConfig as HeyApiSchemas, +} from './@hey-api/schemas'; import { - type PluginTanStackSolidQuery, - pluginTanStackSolidQueryDefaultConfig, -} from './@tanstack/solid-query/config'; + defaultConfig as heyApiServicesDefaultConfig, + type PluginConfig as HeyApiServices, +} from './@hey-api/services'; import { - type PluginTanStackSvelteQuery, - pluginTanStackSvelteQueryDefaultConfig, -} from './@tanstack/svelte-query/config'; + defaultConfig as heyApiTypesDefaultConfig, + type PluginConfig as HeyApiTypes, +} from './@hey-api/types'; import { - type PluginTanStackVueQuery, - pluginTanStackVueQueryDefaultConfig, -} from './@tanstack/vue-query/config'; + defaultConfig as tanStackReactQueryDefaultConfig, + type PluginConfig as TanStackReactQuery, +} from './@tanstack/react-query'; +import { + defaultConfig as tanStackSolidQueryDefaultConfig, + type PluginConfig as TanStackSolidQuery, +} from './@tanstack/solid-query'; +import { + defaultConfig as tanStackSvelteQueryDefaultConfig, + type PluginConfig as TanStackSvelteQuery, +} from './@tanstack/svelte-query'; +import { + defaultConfig as tanStackVueQueryDefaultConfig, + type PluginConfig as TanStackVueQuery, +} from './@tanstack/vue-query'; import type { DefaultPluginConfigsMap } from './types'; export type Plugins = - | PluginTanStackReactQuery - | PluginTanStackSolidQuery - | PluginTanStackSvelteQuery - | PluginTanStackVueQuery; + | HeyApiSchemas + | HeyApiServices + | HeyApiTypes + | TanStackReactQuery + | TanStackSolidQuery + | TanStackSvelteQuery + | TanStackVueQuery; export const defaultPluginConfigs: DefaultPluginConfigsMap = { - '@tanstack/react-query': pluginTanStackReactQueryDefaultConfig, - '@tanstack/solid-query': pluginTanStackSolidQueryDefaultConfig, - '@tanstack/svelte-query': pluginTanStackSvelteQueryDefaultConfig, - '@tanstack/vue-query': pluginTanStackVueQueryDefaultConfig, + '@hey-api/schemas': heyApiSchemasDefaultConfig, + '@hey-api/services': heyApiServicesDefaultConfig, + '@hey-api/types': heyApiTypesDefaultConfig, + '@tanstack/react-query': tanStackReactQueryDefaultConfig, + '@tanstack/solid-query': tanStackSolidQueryDefaultConfig, + '@tanstack/svelte-query': tanStackSvelteQueryDefaultConfig, + '@tanstack/vue-query': tanStackVueQueryDefaultConfig, }; diff --git a/packages/openapi-ts/test/sample.cjs b/packages/openapi-ts/test/sample.cjs index 072d20db1..825bc9233 100644 --- a/packages/openapi-ts/test/sample.cjs +++ b/packages/openapi-ts/test/sample.cjs @@ -1,7 +1,7 @@ const path = require('node:path'); const main = async () => { - /** @type {import('../src/node/index').UserConfig} */ + /** @type {import('../src/node').UserConfig} */ const config = { client: { // bundle: true, @@ -25,6 +25,7 @@ const main = async () => { name: '@tanstack/react-query', // queryOptions: false, }, + // '@hey-api/services', ], schemas: { export: false, @@ -32,7 +33,7 @@ const main = async () => { services: { // export: false, // asClass: true, - // filter: '^POST /api/v{api-version}/upload$', + filter: '^POST /api/v{api-version}/upload$', // export: false, // name: '^Parameters', }, diff --git a/packages/openapi-ts/test/spec/v3.json b/packages/openapi-ts/test/spec/v3.json index fb51a85ac..5b380e62a 100644 --- a/packages/openapi-ts/test/spec/v3.json +++ b/packages/openapi-ts/test/spec/v3.json @@ -1,5 +1,5 @@ { - "openapi": "3.0.0", + "openapi": "3.1.0", "info": { "title": "swagger", "version": "v1.0" -- 2.51.2 From f791c28f959138e008501518347d11ac45cd8f3a Mon Sep 17 00:00:00 2001 From: Lubos Date: Tue, 17 Sep 2024 03:26:16 -0400 Subject: [PATCH 12/49] chore: continue work on OpenAPI 3.1.0 schema type --- .../openapi-ts/src/openApi/3.1/types/spec.ts | 389 +++++++++++++++--- 1 file changed, 336 insertions(+), 53 deletions(-) diff --git a/packages/openapi-ts/src/openApi/3.1/types/spec.ts b/packages/openapi-ts/src/openApi/3.1/types/spec.ts index 08503b7c0..3df9f0ff9 100644 --- a/packages/openapi-ts/src/openApi/3.1/types/spec.ts +++ b/packages/openapi-ts/src/openApi/3.1/types/spec.ts @@ -7,7 +7,7 @@ export interface OpenApiV3_1 { /** * An element to hold various schemas for the document. */ - components?: any; + components?: ComponentsObject; /** * Additional external documentation. */ @@ -27,8 +27,7 @@ export interface OpenApiV3_1 { /** * The available paths and operations for the API. */ - // paths?: any; - paths?: Record; + paths?: PathsObject; /** * A declaration of which security mechanisms can be used across the API. The list of values includes alternative security requirement objects that can be used. Only one of the security requirement objects need to be satisfied to authorize a request. Individual operations can override this definition. To make security optional, an empty security requirement (`{}`) can be included in the array. */ @@ -47,6 +46,247 @@ export interface OpenApiV3_1 { webhooks?: Record; } +/** + * A map of possible out-of band callbacks related to the parent operation. Each value in the map is a {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#path-item-object Path Item Object} that describes a set of requests that may be initiated by the API provider and the expected responses. The key value used to identify the path item object is an expression, evaluated at runtime, that identifies a URL to use for the callback operation. + * + * To describe incoming requests from the API provider independent from another API call, use the {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#oasWebhooks `webhooks`} field. + * + * This object MAY be extended with {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specification-extensions Specification Extensions}. + * + * TODO... + */ +export interface CallbackObject { + // TODO... +} + +/** + * Holds a set of reusable objects for different aspects of the OAS. All objects defined within the components object will have no effect on the API unless they are explicitly referenced from properties outside the components object. + * + * This object MAY be extended with {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specification-extensions Specification Extensions}. + * + * All the fixed fields declared above are objects that MUST use keys that match the regular expression: `^[a-zA-Z0-9\.\-_]+$`. + * + * TODO... + */ +export interface ComponentsObject { + /** + * An object to hold reusable {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#callback-object Callback Objects}. + */ + callbacks?: Record; + /** + * An object to hold reusable {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#example-object Example Objects}. + */ + examples?: Record; + /** + * An object to hold reusable {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#header-object Header Objects}. + */ + headers?: Record; + /** + * An object to hold reusable {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#link-object Link Objects}. + */ + links?: Record; + /** + * An object to hold reusable {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#parameter-object Parameter Objects}. + */ + parameters?: Record; + /** + * An object to hold reusable {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#path-item-object Path Item Object}. + */ + pathItems?: Record; + /** + * An object to hold reusable {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#request-body-object Request Body Objects}. + */ + requestBodies?: Record; + /** + * An object to hold reusable {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#response-object Response Objects}. + */ + responses?: Record; + /** + * An object to hold reusable {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#schema-object Schema Objects}. + */ + schemas?: Record; + /** + * An object to hold reusable {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#security-scheme-object Security Scheme Objects}. + */ + securitySchemes?: Record; +} + +/** + * Contact information for the exposed API. + * + * This object MAY be extended with {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specification-extensions Specification Extensions}. + * + * @example + * ```yaml + * name: API Support + * url: https://www.example.com/support + * email: support@example.com + * ``` + */ +export interface ContactObject { + /** + * The email address of the contact person/organization. This MUST be in the form of an email address. + */ + email?: string; + /** + * The identifying name of the contact person/organization. + */ + name?: string; + /** + * The URL pointing to the contact information. This MUST be in the form of a URL. + */ + url?: string; +} + +/** + * A single encoding definition applied to a single schema property. + * + * This object MAY be extended with {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specification-extensions Specification Extensions}. + * + * @example + * ```yaml + * requestBody: + * content: + * multipart/form-data: + * schema: + * type: object + * properties: + * id: + * # default is text/plain + * type: string + * format: uuid + * address: + * # default is application/json + * type: object + * properties: {} + * historyMetadata: + * # need to declare XML format! + * description: metadata in XML format + * type: object + * properties: {} + * profileImage: {} + * encoding: + * historyMetadata: + * # require XML Content-Type in utf-8 encoding + * contentType: application/xml; charset=utf-8 + * profileImage: + * # only accept png/jpeg + * contentType: image/png, image/jpeg + * headers: + * X-Rate-Limit-Limit: + * description: The number of allowed requests in the current period + * schema: + * type: integer + * ``` + */ +export interface EncodingObject { + /** + * Determines whether the parameter value SHOULD allow reserved characters, as defined by {@link https://tools.ietf.org/html/rfc3986#section-2.2 RFC3986} `:/?#[]@!$&'()*+,;=` to be included without percent-encoding. The default value is `false`. This property SHALL be ignored if the request body media type is not `application/x-www-form-urlencoded` or `multipart/form-data`. If a value is explicitly defined, then the value of {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#encodingContentType `contentType`} (implicit or explicit) SHALL be ignored. + */ + allowReserved?: boolean; + /** + * The Content-Type for encoding a specific property. Default value depends on the property type: for `object` - `application/json`; for `array` – the default is defined based on the inner type; for all other cases the default is `application/octet-stream`. The value can be a specific media type (e.g. `application/json`), a wildcard media type (e.g. `image/*`), or a comma-separated list of the two types. + */ + contentType?: string; + /** + * When this is true, property values of type `array` or `object` generate separate parameters for each value of the array, or key-value-pair of the map. For other types of properties this property has no effect. When {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#encodingStyle `style`} is `form`, the default value is `true`. For all other styles, the default value is `false`. This property SHALL be ignored if the request body media type is not `application/x-www-form-urlencoded` or `multipart/form-data`. If a value is explicitly defined, then the value of {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#encodingContentType `contentType`} (implicit or explicit) SHALL be ignored. + */ + explode?: boolean; + /** + * A map allowing additional information to be provided as headers, for example `Content-Disposition`. `Content-Type` is described separately and SHALL be ignored in this section. This property SHALL be ignored if the request body media type is not a `multipart`. + */ + headers?: Record; + /** + * Describes how a specific property value will be serialized depending on its type. See {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#parameter-object Parameter Object} for details on the {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#parameterStyle `style`} property. The behavior follows the same values as `query` parameters, including default values. This property SHALL be ignored if the request body media type is not `application/x-www-form-urlencoded` or `multipart/form-data`. If a value is explicitly defined, then the value of {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#encodingContentType `contentType`} (implicit or explicit) SHALL be ignored. + */ + style?: string; +} + +/** + * This object MAY be extended with {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specification-extensions Specification Extensions}. + * + * In all cases, the example value is expected to be compatible with the type schema of its associated value. Tooling implementations MAY choose to validate compatibility automatically, and reject the example value(s) if incompatible. + * + * Example Object Examples + * + * In a request body: + * + * @example + * ```yaml + * requestBody: + * content: + * 'application/json': + * schema: + * $ref: '#/components/schemas/Address' + * examples: + * foo: + * summary: A foo example + * value: {"foo": "bar"} + * bar: + * summary: A bar example + * value: {"bar": "baz"} + * 'application/xml': + * examples: + * xmlExample: + * summary: This is an example in XML + * externalValue: 'https://example.org/examples/address-example.xml' + * 'text/plain': + * examples: + * textExample: + * summary: This is a text example + * externalValue: 'https://foo.bar/examples/address-example.txt' + * ``` + * + * In a parameter: + * + * @example + * ```yaml + * parameters: + * - name: 'zipCode' + * in: 'query' + * schema: + * type: 'string' + * format: 'zip-code' + * examples: + * zip-example: + * $ref: '#/components/examples/zip-example' + * ``` + * + * In a response: + * + * @example + * ```yaml + * responses: + * '200': + * description: your car appointment has been booked + * content: + * application/json: + * schema: + * $ref: '#/components/schemas/SuccessResponse' + * examples: + * confirmation-success: + * $ref: '#/components/examples/confirmation-success' + * ``` + */ +export interface ExampleObject { + /** + * Long description for the example. {@link https://spec.commonmark.org/ CommonMark syntax} MAY be used for rich text representation. + */ + description?: string; + /** + * A URI that points to the literal example. This provides the capability to reference examples that cannot easily be included in JSON or YAML documents. The `value` field and `externalValue` field are mutually exclusive. See the rules for resolving {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#relative-references-in-uris Relative References}. + */ + externalValue?: string; + /** + * Short description for the example. + */ + summary?: string; + /** + * Embedded literal example. The `value` field and `externalValue` field are mutually exclusive. To represent examples of media types that cannot naturally represented in JSON or YAML, use a string value to contain the example, escaping where necessary. + */ + value?: unknown; +} + /** * Allows referencing an external resource for extended documentation. * @@ -58,7 +298,7 @@ export interface OpenApiV3_1 { * url: https://example.com * ``` */ -interface ExternalDocumentationObject { +export interface ExternalDocumentationObject { /** * A description of the target documentation. {@link https://spec.commonmark.org/ CommonMark syntax} MAY be used for rich text representation. */ @@ -83,7 +323,7 @@ interface ExternalDocumentationObject { * type: integer * ``` */ -interface HeaderObject extends Omit {} +export interface HeaderObject extends Omit {} /** * The object provides metadata about the API. The metadata MAY be used by the clients if needed, and MAY be presented in editing or documentation generation tools for convenience. @@ -106,7 +346,7 @@ interface HeaderObject extends Omit {} * version: 1.0.1 * ``` */ -interface InfoObject { +export interface InfoObject { /** * The contact information for the exposed API. */ @@ -137,33 +377,6 @@ interface InfoObject { version: string; } -/** - * Contact information for the exposed API. - * - * This object MAY be extended with {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specification-extensions Specification Extensions}. - * - * @example - * ```yaml - * name: API Support - * url: https://www.example.com/support - * email: support@example.com - * ``` - */ -interface ContactObject { - /** - * The email address of the contact person/organization. This MUST be in the form of an email address. - */ - email?: string; - /** - * The identifying name of the contact person/organization. - */ - name?: string; - /** - * The URL pointing to the contact information. This MUST be in the form of a URL. - */ - url?: string; -} - /** * License information for the exposed API. * @@ -175,7 +388,7 @@ interface ContactObject { * identifier: Apache-2.0 * ``` */ -interface LicenseObject { +export interface LicenseObject { /** * An {@link https://spdx.org/licenses/ SPDX} license expression for the API. The `identifier` field is mutually exclusive of the `url` field. */ @@ -190,6 +403,23 @@ interface LicenseObject { url?: string; } +/** + * The `Link object` represents a possible design-time link for a response. The presence of a link does not guarantee the caller's ability to successfully invoke it, rather it provides a known relationship and traversal mechanism between responses and other operations. + * + * Unlike _dynamic_ links (i.e. links provided in the response payload), the OAS linking mechanism does not require link information in the runtime response. + * + * For computing links, and providing instructions to execute them, a {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#runtime-expressions runtime expression} is used for accessing values in an operation and using them as parameters while invoking the linked operation. + * + * This object MAY be extended with {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specification-extensions Specification Extensions}. + * + * A linked operation MUST be identified using either an `operationRef` or `operationId`. In the case of an `operationId`, it MUST be unique and resolved in the scope of the OAS document. Because of the potential for name clashes, the `operationRef` syntax is preferred for OpenAPI documents with external references. + * + * TODO... + */ +export interface LinkObject { + // TODO... +} + /** * Each Media Type Object provides schema and examples for the media type identified by its key. * @@ -221,11 +451,11 @@ interface LicenseObject { * $ref: "#/components/examples/frog-example" * ``` */ -interface MediaTypeObject { +export interface MediaTypeObject { /** * A map between a property name and its encoding information. The key, being the property name, MUST exist in the schema as a property. The encoding object SHALL only apply to `requestBody` objects when the media type is `multipart` or `application/x-www-form-urlencoded`. */ - encoding?: Record; + encoding?: Record; /** * Example of the media type. The example object SHOULD be in the correct format as specified by the media type. The `example` field is mutually exclusive of the `examples` field. Furthermore, if referencing a `schema` which contains an example, the `example` value SHALL _override_ the example provided by the schema. */ @@ -233,11 +463,11 @@ interface MediaTypeObject { /** * Examples of the media type. Each example object SHOULD match the media type and specified schema if present. The `examples` field is mutually exclusive of the `example` field. Furthermore, if referencing a `schema` which contains an example, the `examples` value SHALL _override_ the example provided by the schema. */ - examples?: Record; + examples?: Record; /** * The schema defining the content of the request, response, or parameter. */ - schema?: any; + schema?: SchemaObject; } /** @@ -293,7 +523,7 @@ export interface OperationObject { /** * A map of possible out-of band callbacks related to the parent operation. The key is a unique identifier for the Callback Object. Each value in the map is a {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#callback-object Callback Object} that describes a request that may be initiated by the API provider and the expected responses. */ - callbacks?: Record; + callbacks?: Record; /** * Declares this operation to be deprecated. Consumers SHOULD refrain from usage of the declared operation. Default value is `false`. */ @@ -317,7 +547,7 @@ export interface OperationObject { /** * The request body applicable for this operation. The `requestBody` is fully supported in HTTP methods where the HTTP 1.1 specification {@link https://datatracker.ietf.org/doc/html/rfc7231#section-4.3.1 RFC7231} has explicitly defined semantics for request bodies. In other cases where the HTTP spec is vague (such as {@link https://datatracker.ietf.org/doc/html/rfc7231#section-4.3.1 GET}, {@link https://datatracker.ietf.org/doc/html/rfc7231#section-4.3.2 HEAD} and {@link https://datatracker.ietf.org/doc/html/rfc7231#section-4.3.5 DELETE}), `requestBody` is permitted but does not have well-defined semantics and SHOULD be avoided if possible. */ - requestBody?: any | ReferenceObject; + requestBody?: RequestBodyObject | ReferenceObject; /** * The list of possible responses as they are returned from executing this operation. */ @@ -437,7 +667,7 @@ export interface OperationObject { * type: number * ``` */ -interface ParameterObject { +export interface ParameterObject { /** * Sets the ability to pass empty-valued parameters. This is valid only for `query` parameters and allows sending a parameter with an empty value. Default value is `false`. If {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#parameterStyle `style`} is used, and if behavior is `n/a` (cannot be serialized), the value of `allowEmptyValue` SHALL be ignored. Use of this property is NOT RECOMMENDED, as it is likely to be removed in a later revision. */ @@ -449,7 +679,7 @@ interface ParameterObject { /** * A map containing the representations for the parameter. The key is the media type and the value describes it. The map MUST only contain one entry. */ - content?: Record; + content?: Record; /** * Specifies that a parameter is deprecated and SHOULD be transitioned out of usage. Default value is `false`. */ @@ -465,7 +695,7 @@ interface ParameterObject { /** * Examples of the parameter's potential value. Each example SHOULD contain a value in the correct format as specified in the parameter encoding. The `examples` field is mutually exclusive of the `example` field. Furthermore, if referencing a `schema` that contains an example, the `examples` value SHALL _override_ the example provided by the schema. */ - examples?: Record; + examples?: Record; /** * When this is true, parameter values of type `array` or `object` generate separate parameters for each value of the array or key-value pair of the map. For other types of parameters this property has no effect. When {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#parameterStyle `style`} is `form`, the default value is `true`. For all other styles, the default value is `false`. */ @@ -488,7 +718,7 @@ interface ParameterObject { /** * The schema defining the type used for the parameter. */ - schema?: any; + schema?: SchemaObject; /** * Describes how the parameter value will be serialized depending on the type of the parameter value. Default values (based on value of `in`): for `query` - `form`; for `path` - `simple`; for `header` - `simple`; for `cookie` - `form`. */ @@ -540,7 +770,7 @@ interface ParameterObject { * style: simple * ``` */ -interface PathItemObject { +export interface PathItemObject { /** * Allows for a referenced definition of this path item. The referenced structure MUST be in the form of a {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#path-item-object Path Item Object}. In case a Path Item Object field appears both in the defined object and the referenced object, the behavior is undefined. See the rules for resolving {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#relative-references-in-uris Relative References}. */ @@ -595,6 +825,20 @@ interface PathItemObject { trace?: OperationObject; } +/** + * Holds the relative paths to the individual endpoints and their operations. The path is appended to the URL from the {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#server-object `Server Object`} in order to construct the full URL. The Paths MAY be empty, due to {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#security-filtering Access Control List (ACL) constraints}. + * + * This object MAY be extended with {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specification-extensions Specification Extensions}. + * + * TODO... + */ +export interface PathsObject { + /** + * A relative path to an individual endpoint. The field name MUST begin with a forward slash (`/`). The path is **appended** (no relative URL resolution) to the expanded URL from the {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#server-object `Server Object`}'s `url` field in order to construct the full URL. {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#path-templating Path templating} is allowed. When matching URLs, concrete (non-templated) paths would be matched before their templated counterparts. Templated paths with the same hierarchy but different templated names MUST NOT exist as they are identical. In case of ambiguous matching, it's up to the tooling to decide which one to use. + */ + [path: `/${string}`]: PathItemObject; +} + /** * A simple object to allow referencing other components in the OpenAPI document, internally and externally. * @@ -627,7 +871,7 @@ interface PathItemObject { * $ref: definitions.yaml#/Pet * ``` */ -interface ReferenceObject { +export interface ReferenceObject { /** * **REQUIRED**. The reference identifier. This MUST be in the form of a URI. */ @@ -642,6 +886,17 @@ interface ReferenceObject { summary?: string; } +/** + * Describes a single request body. + * + * This object MAY be extended with {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specification-extensions Specification Extensions}. + * + * TODO... + */ +export interface RequestBodyObject { + // TODO... +} + /** * Describes a single response from an API Operation, including design-time, static `links` to operations based on the response. * @@ -703,7 +958,7 @@ interface ReferenceObject { * description: object created * ``` */ -interface ResponseObject { +export interface ResponseObject { /** * A map containing descriptions of potential response payloads. The key is a media type or {@link https://datatracker.ietf.org/doc/html/rfc7231#appendix-D media type range} and the value describes it. For responses that match multiple keys, only the most specific key is applicable. e.g. text/plain overrides text/* */ @@ -719,7 +974,7 @@ interface ResponseObject { /** * A map of operations links that can be followed from the response. The key of the map is a short name for the link, following the naming constraints of the names for {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#components-object Component Objects}. */ - links?: Record; + links?: Record; } /** @@ -751,7 +1006,7 @@ interface ResponseObject { * $ref: '#/components/schemas/ErrorModel' * ``` */ -interface ResponsesObject { +export interface ResponsesObject { /** * Any {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#http-status-codes HTTP status code} can be used as the property name, but only one property per code, to describe the expected response for that HTTP status code. This field MUST be enclosed in quotation marks (for example, "200") for compatibility between JSON and YAML. To define a range of response codes, this field MAY contain the uppercase wildcard character `X`. For example, `2XX` represents all response codes between `[200-299]`. Only the following range definitions are allowed: `1XX`, `2XX`, `3XX`, `4XX`, and `5XX`. If a response is defined using an explicit code, the explicit code definition takes precedence over the range definition for that code. */ @@ -762,6 +1017,21 @@ interface ResponsesObject { default?: ResponseObject | ReferenceObject; } +/** + * The Schema Object allows the definition of input and output data types. These types can be objects, but also primitives and arrays. This object is a superset of the {@link https://tools.ietf.org/html/draft-bhutton-json-schema-00 JSON Schema Specification Draft 2020-12}. + * + * For more information about the properties, see {@link https://tools.ietf.org/html/draft-bhutton-json-schema-00 JSON Schema Core} and {@link https://tools.ietf.org/html/draft-bhutton-json-schema-validation-00 JSON Schema Validation}. + * + * Unless stated otherwise, the property definitions follow those of JSON Schema and do not add any additional semantics. Where JSON Schema indicates that behavior is defined by the application (e.g. for annotations), OAS also defers the definition of semantics to the application consuming the OpenAPI document. + * + * **Properties** + * + * TODO... + */ +export interface SchemaObject { + // TODO... +} + /** * Lists the required security schemes to execute this operation. The name used for each property MUST correspond to a security scheme declared in the {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#componentsSecuritySchemes Security Schemes} under the {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#components-object Components Object}. * @@ -796,13 +1066,26 @@ interface ResponsesObject { * - read:pets * ``` */ -interface SecurityRequirementObject { +export interface SecurityRequirementObject { /** * Each name MUST correspond to a security scheme which is declared in the {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#componentsSecuritySchemes Security Schemes} under the {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#components-object Components Object}. If the security scheme is of type `"oauth2"` or `"openIdConnect"`, then the value is a list of scope names required for the execution, and the list MAY be empty if authorization does not require a specified scope. For other security scheme types, the array MAY contain a list of role names which are required for the execution, but are not otherwise defined or exchanged in-band. */ [name: string]: ReadonlyArray; } +/** + * Defines a security scheme that can be used by the operations. + * + * Supported schemes are HTTP authentication, an API key (either as a header, a cookie parameter or as a query parameter), mutual TLS (use of a client certificate), OAuth2's common flows (implicit, password, client credentials and authorization code) as defined in {@link https://tools.ietf.org/html/rfc6749 RFC6749}, and {@link https://tools.ietf.org/html/draft-ietf-oauth-discovery-06 OpenID Connect Discovery}. Please note that as of 2020, the implicit flow is about to be deprecated by {@link https://tools.ietf.org/html/draft-ietf-oauth-security-topics OAuth 2.0 Security Best Current Practice}. Recommended for most use case is Authorization Code Grant flow with PKCE. + * + * This object MAY be extended with {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specification-extensions Specification Extensions}. + * + * TODO... + */ +export interface SecuritySchemeObject { + // TODO... +} + /** * An object representing a Server. * @@ -814,7 +1097,7 @@ interface SecurityRequirementObject { * description: Development server * ``` */ -interface ServerObject { +export interface ServerObject { /** * An optional string describing the host designated by the URL. {@link https://spec.commonmark.org/ CommonMark syntax} MAY be used for rich text representation. */ @@ -834,7 +1117,7 @@ interface ServerObject { * * This object MAY be extended with {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specification-extensions Specification Extensions}. */ -interface ServerVariableObject { +export interface ServerVariableObject { /** * **REQUIRED**. The default value to use for substitution, which SHALL be sent if an alternate value is _not_ supplied. Note this behavior is different than the {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#schema-object Schema Object's} treatment of default values, because in those cases parameter values are optional. If the {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#serverVariableEnum `enum`} is defined, the value MUST exist in the enum's values. */ @@ -860,7 +1143,7 @@ interface ServerVariableObject { * description: Pets operations * ``` */ -interface TagObject { +export interface TagObject { /** * A description for the tag. {@link https://spec.commonmark.org/ CommonMark syntax} MAY be used for rich text representation. */ -- 2.51.2 From 6922b5a3ebe67190d2034ea79674706a5e80e818 Mon Sep 17 00:00:00 2001 From: Lubos Date: Tue, 17 Sep 2024 03:50:12 -0400 Subject: [PATCH 13/49] fix: throw error on invalid client value --- .changeset/fair-mangos-talk.md | 5 +++ packages/openapi-ts/src/index.ts | 7 ++++- .../src/openApi/3.1/parser/index.ts | 4 +-- packages/openapi-ts/src/types/config.ts | 20 ++++++------ packages/openapi-ts/test/bin.spec.ts | 31 ++++++++++++++++++- packages/openapi-ts/test/sample.cjs | 23 +++++++------- 6 files changed, 66 insertions(+), 24 deletions(-) create mode 100644 .changeset/fair-mangos-talk.md diff --git a/.changeset/fair-mangos-talk.md b/.changeset/fair-mangos-talk.md new file mode 100644 index 000000000..76b070953 --- /dev/null +++ b/.changeset/fair-mangos-talk.md @@ -0,0 +1,5 @@ +--- +'@hey-api/openapi-ts': patch +--- + +fix: throw error on invalid client value diff --git a/packages/openapi-ts/src/index.ts b/packages/openapi-ts/src/index.ts index 09de7f97e..23ee28dd1 100644 --- a/packages/openapi-ts/src/index.ts +++ b/packages/openapi-ts/src/index.ts @@ -8,6 +8,7 @@ import { parse, parseExperimental } from './openApi'; import { defaultPluginConfigs } from './plugins'; import type { Client } from './types/client'; import type { ClientConfig, Config, UserConfig } from './types/config'; +import { CLIENTS } from './types/config'; import { getConfig, isStandaloneClient, setConfig } from './utils/config'; import { getOpenApiSpec } from './utils/getOpenApiSpec'; import { registerHandlebarTemplates } from './utils/handlebars'; @@ -107,7 +108,7 @@ const logClientMessage = () => { const getClient = (userConfig: ClientConfig): Config['client'] => { let client: Config['client'] = { bundle: false, - name: '', + name: '' as Config['client']['name'], }; if (typeof userConfig.client === 'string') { client.name = userConfig.client; @@ -268,6 +269,10 @@ const initConfigs = async (userConfig: UserConfig): Promise => { const client = getClient(userConfig); + if (!CLIENTS.includes(client.name)) { + throw new Error('🚫 invalid client - select a valid client value'); + } + if (!useOptions) { console.warn( '❗️ Deprecation warning: useOptions set to false. This setting will be removed in future versions. Please migrate useOptions to true https://heyapi.vercel.app/openapi-ts/migrating.html#v0-27-38', diff --git a/packages/openapi-ts/src/openApi/3.1/parser/index.ts b/packages/openapi-ts/src/openApi/3.1/parser/index.ts index 0b68141a9..71a34194b 100644 --- a/packages/openapi-ts/src/openApi/3.1/parser/index.ts +++ b/packages/openapi-ts/src/openApi/3.1/parser/index.ts @@ -1,11 +1,11 @@ -import type { OpenApiV3_1 } from '../types/spec'; +import type { OpenApiV3_1, PathsObject } from '../types/spec'; import { parseOperation } from './operation'; export const parseV3_1 = (spec: OpenApiV3_1) => { const operationIds = new Map(); for (const path in spec.paths) { - const pathItem = spec.paths[path]; + const pathItem = spec.paths[path as keyof PathsObject]; if (pathItem.delete) { parseOperation({ diff --git a/packages/openapi-ts/src/types/config.ts b/packages/openapi-ts/src/types/config.ts index 9ed4919fd..e58230d33 100644 --- a/packages/openapi-ts/src/types/config.ts +++ b/packages/openapi-ts/src/types/config.ts @@ -3,15 +3,17 @@ import type { Plugins } from '../plugins/'; import type { Operation } from '../types/client'; import type { ExtractArrayOfObjects } from './utils'; -type Client = - | '@hey-api/client-axios' - | '@hey-api/client-fetch' - | 'legacy/angular' - | 'legacy/axios' - | 'legacy/fetch' - | 'legacy/node' - | 'legacy/xhr' - | ''; +export const CLIENTS = [ + '@hey-api/client-axios', + '@hey-api/client-fetch', + 'legacy/angular', + 'legacy/axios', + 'legacy/fetch', + 'legacy/node', + 'legacy/xhr', +] as const; + +type Client = (typeof CLIENTS)[number]; export interface ClientConfig { /** diff --git a/packages/openapi-ts/test/bin.spec.ts b/packages/openapi-ts/test/bin.spec.ts index bca14f184..01d317077 100755 --- a/packages/openapi-ts/test/bin.spec.ts +++ b/packages/openapi-ts/test/bin.spec.ts @@ -143,10 +143,24 @@ describe('bin', () => { expect(result.stderr.toString()).toContain('Duplicate operationId'); }); - it('throws error without parameters', () => { + it('throws error without input', () => { const result = sync('node', ['./bin/index.cjs', '--dry-run', 'true']); expect(result.stdout.toString()).toBe(''); expect(result.stderr.toString()).toContain('Unexpected error occurred'); + expect(result.stderr.toString()).toContain('missing input'); + }); + + it('throws error without output', () => { + const result = sync('node', [ + './bin/index.cjs', + '--input', + './test/spec/v3.json', + '--dry-run', + 'true', + ]); + expect(result.stdout.toString()).toBe(''); + expect(result.stderr.toString()).toContain('Unexpected error occurred'); + expect(result.stderr.toString()).toContain('missing output'); }); it('throws error with wrong parameters', () => { @@ -166,6 +180,21 @@ describe('bin', () => { ); }); + it('throws error with wrong client', () => { + const result = sync('node', [ + './bin/index.cjs', + '--input', + './test/spec/v3.json', + '--output', + './test/generated/bin', + '--dry-run', + 'true', + ]); + expect(result.stdout.toString()).toBe(''); + expect(result.stderr.toString()).toContain('Unexpected error occurred'); + expect(result.stderr.toString()).toContain('invalid client'); + }); + it('displays help', () => { const result = sync('node', [ './bin/index.cjs', diff --git a/packages/openapi-ts/test/sample.cjs b/packages/openapi-ts/test/sample.cjs index 825bc9233..3ab0bbc31 100644 --- a/packages/openapi-ts/test/sample.cjs +++ b/packages/openapi-ts/test/sample.cjs @@ -6,10 +6,11 @@ const main = async () => { client: { // bundle: true, // name: '@hey-api/client-axios', - name: '@hey-api/client-fetch', + // name: '@hey-api/client-fetch', + name: 'foooooo', }, // debug: true, - experimental_parser: true, + // experimental_parser: true, // input: './test/spec/v3-transforms.json', input: './test/spec/v3.json', // input: './test/spec/v2.json', @@ -18,15 +19,15 @@ const main = async () => { output: { path: './test/generated/sample/', }, - plugins: [ - { - // infiniteQueryOptions: false, - // mutationOptions: false, - name: '@tanstack/react-query', - // queryOptions: false, - }, - // '@hey-api/services', - ], + // plugins: [ + // { + // // infiniteQueryOptions: false, + // // mutationOptions: false, + // name: '@tanstack/react-query', + // // queryOptions: false, + // }, + // // '@hey-api/services', + // ], schemas: { export: false, }, -- 2.51.2 From 266029a668b654d1b5967c642f03f2e4893d77a3 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 17 Sep 2024 07:58:42 +0000 Subject: [PATCH 14/49] Version Packages --- .changeset/fair-mangos-talk.md | 5 ----- .changeset/tall-bees-cheer.md | 5 ----- examples/openapi-ts-fetch/CHANGELOG.md | 7 +++++++ examples/openapi-ts-fetch/package.json | 2 +- examples/openapi-ts-tanstack-react-query/CHANGELOG.md | 7 +++++++ examples/openapi-ts-tanstack-react-query/package.json | 2 +- examples/openapi-ts-tanstack-svelte-query/CHANGELOG.md | 7 +++++++ examples/openapi-ts-tanstack-svelte-query/package.json | 2 +- examples/openapi-ts-tanstack-vue-query/CHANGELOG.md | 7 +++++++ examples/openapi-ts-tanstack-vue-query/package.json | 2 +- packages/client-fetch/CHANGELOG.md | 6 ++++++ packages/client-fetch/package.json | 2 +- packages/openapi-ts/CHANGELOG.md | 6 ++++++ packages/openapi-ts/package.json | 2 +- 14 files changed, 46 insertions(+), 16 deletions(-) delete mode 100644 .changeset/fair-mangos-talk.md delete mode 100644 .changeset/tall-bees-cheer.md diff --git a/.changeset/fair-mangos-talk.md b/.changeset/fair-mangos-talk.md deleted file mode 100644 index 76b070953..000000000 --- a/.changeset/fair-mangos-talk.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@hey-api/openapi-ts': patch ---- - -fix: throw error on invalid client value diff --git a/.changeset/tall-bees-cheer.md b/.changeset/tall-bees-cheer.md deleted file mode 100644 index 82610c181..000000000 --- a/.changeset/tall-bees-cheer.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@hey-api/client-fetch': minor ---- - -feat: Function to clear and check if exist an interceptor in client-fetch diff --git a/examples/openapi-ts-fetch/CHANGELOG.md b/examples/openapi-ts-fetch/CHANGELOG.md index b38167715..ff4bb90a5 100644 --- a/examples/openapi-ts-fetch/CHANGELOG.md +++ b/examples/openapi-ts-fetch/CHANGELOG.md @@ -1,5 +1,12 @@ # @example/openapi-ts-fetch +## 0.0.22 + +### Patch Changes + +- Updated dependencies [[`7ebc1d4`](https://github.com/hey-api/openapi-ts/commit/7ebc1d44af74db2522219d71d240325f6bc5689d)]: + - @hey-api/client-fetch@0.3.0 + ## 0.0.21 ### Patch Changes diff --git a/examples/openapi-ts-fetch/package.json b/examples/openapi-ts-fetch/package.json index 2fddae498..7274a2e61 100644 --- a/examples/openapi-ts-fetch/package.json +++ b/examples/openapi-ts-fetch/package.json @@ -1,7 +1,7 @@ { "name": "@example/openapi-ts-fetch", "private": true, - "version": "0.0.21", + "version": "0.0.22", "type": "module", "scripts": { "build": "tsc && vite build", diff --git a/examples/openapi-ts-tanstack-react-query/CHANGELOG.md b/examples/openapi-ts-tanstack-react-query/CHANGELOG.md index b3c7a08df..e6747b20d 100644 --- a/examples/openapi-ts-tanstack-react-query/CHANGELOG.md +++ b/examples/openapi-ts-tanstack-react-query/CHANGELOG.md @@ -1,5 +1,12 @@ # @example/openapi-ts-tanstack-react-query +## 0.0.4 + +### Patch Changes + +- Updated dependencies [[`7ebc1d4`](https://github.com/hey-api/openapi-ts/commit/7ebc1d44af74db2522219d71d240325f6bc5689d)]: + - @hey-api/client-fetch@0.3.0 + ## 0.0.3 ### Patch Changes diff --git a/examples/openapi-ts-tanstack-react-query/package.json b/examples/openapi-ts-tanstack-react-query/package.json index 8b7218428..52788e90a 100644 --- a/examples/openapi-ts-tanstack-react-query/package.json +++ b/examples/openapi-ts-tanstack-react-query/package.json @@ -1,7 +1,7 @@ { "name": "@example/openapi-ts-tanstack-react-query", "private": true, - "version": "0.0.3", + "version": "0.0.4", "type": "module", "scripts": { "build": "tsc && vite build", diff --git a/examples/openapi-ts-tanstack-svelte-query/CHANGELOG.md b/examples/openapi-ts-tanstack-svelte-query/CHANGELOG.md index ff56be91b..e96ff3fae 100644 --- a/examples/openapi-ts-tanstack-svelte-query/CHANGELOG.md +++ b/examples/openapi-ts-tanstack-svelte-query/CHANGELOG.md @@ -1,5 +1,12 @@ # @example/openapi-ts-tanstack-svelte-query +## 0.0.4 + +### Patch Changes + +- Updated dependencies [[`7ebc1d4`](https://github.com/hey-api/openapi-ts/commit/7ebc1d44af74db2522219d71d240325f6bc5689d)]: + - @hey-api/client-fetch@0.3.0 + ## 0.0.3 ### Patch Changes diff --git a/examples/openapi-ts-tanstack-svelte-query/package.json b/examples/openapi-ts-tanstack-svelte-query/package.json index ae9aac44b..68723ed74 100644 --- a/examples/openapi-ts-tanstack-svelte-query/package.json +++ b/examples/openapi-ts-tanstack-svelte-query/package.json @@ -1,7 +1,7 @@ { "name": "@example/openapi-ts-tanstack-svelte-query", "private": true, - "version": "0.0.3", + "version": "0.0.4", "type": "module", "scripts": { "build": "vite build", diff --git a/examples/openapi-ts-tanstack-vue-query/CHANGELOG.md b/examples/openapi-ts-tanstack-vue-query/CHANGELOG.md index c7c2b1cdd..285265765 100644 --- a/examples/openapi-ts-tanstack-vue-query/CHANGELOG.md +++ b/examples/openapi-ts-tanstack-vue-query/CHANGELOG.md @@ -1,5 +1,12 @@ # @example/openapi-ts-tanstack-vue-query +## 0.0.4 + +### Patch Changes + +- Updated dependencies [[`7ebc1d4`](https://github.com/hey-api/openapi-ts/commit/7ebc1d44af74db2522219d71d240325f6bc5689d)]: + - @hey-api/client-fetch@0.3.0 + ## 0.0.3 ### Patch Changes diff --git a/examples/openapi-ts-tanstack-vue-query/package.json b/examples/openapi-ts-tanstack-vue-query/package.json index 6d2493167..381a0c811 100644 --- a/examples/openapi-ts-tanstack-vue-query/package.json +++ b/examples/openapi-ts-tanstack-vue-query/package.json @@ -1,7 +1,7 @@ { "name": "@example/openapi-ts-tanstack-vue-query", "private": true, - "version": "0.0.3", + "version": "0.0.4", "type": "module", "scripts": { "build-only": "vite build", diff --git a/packages/client-fetch/CHANGELOG.md b/packages/client-fetch/CHANGELOG.md index 078b0ed1f..08293ea7f 100644 --- a/packages/client-fetch/CHANGELOG.md +++ b/packages/client-fetch/CHANGELOG.md @@ -1,5 +1,11 @@ # @hey-api/client-fetch +## 0.3.0 + +### Minor Changes + +- [#1011](https://github.com/hey-api/openapi-ts/pull/1011) [`7ebc1d4`](https://github.com/hey-api/openapi-ts/commit/7ebc1d44af74db2522219d71d240325f6bc5689d) Thanks [@goltra](https://github.com/goltra)! - feat: Function to clear and check if exist an interceptor in client-fetch + ## 0.2.4 ### Patch Changes diff --git a/packages/client-fetch/package.json b/packages/client-fetch/package.json index 6ff2a98d1..c63d0fe4d 100644 --- a/packages/client-fetch/package.json +++ b/packages/client-fetch/package.json @@ -1,6 +1,6 @@ { "name": "@hey-api/client-fetch", - "version": "0.2.4", + "version": "0.3.0", "type": "module", "description": "Type-safe Fetch API client for your @hey-api/openapi-ts types", "homepage": "https://heyapi.vercel.app/", diff --git a/packages/openapi-ts/CHANGELOG.md b/packages/openapi-ts/CHANGELOG.md index f8a8c7702..db5569f0d 100644 --- a/packages/openapi-ts/CHANGELOG.md +++ b/packages/openapi-ts/CHANGELOG.md @@ -1,5 +1,11 @@ # @hey-api/openapi-ts +## 0.53.1 + +### Patch Changes + +- [#1050](https://github.com/hey-api/openapi-ts/pull/1050) [`6922b5a`](https://github.com/hey-api/openapi-ts/commit/6922b5a3ebe67190d2034ea79674706a5e80e818) Thanks [@mrlubos](https://github.com/mrlubos)! - fix: throw error on invalid client value + ## 0.53.0 ### Minor Changes diff --git a/packages/openapi-ts/package.json b/packages/openapi-ts/package.json index 79a54fef2..3b60c55c4 100644 --- a/packages/openapi-ts/package.json +++ b/packages/openapi-ts/package.json @@ -1,6 +1,6 @@ { "name": "@hey-api/openapi-ts", - "version": "0.53.0", + "version": "0.53.1", "type": "module", "description": "Turn your OpenAPI specification into a beautiful TypeScript client", "homepage": "https://heyapi.vercel.app/", -- 2.51.2 From 7ae2b1db047f3b6efe917a8b43ac7c851fb86c8f Mon Sep 17 00:00:00 2001 From: Lubos Date: Wed, 18 Sep 2024 07:30:47 -0400 Subject: [PATCH 15/49] fix: allow responseTransformer property with body and headers --- .changeset/fluffy-candles-perform.md | 6 ++++++ packages/client-axios/src/types.ts | 10 +++------- packages/client-fetch/src/types.ts | 10 +++------- .../v3-hey-api-client-axios-bundle/core/types.ts.snap | 10 +++------- .../core/types.ts.snap | 10 +++------- .../v3-hey-api-client-fetch-bundle/core/types.ts.snap | 10 +++------- .../core/types.ts.snap | 10 +++------- 7 files changed, 24 insertions(+), 42 deletions(-) create mode 100644 .changeset/fluffy-candles-perform.md diff --git a/.changeset/fluffy-candles-perform.md b/.changeset/fluffy-candles-perform.md new file mode 100644 index 000000000..f74b02d05 --- /dev/null +++ b/.changeset/fluffy-candles-perform.md @@ -0,0 +1,6 @@ +--- +'@hey-api/client-axios': patch +'@hey-api/client-fetch': patch +--- + +fix: allow responseTransformer property with body and headers diff --git a/packages/client-axios/src/types.ts b/packages/client-axios/src/types.ts index e1f2719d9..98db41f58 100644 --- a/packages/client-axios/src/types.ts +++ b/packages/client-axios/src/types.ts @@ -147,16 +147,12 @@ export type Options< ThrowOnError extends boolean = boolean, > = T extends { body?: any } ? T extends { headers?: any } - ? OmitKeys< - OptionsBase, - 'body' | 'headers' | 'responseTransformer' - > & - T - : OmitKeys, 'body' | 'responseTransformer'> & + ? OmitKeys, 'body' | 'headers'> & T + : OmitKeys, 'body'> & T & Pick, 'headers'> : T extends { headers?: any } - ? OmitKeys, 'headers' | 'responseTransformer'> & + ? OmitKeys, 'headers'> & T & Pick, 'body'> : OptionsBase & T; diff --git a/packages/client-fetch/src/types.ts b/packages/client-fetch/src/types.ts index fab60b8f4..d53ca45da 100644 --- a/packages/client-fetch/src/types.ts +++ b/packages/client-fetch/src/types.ts @@ -184,16 +184,12 @@ export type Options< ThrowOnError extends boolean = boolean, > = T extends { body?: any } ? T extends { headers?: any } - ? OmitKeys< - OptionsBase, - 'body' | 'headers' | 'responseTransformer' - > & - T - : OmitKeys, 'body' | 'responseTransformer'> & + ? OmitKeys, 'body' | 'headers'> & T + : OmitKeys, 'body'> & T & Pick, 'headers'> : T extends { headers?: any } - ? OmitKeys, 'headers' | 'responseTransformer'> & + ? OmitKeys, 'headers'> & T & Pick, 'body'> : OptionsBase & T; diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle/core/types.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle/core/types.ts.snap index e1f2719d9..98db41f58 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle/core/types.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle/core/types.ts.snap @@ -147,16 +147,12 @@ export type Options< ThrowOnError extends boolean = boolean, > = T extends { body?: any } ? T extends { headers?: any } - ? OmitKeys< - OptionsBase, - 'body' | 'headers' | 'responseTransformer' - > & - T - : OmitKeys, 'body' | 'responseTransformer'> & + ? OmitKeys, 'body' | 'headers'> & T + : OmitKeys, 'body'> & T & Pick, 'headers'> : T extends { headers?: any } - ? OmitKeys, 'headers' | 'responseTransformer'> & + ? OmitKeys, 'headers'> & T & Pick, 'body'> : OptionsBase & T; diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle_transform/core/types.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle_transform/core/types.ts.snap index e1f2719d9..98db41f58 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle_transform/core/types.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle_transform/core/types.ts.snap @@ -147,16 +147,12 @@ export type Options< ThrowOnError extends boolean = boolean, > = T extends { body?: any } ? T extends { headers?: any } - ? OmitKeys< - OptionsBase, - 'body' | 'headers' | 'responseTransformer' - > & - T - : OmitKeys, 'body' | 'responseTransformer'> & + ? OmitKeys, 'body' | 'headers'> & T + : OmitKeys, 'body'> & T & Pick, 'headers'> : T extends { headers?: any } - ? OmitKeys, 'headers' | 'responseTransformer'> & + ? OmitKeys, 'headers'> & T & Pick, 'body'> : OptionsBase & T; diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle/core/types.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle/core/types.ts.snap index fab60b8f4..d53ca45da 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle/core/types.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle/core/types.ts.snap @@ -184,16 +184,12 @@ export type Options< ThrowOnError extends boolean = boolean, > = T extends { body?: any } ? T extends { headers?: any } - ? OmitKeys< - OptionsBase, - 'body' | 'headers' | 'responseTransformer' - > & - T - : OmitKeys, 'body' | 'responseTransformer'> & + ? OmitKeys, 'body' | 'headers'> & T + : OmitKeys, 'body'> & T & Pick, 'headers'> : T extends { headers?: any } - ? OmitKeys, 'headers' | 'responseTransformer'> & + ? OmitKeys, 'headers'> & T & Pick, 'body'> : OptionsBase & T; diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle_transform/core/types.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle_transform/core/types.ts.snap index fab60b8f4..d53ca45da 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle_transform/core/types.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle_transform/core/types.ts.snap @@ -184,16 +184,12 @@ export type Options< ThrowOnError extends boolean = boolean, > = T extends { body?: any } ? T extends { headers?: any } - ? OmitKeys< - OptionsBase, - 'body' | 'headers' | 'responseTransformer' - > & - T - : OmitKeys, 'body' | 'responseTransformer'> & + ? OmitKeys, 'body' | 'headers'> & T + : OmitKeys, 'body'> & T & Pick, 'headers'> : T extends { headers?: any } - ? OmitKeys, 'headers' | 'responseTransformer'> & + ? OmitKeys, 'headers'> & T & Pick, 'body'> : OptionsBase & T; -- 2.51.2 From 8d66c085cf81e0e166c3e172ce319d5e2d4002bf Mon Sep 17 00:00:00 2001 From: Lubos Date: Wed, 18 Sep 2024 08:38:14 -0400 Subject: [PATCH 16/49] fix: handle colon in operation path --- .changeset/chatty-deers-appear.md | 5 +++ .../src/openApi/common/interfaces/config.ts | 2 +- .../src/openApi/v2/parser/getOperations.ts | 19 +++++----- .../src/openApi/v3/parser/getOperations.ts | 19 +++++----- packages/openapi-ts/src/utils/parse.ts | 6 +-- .../services.gen.ts.snap | 7 +++- .../types.gen.ts.snap | 13 +++++++ .../services.gen.ts.snap | 9 ++++- .../types.gen.ts.snap | 13 +++++++ .../@tanstack/react-query.gen.ts.snap | 20 +++++++++- .../services.gen.ts.snap | 7 +++- .../types.gen.ts.snap | 13 +++++++ .../@tanstack/solid-query.gen.ts.snap | 20 +++++++++- .../services.gen.ts.snap | 7 +++- .../types.gen.ts.snap | 13 +++++++ .../@tanstack/svelte-query.gen.ts.snap | 20 +++++++++- .../services.gen.ts.snap | 7 +++- .../types.gen.ts.snap | 13 +++++++ .../@tanstack/vue-query.gen.ts.snap | 20 +++++++++- .../services.gen.ts.snap | 7 +++- .../types.gen.ts.snap | 13 +++++++ .../services.gen.ts.snap | 7 +++- .../v3-hey-api-client-axios/types.gen.ts.snap | 13 +++++++ .../services.gen.ts.snap | 7 +++- .../types.gen.ts.snap | 13 +++++++ .../services.gen.ts.snap | 9 ++++- .../types.gen.ts.snap | 13 +++++++ .../@tanstack/react-query.gen.ts.snap | 20 +++++++++- .../services.gen.ts.snap | 7 +++- .../types.gen.ts.snap | 13 +++++++ .../@tanstack/solid-query.gen.ts.snap | 20 +++++++++- .../services.gen.ts.snap | 7 +++- .../types.gen.ts.snap | 13 +++++++ .../@tanstack/svelte-query.gen.ts.snap | 20 +++++++++- .../services.gen.ts.snap | 7 +++- .../types.gen.ts.snap | 13 +++++++ .../@tanstack/vue-query.gen.ts.snap | 20 +++++++++- .../services.gen.ts.snap | 7 +++- .../types.gen.ts.snap | 13 +++++++ .../services.gen.ts.snap | 7 +++- .../v3-hey-api-client-fetch/types.gen.ts.snap | 13 +++++++ .../v3-types-PascalCase/types.gen.ts.snap | 24 ++++++++++++ .../test/generated/v3/services.gen.ts.snap | 21 ++++++++++- .../test/generated/v3/types.gen.ts.snap | 9 +++++ .../generated/v3_angular/services.gen.ts.snap | 21 ++++++++++- .../generated/v3_angular/types.gen.ts.snap | 9 +++++ .../services.gen.ts.snap | 19 +++++++++- .../types.gen.ts.snap | 9 +++++ .../generated/v3_axios/services.gen.ts.snap | 21 ++++++++++- .../test/generated/v3_axios/types.gen.ts.snap | 9 +++++ .../generated/v3_client/services.gen.ts.snap | 21 ++++++++++- .../generated/v3_client/types.gen.ts.snap | 9 +++++ .../test/generated/v3_date/types.gen.ts.snap | 24 ++++++++++++ .../v3_enums_typescript/services.gen.ts.snap | 21 ++++++++++- .../v3_enums_typescript/types.gen.ts.snap | 9 +++++ .../services.gen.ts.snap | 21 ++++++++++- .../types.gen.ts.snap | 9 +++++ .../generated/v3_node/services.gen.ts.snap | 21 ++++++++++- .../test/generated/v3_node/types.gen.ts.snap | 9 +++++ .../v3_tree_shakeable/services.gen.ts.snap | 19 +++++++++- .../v3_tree_shakeable/types.gen.ts.snap | 9 +++++ .../test/generated/v3_types/types.gen.ts.snap | 24 ++++++++++++ .../generated/v3_xhr/services.gen.ts.snap | 21 ++++++++++- .../test/generated/v3_xhr/types.gen.ts.snap | 9 +++++ packages/openapi-ts/test/sample.cjs | 7 ++-- packages/openapi-ts/test/spec/v3.json | 37 +++++++++++++++++++ 66 files changed, 838 insertions(+), 69 deletions(-) create mode 100644 .changeset/chatty-deers-appear.md diff --git a/.changeset/chatty-deers-appear.md b/.changeset/chatty-deers-appear.md new file mode 100644 index 000000000..fbfc5c64d --- /dev/null +++ b/.changeset/chatty-deers-appear.md @@ -0,0 +1,5 @@ +--- +'@hey-api/openapi-ts': patch +--- + +fix: handle colon in operation path diff --git a/packages/openapi-ts/src/openApi/common/interfaces/config.ts b/packages/openapi-ts/src/openApi/common/interfaces/config.ts index bd29668ff..03f1fb771 100644 --- a/packages/openapi-ts/src/openApi/common/interfaces/config.ts +++ b/packages/openapi-ts/src/openApi/common/interfaces/config.ts @@ -3,7 +3,7 @@ import type { Operation, OperationParameter } from './client'; export interface Config { debug?: boolean; filterFn?: { - operation?: (operation: Operation) => boolean; + operation?: (operationKey: string) => boolean; operationParameter?: (parameter: OperationParameter) => boolean; }; nameFn: { diff --git a/packages/openapi-ts/src/openApi/v2/parser/getOperations.ts b/packages/openapi-ts/src/openApi/v2/parser/getOperations.ts index 03055570d..69f2cfb67 100644 --- a/packages/openapi-ts/src/openApi/v2/parser/getOperations.ts +++ b/packages/openapi-ts/src/openApi/v2/parser/getOperations.ts @@ -43,19 +43,18 @@ export const getOperations = ({ } } - const operation = getOperation({ - method, - op, - openApi, - pathParams: pathParameters, - types, - url, - }); - if ( !config.filterFn?.operation || - config.filterFn?.operation(operation) + config.filterFn?.operation(operationKey) ) { + const operation = getOperation({ + method, + op, + openApi, + pathParams: pathParameters, + types, + url, + }); operations.push(operation); } } diff --git a/packages/openapi-ts/src/openApi/v3/parser/getOperations.ts b/packages/openapi-ts/src/openApi/v3/parser/getOperations.ts index 03055570d..69f2cfb67 100644 --- a/packages/openapi-ts/src/openApi/v3/parser/getOperations.ts +++ b/packages/openapi-ts/src/openApi/v3/parser/getOperations.ts @@ -43,19 +43,18 @@ export const getOperations = ({ } } - const operation = getOperation({ - method, - op, - openApi, - pathParams: pathParameters, - types, - url, - }); - if ( !config.filterFn?.operation || - config.filterFn?.operation(operation) + config.filterFn?.operation(operationKey) ) { + const operation = getOperation({ + method, + op, + openApi, + pathParams: pathParameters, + types, + url, + }); operations.push(operation); } } diff --git a/packages/openapi-ts/src/utils/parse.ts b/packages/openapi-ts/src/utils/parse.ts index c480fbffd..f0eb609d0 100644 --- a/packages/openapi-ts/src/utils/parse.ts +++ b/packages/openapi-ts/src/utils/parse.ts @@ -4,13 +4,11 @@ import { camelCase } from './camelCase'; import { getConfig, isStandaloneClient } from './config'; import { transformTypeKeyName } from './type'; -export const operationFilterFn = (operation: Operation): boolean => { +export const operationFilterFn = (operationKey: string): boolean => { const config = getConfig(); - const regexp = config.services.filter ? new RegExp(config.services.filter) : undefined; - const operationKey = `${operation.method} ${operation.path}`; return !regexp || regexp.test(operationKey); }; @@ -52,7 +50,7 @@ export const operationNameFn = (operation: Omit): string => { urlWithoutPlaceholders = urlWithoutPlaceholders .replace(/{(.*?)}/g, 'by-$1') // replace slashes with hyphens for camelcase method at the end - .replace(/\//g, '-'); + .replace(/[/:]/g, '-'); return camelCase({ input: `${operation.method}-${urlWithoutPlaceholders}`, diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle/services.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle/services.gen.ts.snap index 6788d7ccd..a5bcc8f61 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle/services.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle/services.gen.ts.snap @@ -1,7 +1,7 @@ // This file is auto-generated by @hey-api/openapi-ts import { createClient, createConfig, type Options, formDataBodySerializer, urlSearchParamsBodySerializer } from './client'; -import type { ImportData, ImportError, ImportResponse, ApiVversionOdataControllerCountError, ApiVversionOdataControllerCountResponse, DeleteFooData3, CallWithDescriptionsData, DeprecatedCallData, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamData, PostCallWithOptionalParamError, PostCallWithOptionalParamResponse, PostApiVbyApiVersionRequestBodyData, PostApiVbyApiVersionFormDataData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, CallWithNoContentResponseError, CallWithNoContentResponseResponse, CallWithResponseAndNoContentResponseError, CallWithResponseAndNoContentResponseResponse, DummyAError, DummyAResponse, DummyBError, DummyBResponse, CallWithResponseError, CallWithResponseResponse, CallWithDuplicateResponsesError, CallWithDuplicateResponsesResponse, CallWithResponsesError, CallWithResponsesResponse, CollectionFormatData, TypesData, TypesError, TypesResponse, UploadFileData, UploadFileError, UploadFileResponse, FileResponseData, FileResponseError, FileResponseResponse, ComplexTypesData, ComplexTypesError, ComplexTypesResponse, MultipartRequestData, MultipartResponseError, MultipartResponseResponse, ComplexParamsData, ComplexParamsError, ComplexParamsResponse, CallWithResultFromHeaderError, CallWithResultFromHeaderResponse, TestErrorCodeData, TestErrorCodeError, TestErrorCodeResponse, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Error, NonAsciiæøåÆøÅöôêÊ字符串Response, PutWithFormUrlEncodedData } from './types.gen'; +import type { ImportData, ImportError, ImportResponse, ApiVversionOdataControllerCountError, ApiVversionOdataControllerCountResponse, GetApiVbyApiVersionSimpleOperationData, GetApiVbyApiVersionSimpleOperationError, GetApiVbyApiVersionSimpleOperationResponse, DeleteFooData3, CallWithDescriptionsData, DeprecatedCallData, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamData, PostCallWithOptionalParamError, PostCallWithOptionalParamResponse, PostApiVbyApiVersionRequestBodyData, PostApiVbyApiVersionFormDataData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, CallWithNoContentResponseError, CallWithNoContentResponseResponse, CallWithResponseAndNoContentResponseError, CallWithResponseAndNoContentResponseResponse, DummyAError, DummyAResponse, DummyBError, DummyBResponse, CallWithResponseError, CallWithResponseResponse, CallWithDuplicateResponsesError, CallWithDuplicateResponsesResponse, CallWithResponsesError, CallWithResponsesResponse, CollectionFormatData, TypesData, TypesError, TypesResponse, UploadFileData, UploadFileError, UploadFileResponse, FileResponseData, FileResponseError, FileResponseResponse, ComplexTypesData, ComplexTypesError, ComplexTypesResponse, MultipartRequestData, MultipartResponseError, MultipartResponseResponse, ComplexParamsData, ComplexParamsError, ComplexParamsResponse, CallWithResultFromHeaderError, CallWithResultFromHeaderResponse, TestErrorCodeData, TestErrorCodeError, TestErrorCodeResponse, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Error, NonAsciiæøåÆøÅöôêÊ字符串Response, PutWithFormUrlEncodedData } from './types.gen'; export const client = createClient(createConfig()); @@ -20,6 +20,11 @@ export const apiVVersionOdataControllerCount = (options: Options) => { return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/simple:operation' +}); }; + export const getCallWithoutParametersAndResponse = (options?: Options) => { return (options?.client ?? client).get({ ...options, url: '/api/v{api-version}/simple' diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle/types.gen.ts.snap index 551e477cf..a854a09d1 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle/types.gen.ts.snap @@ -1098,6 +1098,19 @@ export type ApiVversionOdataControllerCountResponse = (Model_From_Zendesk); export type ApiVversionOdataControllerCountError = unknown; +export type GetApiVbyApiVersionSimpleOperationData = { + path: { + /** + * foo in method + */ + foo_param: string; + }; +}; + +export type GetApiVbyApiVersionSimpleOperationResponse = (number); + +export type GetApiVbyApiVersionSimpleOperationError = (ModelWithBoolean); + export type DeleteFooData3 = { headers: { /** diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-class/services.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-class/services.gen.ts.snap index 309b95145..2b446f161 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-class/services.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-class/services.gen.ts.snap @@ -1,7 +1,7 @@ // This file is auto-generated by @hey-api/openapi-ts import { createClient, createConfig, type Options, formDataBodySerializer, urlSearchParamsBodySerializer } from '@hey-api/client-axios'; -import type { ImportData, ImportError, ImportResponse, ApiVversionOdataControllerCountError, ApiVversionOdataControllerCountResponse, DeleteFooData3, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamData, PostCallWithOptionalParamError, PostCallWithOptionalParamResponse, CallWithDescriptionsData, DeprecatedCallData, PostApiVbyApiVersionRequestBodyData, PostApiVbyApiVersionFormDataData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, CallWithNoContentResponseError, CallWithNoContentResponseResponse, CallWithResponseAndNoContentResponseError, CallWithResponseAndNoContentResponseResponse, CallWithResponseError, CallWithResponseResponse, CallWithDuplicateResponsesError, CallWithDuplicateResponsesResponse, CallWithResponsesError, CallWithResponsesResponse, DummyAError, DummyAResponse, DummyBError, DummyBResponse, CollectionFormatData, TypesData, TypesError, TypesResponse, UploadFileData, UploadFileError, UploadFileResponse, FileResponseData, FileResponseError, FileResponseResponse, ComplexTypesData, ComplexTypesError, ComplexTypesResponse, ComplexParamsData, ComplexParamsError, ComplexParamsResponse, MultipartRequestData, MultipartResponseError, MultipartResponseResponse, CallWithResultFromHeaderError, CallWithResultFromHeaderResponse, TestErrorCodeData, TestErrorCodeError, TestErrorCodeResponse, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Error, NonAsciiæøåÆøÅöôêÊ字符串Response, PutWithFormUrlEncodedData } from './types.gen'; +import type { ImportData, ImportError, ImportResponse, GetApiVbyApiVersionSimpleOperationData, GetApiVbyApiVersionSimpleOperationError, GetApiVbyApiVersionSimpleOperationResponse, ApiVversionOdataControllerCountError, ApiVversionOdataControllerCountResponse, DeleteFooData3, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamData, PostCallWithOptionalParamError, PostCallWithOptionalParamResponse, CallWithDescriptionsData, DeprecatedCallData, PostApiVbyApiVersionRequestBodyData, PostApiVbyApiVersionFormDataData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, CallWithNoContentResponseError, CallWithNoContentResponseResponse, CallWithResponseAndNoContentResponseError, CallWithResponseAndNoContentResponseResponse, CallWithResponseError, CallWithResponseResponse, CallWithDuplicateResponsesError, CallWithDuplicateResponsesResponse, CallWithResponsesError, CallWithResponsesResponse, DummyAError, DummyAResponse, DummyBError, DummyBResponse, CollectionFormatData, TypesData, TypesError, TypesResponse, UploadFileData, UploadFileError, UploadFileResponse, FileResponseData, FileResponseError, FileResponseResponse, ComplexTypesData, ComplexTypesError, ComplexTypesResponse, ComplexParamsData, ComplexParamsError, ComplexParamsResponse, MultipartRequestData, MultipartResponseError, MultipartResponseResponse, CallWithResultFromHeaderError, CallWithResultFromHeaderResponse, TestErrorCodeData, TestErrorCodeError, TestErrorCodeResponse, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Error, NonAsciiæøåÆøÅöôêÊ字符串Response, PutWithFormUrlEncodedData } from './types.gen'; export const client = createClient(createConfig()); @@ -20,6 +20,13 @@ export class DefaultService { }); } + public static getApiVbyApiVersionSimpleOperation(options: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/simple:operation' + }); + } + } export class SimpleService { diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-class/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-class/types.gen.ts.snap index f8b80270a..93de0e1be 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-class/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-class/types.gen.ts.snap @@ -1094,6 +1094,19 @@ export type ImportResponse = (Model_From_Zendesk | ModelWithReadOnlyAndWriteOnly export type ImportError = unknown; +export type GetApiVbyApiVersionSimpleOperationData = { + path: { + /** + * foo in method + */ + foo_param: string; + }; +}; + +export type GetApiVbyApiVersionSimpleOperationResponse = (number); + +export type GetApiVbyApiVersionSimpleOperationError = (ModelWithBoolean); + export type ApiVversionOdataControllerCountResponse = (Model_From_Zendesk); export type ApiVversionOdataControllerCountError = unknown; diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-react-query/@tanstack/react-query.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-react-query/@tanstack/react-query.gen.ts.snap index f9384f69e..4e820baea 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-react-query/@tanstack/react-query.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-react-query/@tanstack/react-query.gen.ts.snap @@ -2,8 +2,8 @@ import type { Options } from '@hey-api/client-axios'; import { queryOptions, type UseMutationOptions, type DefaultError, infiniteQueryOptions, type InfiniteData } from '@tanstack/react-query'; -import { client, export_, import_, apiVVersionOdataControllerCount, getCallWithoutParametersAndResponse, putCallWithoutParametersAndResponse, postCallWithoutParametersAndResponse, deleteCallWithoutParametersAndResponse, patchCallWithoutParametersAndResponse, deleteFoo, callWithDescriptions, deprecatedCall, callWithParameters, callWithWeirdParameterNames, getCallWithOptionalParam, postCallWithOptionalParam, postApiVbyApiVersionRequestBody, postApiVbyApiVersionFormData, callWithDefaultParameters, callWithDefaultOptionalParameters, callToTestOrderOfParams, duplicateName, duplicateName1, duplicateName2, duplicateName3, callWithNoContentResponse, callWithResponseAndNoContentResponse, dummyA, dummyB, callWithResponse, callWithDuplicateResponses, callWithResponses, collectionFormat, types, uploadFile, fileResponse, complexTypes, multipartRequest, multipartResponse, complexParams, callWithResultFromHeader, testErrorCode, nonAsciiæøåÆøÅöôêÊ字符串, putWithFormUrlEncoded } from '../services.gen'; -import type { ImportData, ImportError, ImportResponse, DeleteFooData3, CallWithDescriptionsData, DeprecatedCallData, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamData, PostCallWithOptionalParamError, PostCallWithOptionalParamResponse, PostApiVbyApiVersionRequestBodyData, PostApiVbyApiVersionFormDataData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, CallWithDuplicateResponsesError, CallWithDuplicateResponsesResponse, CallWithResponsesError, CallWithResponsesResponse, CollectionFormatData, TypesData, UploadFileData, UploadFileError, UploadFileResponse, FileResponseData, ComplexTypesData, MultipartRequestData, ComplexParamsData, ComplexParamsError, ComplexParamsResponse, CallWithResultFromHeaderError, CallWithResultFromHeaderResponse, TestErrorCodeData, TestErrorCodeError, TestErrorCodeResponse, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Error, NonAsciiæøåÆøÅöôêÊ字符串Response, PutWithFormUrlEncodedData } from '../types.gen'; +import { client, export_, import_, apiVVersionOdataControllerCount, getApiVbyApiVersionSimpleOperation, getCallWithoutParametersAndResponse, putCallWithoutParametersAndResponse, postCallWithoutParametersAndResponse, deleteCallWithoutParametersAndResponse, patchCallWithoutParametersAndResponse, deleteFoo, callWithDescriptions, deprecatedCall, callWithParameters, callWithWeirdParameterNames, getCallWithOptionalParam, postCallWithOptionalParam, postApiVbyApiVersionRequestBody, postApiVbyApiVersionFormData, callWithDefaultParameters, callWithDefaultOptionalParameters, callToTestOrderOfParams, duplicateName, duplicateName1, duplicateName2, duplicateName3, callWithNoContentResponse, callWithResponseAndNoContentResponse, dummyA, dummyB, callWithResponse, callWithDuplicateResponses, callWithResponses, collectionFormat, types, uploadFile, fileResponse, complexTypes, multipartRequest, multipartResponse, complexParams, callWithResultFromHeader, testErrorCode, nonAsciiæøåÆøÅöôêÊ字符串, putWithFormUrlEncoded } from '../services.gen'; +import type { ImportData, ImportError, ImportResponse, GetApiVbyApiVersionSimpleOperationData, DeleteFooData3, CallWithDescriptionsData, DeprecatedCallData, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamData, PostCallWithOptionalParamError, PostCallWithOptionalParamResponse, PostApiVbyApiVersionRequestBodyData, PostApiVbyApiVersionFormDataData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, CallWithDuplicateResponsesError, CallWithDuplicateResponsesResponse, CallWithResponsesError, CallWithResponsesResponse, CollectionFormatData, TypesData, UploadFileData, UploadFileError, UploadFileResponse, FileResponseData, ComplexTypesData, MultipartRequestData, ComplexParamsData, ComplexParamsError, ComplexParamsResponse, CallWithResultFromHeaderError, CallWithResultFromHeaderResponse, TestErrorCodeData, TestErrorCodeError, TestErrorCodeResponse, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Error, NonAsciiæøåÆøÅöôêÊ字符串Response, PutWithFormUrlEncodedData } from '../types.gen'; import type { AxiosError } from 'axios'; type QueryKey = [ @@ -91,6 +91,22 @@ export const apiVVersionOdataControllerCountOptions = (options?: Options) => { r queryKey: apiVVersionOdataControllerCountQueryKey(options) }); }; +export const getApiVbyApiVersionSimpleOperationQueryKey = (options: Options) => [ + createQueryKey("getApiVbyApiVersionSimpleOperation", options) +]; + +export const getApiVbyApiVersionSimpleOperationOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await getApiVbyApiVersionSimpleOperation({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: getApiVbyApiVersionSimpleOperationQueryKey(options) +}); }; + export const getCallWithoutParametersAndResponseQueryKey = (options?: Options) => [ createQueryKey("getCallWithoutParametersAndResponse", options) ]; diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-react-query/services.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-react-query/services.gen.ts.snap index c1ca53fa3..a9d7b030a 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-react-query/services.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-react-query/services.gen.ts.snap @@ -1,7 +1,7 @@ // This file is auto-generated by @hey-api/openapi-ts import { createClient, createConfig, type Options, formDataBodySerializer, urlSearchParamsBodySerializer } from '@hey-api/client-axios'; -import type { ImportData, ImportError, ImportResponse, ApiVversionOdataControllerCountError, ApiVversionOdataControllerCountResponse, DeleteFooData3, CallWithDescriptionsData, DeprecatedCallData, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamData, PostCallWithOptionalParamError, PostCallWithOptionalParamResponse, PostApiVbyApiVersionRequestBodyData, PostApiVbyApiVersionFormDataData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, CallWithNoContentResponseError, CallWithNoContentResponseResponse, CallWithResponseAndNoContentResponseError, CallWithResponseAndNoContentResponseResponse, DummyAError, DummyAResponse, DummyBError, DummyBResponse, CallWithResponseError, CallWithResponseResponse, CallWithDuplicateResponsesError, CallWithDuplicateResponsesResponse, CallWithResponsesError, CallWithResponsesResponse, CollectionFormatData, TypesData, TypesError, TypesResponse, UploadFileData, UploadFileError, UploadFileResponse, FileResponseData, FileResponseError, FileResponseResponse, ComplexTypesData, ComplexTypesError, ComplexTypesResponse, MultipartRequestData, MultipartResponseError, MultipartResponseResponse, ComplexParamsData, ComplexParamsError, ComplexParamsResponse, CallWithResultFromHeaderError, CallWithResultFromHeaderResponse, TestErrorCodeData, TestErrorCodeError, TestErrorCodeResponse, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Error, NonAsciiæøåÆøÅöôêÊ字符串Response, PutWithFormUrlEncodedData } from './types.gen'; +import type { ImportData, ImportError, ImportResponse, ApiVversionOdataControllerCountError, ApiVversionOdataControllerCountResponse, GetApiVbyApiVersionSimpleOperationData, GetApiVbyApiVersionSimpleOperationError, GetApiVbyApiVersionSimpleOperationResponse, DeleteFooData3, CallWithDescriptionsData, DeprecatedCallData, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamData, PostCallWithOptionalParamError, PostCallWithOptionalParamResponse, PostApiVbyApiVersionRequestBodyData, PostApiVbyApiVersionFormDataData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, CallWithNoContentResponseError, CallWithNoContentResponseResponse, CallWithResponseAndNoContentResponseError, CallWithResponseAndNoContentResponseResponse, DummyAError, DummyAResponse, DummyBError, DummyBResponse, CallWithResponseError, CallWithResponseResponse, CallWithDuplicateResponsesError, CallWithDuplicateResponsesResponse, CallWithResponsesError, CallWithResponsesResponse, CollectionFormatData, TypesData, TypesError, TypesResponse, UploadFileData, UploadFileError, UploadFileResponse, FileResponseData, FileResponseError, FileResponseResponse, ComplexTypesData, ComplexTypesError, ComplexTypesResponse, MultipartRequestData, MultipartResponseError, MultipartResponseResponse, ComplexParamsData, ComplexParamsError, ComplexParamsResponse, CallWithResultFromHeaderError, CallWithResultFromHeaderResponse, TestErrorCodeData, TestErrorCodeError, TestErrorCodeResponse, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Error, NonAsciiæøåÆøÅöôêÊ字符串Response, PutWithFormUrlEncodedData } from './types.gen'; export const client = createClient(createConfig()); @@ -20,6 +20,11 @@ export const apiVVersionOdataControllerCount = (options: Options) => { return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/simple:operation' +}); }; + export const getCallWithoutParametersAndResponse = (options?: Options) => { return (options?.client ?? client).get({ ...options, url: '/api/v{api-version}/simple' diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-react-query/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-react-query/types.gen.ts.snap index 551e477cf..a854a09d1 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-react-query/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-react-query/types.gen.ts.snap @@ -1098,6 +1098,19 @@ export type ApiVversionOdataControllerCountResponse = (Model_From_Zendesk); export type ApiVversionOdataControllerCountError = unknown; +export type GetApiVbyApiVersionSimpleOperationData = { + path: { + /** + * foo in method + */ + foo_param: string; + }; +}; + +export type GetApiVbyApiVersionSimpleOperationResponse = (number); + +export type GetApiVbyApiVersionSimpleOperationError = (ModelWithBoolean); + export type DeleteFooData3 = { headers: { /** diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-solid-query/@tanstack/solid-query.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-solid-query/@tanstack/solid-query.gen.ts.snap index 995e7e939..58c790749 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-solid-query/@tanstack/solid-query.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-solid-query/@tanstack/solid-query.gen.ts.snap @@ -2,8 +2,8 @@ import type { Options } from '@hey-api/client-axios'; import { queryOptions, type MutationOptions, type DefaultError, infiniteQueryOptions, type InfiniteData } from '@tanstack/solid-query'; -import { client, export_, import_, apiVVersionOdataControllerCount, getCallWithoutParametersAndResponse, putCallWithoutParametersAndResponse, postCallWithoutParametersAndResponse, deleteCallWithoutParametersAndResponse, patchCallWithoutParametersAndResponse, deleteFoo, callWithDescriptions, deprecatedCall, callWithParameters, callWithWeirdParameterNames, getCallWithOptionalParam, postCallWithOptionalParam, postApiVbyApiVersionRequestBody, postApiVbyApiVersionFormData, callWithDefaultParameters, callWithDefaultOptionalParameters, callToTestOrderOfParams, duplicateName, duplicateName1, duplicateName2, duplicateName3, callWithNoContentResponse, callWithResponseAndNoContentResponse, dummyA, dummyB, callWithResponse, callWithDuplicateResponses, callWithResponses, collectionFormat, types, uploadFile, fileResponse, complexTypes, multipartRequest, multipartResponse, complexParams, callWithResultFromHeader, testErrorCode, nonAsciiæøåÆøÅöôêÊ字符串, putWithFormUrlEncoded } from '../services.gen'; -import type { ImportData, ImportError, ImportResponse, DeleteFooData3, CallWithDescriptionsData, DeprecatedCallData, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamData, PostCallWithOptionalParamError, PostCallWithOptionalParamResponse, PostApiVbyApiVersionRequestBodyData, PostApiVbyApiVersionFormDataData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, CallWithDuplicateResponsesError, CallWithDuplicateResponsesResponse, CallWithResponsesError, CallWithResponsesResponse, CollectionFormatData, TypesData, UploadFileData, UploadFileError, UploadFileResponse, FileResponseData, ComplexTypesData, MultipartRequestData, ComplexParamsData, ComplexParamsError, ComplexParamsResponse, CallWithResultFromHeaderError, CallWithResultFromHeaderResponse, TestErrorCodeData, TestErrorCodeError, TestErrorCodeResponse, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Error, NonAsciiæøåÆøÅöôêÊ字符串Response, PutWithFormUrlEncodedData } from '../types.gen'; +import { client, export_, import_, apiVVersionOdataControllerCount, getApiVbyApiVersionSimpleOperation, getCallWithoutParametersAndResponse, putCallWithoutParametersAndResponse, postCallWithoutParametersAndResponse, deleteCallWithoutParametersAndResponse, patchCallWithoutParametersAndResponse, deleteFoo, callWithDescriptions, deprecatedCall, callWithParameters, callWithWeirdParameterNames, getCallWithOptionalParam, postCallWithOptionalParam, postApiVbyApiVersionRequestBody, postApiVbyApiVersionFormData, callWithDefaultParameters, callWithDefaultOptionalParameters, callToTestOrderOfParams, duplicateName, duplicateName1, duplicateName2, duplicateName3, callWithNoContentResponse, callWithResponseAndNoContentResponse, dummyA, dummyB, callWithResponse, callWithDuplicateResponses, callWithResponses, collectionFormat, types, uploadFile, fileResponse, complexTypes, multipartRequest, multipartResponse, complexParams, callWithResultFromHeader, testErrorCode, nonAsciiæøåÆøÅöôêÊ字符串, putWithFormUrlEncoded } from '../services.gen'; +import type { ImportData, ImportError, ImportResponse, GetApiVbyApiVersionSimpleOperationData, DeleteFooData3, CallWithDescriptionsData, DeprecatedCallData, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamData, PostCallWithOptionalParamError, PostCallWithOptionalParamResponse, PostApiVbyApiVersionRequestBodyData, PostApiVbyApiVersionFormDataData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, CallWithDuplicateResponsesError, CallWithDuplicateResponsesResponse, CallWithResponsesError, CallWithResponsesResponse, CollectionFormatData, TypesData, UploadFileData, UploadFileError, UploadFileResponse, FileResponseData, ComplexTypesData, MultipartRequestData, ComplexParamsData, ComplexParamsError, ComplexParamsResponse, CallWithResultFromHeaderError, CallWithResultFromHeaderResponse, TestErrorCodeData, TestErrorCodeError, TestErrorCodeResponse, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Error, NonAsciiæøåÆøÅöôêÊ字符串Response, PutWithFormUrlEncodedData } from '../types.gen'; import type { AxiosError } from 'axios'; type QueryKey = [ @@ -91,6 +91,22 @@ export const apiVVersionOdataControllerCountOptions = (options?: Options) => { r queryKey: apiVVersionOdataControllerCountQueryKey(options) }); }; +export const getApiVbyApiVersionSimpleOperationQueryKey = (options: Options) => [ + createQueryKey("getApiVbyApiVersionSimpleOperation", options) +]; + +export const getApiVbyApiVersionSimpleOperationOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await getApiVbyApiVersionSimpleOperation({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: getApiVbyApiVersionSimpleOperationQueryKey(options) +}); }; + export const getCallWithoutParametersAndResponseQueryKey = (options?: Options) => [ createQueryKey("getCallWithoutParametersAndResponse", options) ]; diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-solid-query/services.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-solid-query/services.gen.ts.snap index c1ca53fa3..a9d7b030a 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-solid-query/services.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-solid-query/services.gen.ts.snap @@ -1,7 +1,7 @@ // This file is auto-generated by @hey-api/openapi-ts import { createClient, createConfig, type Options, formDataBodySerializer, urlSearchParamsBodySerializer } from '@hey-api/client-axios'; -import type { ImportData, ImportError, ImportResponse, ApiVversionOdataControllerCountError, ApiVversionOdataControllerCountResponse, DeleteFooData3, CallWithDescriptionsData, DeprecatedCallData, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamData, PostCallWithOptionalParamError, PostCallWithOptionalParamResponse, PostApiVbyApiVersionRequestBodyData, PostApiVbyApiVersionFormDataData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, CallWithNoContentResponseError, CallWithNoContentResponseResponse, CallWithResponseAndNoContentResponseError, CallWithResponseAndNoContentResponseResponse, DummyAError, DummyAResponse, DummyBError, DummyBResponse, CallWithResponseError, CallWithResponseResponse, CallWithDuplicateResponsesError, CallWithDuplicateResponsesResponse, CallWithResponsesError, CallWithResponsesResponse, CollectionFormatData, TypesData, TypesError, TypesResponse, UploadFileData, UploadFileError, UploadFileResponse, FileResponseData, FileResponseError, FileResponseResponse, ComplexTypesData, ComplexTypesError, ComplexTypesResponse, MultipartRequestData, MultipartResponseError, MultipartResponseResponse, ComplexParamsData, ComplexParamsError, ComplexParamsResponse, CallWithResultFromHeaderError, CallWithResultFromHeaderResponse, TestErrorCodeData, TestErrorCodeError, TestErrorCodeResponse, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Error, NonAsciiæøåÆøÅöôêÊ字符串Response, PutWithFormUrlEncodedData } from './types.gen'; +import type { ImportData, ImportError, ImportResponse, ApiVversionOdataControllerCountError, ApiVversionOdataControllerCountResponse, GetApiVbyApiVersionSimpleOperationData, GetApiVbyApiVersionSimpleOperationError, GetApiVbyApiVersionSimpleOperationResponse, DeleteFooData3, CallWithDescriptionsData, DeprecatedCallData, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamData, PostCallWithOptionalParamError, PostCallWithOptionalParamResponse, PostApiVbyApiVersionRequestBodyData, PostApiVbyApiVersionFormDataData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, CallWithNoContentResponseError, CallWithNoContentResponseResponse, CallWithResponseAndNoContentResponseError, CallWithResponseAndNoContentResponseResponse, DummyAError, DummyAResponse, DummyBError, DummyBResponse, CallWithResponseError, CallWithResponseResponse, CallWithDuplicateResponsesError, CallWithDuplicateResponsesResponse, CallWithResponsesError, CallWithResponsesResponse, CollectionFormatData, TypesData, TypesError, TypesResponse, UploadFileData, UploadFileError, UploadFileResponse, FileResponseData, FileResponseError, FileResponseResponse, ComplexTypesData, ComplexTypesError, ComplexTypesResponse, MultipartRequestData, MultipartResponseError, MultipartResponseResponse, ComplexParamsData, ComplexParamsError, ComplexParamsResponse, CallWithResultFromHeaderError, CallWithResultFromHeaderResponse, TestErrorCodeData, TestErrorCodeError, TestErrorCodeResponse, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Error, NonAsciiæøåÆøÅöôêÊ字符串Response, PutWithFormUrlEncodedData } from './types.gen'; export const client = createClient(createConfig()); @@ -20,6 +20,11 @@ export const apiVVersionOdataControllerCount = (options: Options) => { return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/simple:operation' +}); }; + export const getCallWithoutParametersAndResponse = (options?: Options) => { return (options?.client ?? client).get({ ...options, url: '/api/v{api-version}/simple' diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-solid-query/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-solid-query/types.gen.ts.snap index 551e477cf..a854a09d1 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-solid-query/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-solid-query/types.gen.ts.snap @@ -1098,6 +1098,19 @@ export type ApiVversionOdataControllerCountResponse = (Model_From_Zendesk); export type ApiVversionOdataControllerCountError = unknown; +export type GetApiVbyApiVersionSimpleOperationData = { + path: { + /** + * foo in method + */ + foo_param: string; + }; +}; + +export type GetApiVbyApiVersionSimpleOperationResponse = (number); + +export type GetApiVbyApiVersionSimpleOperationError = (ModelWithBoolean); + export type DeleteFooData3 = { headers: { /** diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-svelte-query/@tanstack/svelte-query.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-svelte-query/@tanstack/svelte-query.gen.ts.snap index 599920659..6b2d431be 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-svelte-query/@tanstack/svelte-query.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-svelte-query/@tanstack/svelte-query.gen.ts.snap @@ -2,8 +2,8 @@ import type { Options } from '@hey-api/client-axios'; import { queryOptions, type MutationOptions, type DefaultError, infiniteQueryOptions, type InfiniteData } from '@tanstack/svelte-query'; -import { client, export_, import_, apiVVersionOdataControllerCount, getCallWithoutParametersAndResponse, putCallWithoutParametersAndResponse, postCallWithoutParametersAndResponse, deleteCallWithoutParametersAndResponse, patchCallWithoutParametersAndResponse, deleteFoo, callWithDescriptions, deprecatedCall, callWithParameters, callWithWeirdParameterNames, getCallWithOptionalParam, postCallWithOptionalParam, postApiVbyApiVersionRequestBody, postApiVbyApiVersionFormData, callWithDefaultParameters, callWithDefaultOptionalParameters, callToTestOrderOfParams, duplicateName, duplicateName1, duplicateName2, duplicateName3, callWithNoContentResponse, callWithResponseAndNoContentResponse, dummyA, dummyB, callWithResponse, callWithDuplicateResponses, callWithResponses, collectionFormat, types, uploadFile, fileResponse, complexTypes, multipartRequest, multipartResponse, complexParams, callWithResultFromHeader, testErrorCode, nonAsciiæøåÆøÅöôêÊ字符串, putWithFormUrlEncoded } from '../services.gen'; -import type { ImportData, ImportError, ImportResponse, DeleteFooData3, CallWithDescriptionsData, DeprecatedCallData, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamData, PostCallWithOptionalParamError, PostCallWithOptionalParamResponse, PostApiVbyApiVersionRequestBodyData, PostApiVbyApiVersionFormDataData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, CallWithDuplicateResponsesError, CallWithDuplicateResponsesResponse, CallWithResponsesError, CallWithResponsesResponse, CollectionFormatData, TypesData, UploadFileData, UploadFileError, UploadFileResponse, FileResponseData, ComplexTypesData, MultipartRequestData, ComplexParamsData, ComplexParamsError, ComplexParamsResponse, CallWithResultFromHeaderError, CallWithResultFromHeaderResponse, TestErrorCodeData, TestErrorCodeError, TestErrorCodeResponse, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Error, NonAsciiæøåÆøÅöôêÊ字符串Response, PutWithFormUrlEncodedData } from '../types.gen'; +import { client, export_, import_, apiVVersionOdataControllerCount, getApiVbyApiVersionSimpleOperation, getCallWithoutParametersAndResponse, putCallWithoutParametersAndResponse, postCallWithoutParametersAndResponse, deleteCallWithoutParametersAndResponse, patchCallWithoutParametersAndResponse, deleteFoo, callWithDescriptions, deprecatedCall, callWithParameters, callWithWeirdParameterNames, getCallWithOptionalParam, postCallWithOptionalParam, postApiVbyApiVersionRequestBody, postApiVbyApiVersionFormData, callWithDefaultParameters, callWithDefaultOptionalParameters, callToTestOrderOfParams, duplicateName, duplicateName1, duplicateName2, duplicateName3, callWithNoContentResponse, callWithResponseAndNoContentResponse, dummyA, dummyB, callWithResponse, callWithDuplicateResponses, callWithResponses, collectionFormat, types, uploadFile, fileResponse, complexTypes, multipartRequest, multipartResponse, complexParams, callWithResultFromHeader, testErrorCode, nonAsciiæøåÆøÅöôêÊ字符串, putWithFormUrlEncoded } from '../services.gen'; +import type { ImportData, ImportError, ImportResponse, GetApiVbyApiVersionSimpleOperationData, DeleteFooData3, CallWithDescriptionsData, DeprecatedCallData, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamData, PostCallWithOptionalParamError, PostCallWithOptionalParamResponse, PostApiVbyApiVersionRequestBodyData, PostApiVbyApiVersionFormDataData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, CallWithDuplicateResponsesError, CallWithDuplicateResponsesResponse, CallWithResponsesError, CallWithResponsesResponse, CollectionFormatData, TypesData, UploadFileData, UploadFileError, UploadFileResponse, FileResponseData, ComplexTypesData, MultipartRequestData, ComplexParamsData, ComplexParamsError, ComplexParamsResponse, CallWithResultFromHeaderError, CallWithResultFromHeaderResponse, TestErrorCodeData, TestErrorCodeError, TestErrorCodeResponse, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Error, NonAsciiæøåÆøÅöôêÊ字符串Response, PutWithFormUrlEncodedData } from '../types.gen'; import type { AxiosError } from 'axios'; type QueryKey = [ @@ -91,6 +91,22 @@ export const apiVVersionOdataControllerCountOptions = (options?: Options) => { r queryKey: apiVVersionOdataControllerCountQueryKey(options) }); }; +export const getApiVbyApiVersionSimpleOperationQueryKey = (options: Options) => [ + createQueryKey("getApiVbyApiVersionSimpleOperation", options) +]; + +export const getApiVbyApiVersionSimpleOperationOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await getApiVbyApiVersionSimpleOperation({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: getApiVbyApiVersionSimpleOperationQueryKey(options) +}); }; + export const getCallWithoutParametersAndResponseQueryKey = (options?: Options) => [ createQueryKey("getCallWithoutParametersAndResponse", options) ]; diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-svelte-query/services.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-svelte-query/services.gen.ts.snap index c1ca53fa3..a9d7b030a 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-svelte-query/services.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-svelte-query/services.gen.ts.snap @@ -1,7 +1,7 @@ // This file is auto-generated by @hey-api/openapi-ts import { createClient, createConfig, type Options, formDataBodySerializer, urlSearchParamsBodySerializer } from '@hey-api/client-axios'; -import type { ImportData, ImportError, ImportResponse, ApiVversionOdataControllerCountError, ApiVversionOdataControllerCountResponse, DeleteFooData3, CallWithDescriptionsData, DeprecatedCallData, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamData, PostCallWithOptionalParamError, PostCallWithOptionalParamResponse, PostApiVbyApiVersionRequestBodyData, PostApiVbyApiVersionFormDataData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, CallWithNoContentResponseError, CallWithNoContentResponseResponse, CallWithResponseAndNoContentResponseError, CallWithResponseAndNoContentResponseResponse, DummyAError, DummyAResponse, DummyBError, DummyBResponse, CallWithResponseError, CallWithResponseResponse, CallWithDuplicateResponsesError, CallWithDuplicateResponsesResponse, CallWithResponsesError, CallWithResponsesResponse, CollectionFormatData, TypesData, TypesError, TypesResponse, UploadFileData, UploadFileError, UploadFileResponse, FileResponseData, FileResponseError, FileResponseResponse, ComplexTypesData, ComplexTypesError, ComplexTypesResponse, MultipartRequestData, MultipartResponseError, MultipartResponseResponse, ComplexParamsData, ComplexParamsError, ComplexParamsResponse, CallWithResultFromHeaderError, CallWithResultFromHeaderResponse, TestErrorCodeData, TestErrorCodeError, TestErrorCodeResponse, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Error, NonAsciiæøåÆøÅöôêÊ字符串Response, PutWithFormUrlEncodedData } from './types.gen'; +import type { ImportData, ImportError, ImportResponse, ApiVversionOdataControllerCountError, ApiVversionOdataControllerCountResponse, GetApiVbyApiVersionSimpleOperationData, GetApiVbyApiVersionSimpleOperationError, GetApiVbyApiVersionSimpleOperationResponse, DeleteFooData3, CallWithDescriptionsData, DeprecatedCallData, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamData, PostCallWithOptionalParamError, PostCallWithOptionalParamResponse, PostApiVbyApiVersionRequestBodyData, PostApiVbyApiVersionFormDataData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, CallWithNoContentResponseError, CallWithNoContentResponseResponse, CallWithResponseAndNoContentResponseError, CallWithResponseAndNoContentResponseResponse, DummyAError, DummyAResponse, DummyBError, DummyBResponse, CallWithResponseError, CallWithResponseResponse, CallWithDuplicateResponsesError, CallWithDuplicateResponsesResponse, CallWithResponsesError, CallWithResponsesResponse, CollectionFormatData, TypesData, TypesError, TypesResponse, UploadFileData, UploadFileError, UploadFileResponse, FileResponseData, FileResponseError, FileResponseResponse, ComplexTypesData, ComplexTypesError, ComplexTypesResponse, MultipartRequestData, MultipartResponseError, MultipartResponseResponse, ComplexParamsData, ComplexParamsError, ComplexParamsResponse, CallWithResultFromHeaderError, CallWithResultFromHeaderResponse, TestErrorCodeData, TestErrorCodeError, TestErrorCodeResponse, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Error, NonAsciiæøåÆøÅöôêÊ字符串Response, PutWithFormUrlEncodedData } from './types.gen'; export const client = createClient(createConfig()); @@ -20,6 +20,11 @@ export const apiVVersionOdataControllerCount = (options: Options) => { return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/simple:operation' +}); }; + export const getCallWithoutParametersAndResponse = (options?: Options) => { return (options?.client ?? client).get({ ...options, url: '/api/v{api-version}/simple' diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-svelte-query/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-svelte-query/types.gen.ts.snap index 551e477cf..a854a09d1 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-svelte-query/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-svelte-query/types.gen.ts.snap @@ -1098,6 +1098,19 @@ export type ApiVversionOdataControllerCountResponse = (Model_From_Zendesk); export type ApiVversionOdataControllerCountError = unknown; +export type GetApiVbyApiVersionSimpleOperationData = { + path: { + /** + * foo in method + */ + foo_param: string; + }; +}; + +export type GetApiVbyApiVersionSimpleOperationResponse = (number); + +export type GetApiVbyApiVersionSimpleOperationError = (ModelWithBoolean); + export type DeleteFooData3 = { headers: { /** diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-vue-query/@tanstack/vue-query.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-vue-query/@tanstack/vue-query.gen.ts.snap index efd0d4a19..f146b0451 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-vue-query/@tanstack/vue-query.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-vue-query/@tanstack/vue-query.gen.ts.snap @@ -2,8 +2,8 @@ import type { Options } from '@hey-api/client-axios'; import { queryOptions, type UseMutationOptions, type DefaultError, infiniteQueryOptions, type InfiniteData } from '@tanstack/vue-query'; -import { client, export_, import_, apiVVersionOdataControllerCount, getCallWithoutParametersAndResponse, putCallWithoutParametersAndResponse, postCallWithoutParametersAndResponse, deleteCallWithoutParametersAndResponse, patchCallWithoutParametersAndResponse, deleteFoo, callWithDescriptions, deprecatedCall, callWithParameters, callWithWeirdParameterNames, getCallWithOptionalParam, postCallWithOptionalParam, postApiVbyApiVersionRequestBody, postApiVbyApiVersionFormData, callWithDefaultParameters, callWithDefaultOptionalParameters, callToTestOrderOfParams, duplicateName, duplicateName1, duplicateName2, duplicateName3, callWithNoContentResponse, callWithResponseAndNoContentResponse, dummyA, dummyB, callWithResponse, callWithDuplicateResponses, callWithResponses, collectionFormat, types, uploadFile, fileResponse, complexTypes, multipartRequest, multipartResponse, complexParams, callWithResultFromHeader, testErrorCode, nonAsciiæøåÆøÅöôêÊ字符串, putWithFormUrlEncoded } from '../services.gen'; -import type { ImportData, ImportError, ImportResponse, DeleteFooData3, CallWithDescriptionsData, DeprecatedCallData, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamData, PostCallWithOptionalParamError, PostCallWithOptionalParamResponse, PostApiVbyApiVersionRequestBodyData, PostApiVbyApiVersionFormDataData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, CallWithDuplicateResponsesError, CallWithDuplicateResponsesResponse, CallWithResponsesError, CallWithResponsesResponse, CollectionFormatData, TypesData, UploadFileData, UploadFileError, UploadFileResponse, FileResponseData, ComplexTypesData, MultipartRequestData, ComplexParamsData, ComplexParamsError, ComplexParamsResponse, CallWithResultFromHeaderError, CallWithResultFromHeaderResponse, TestErrorCodeData, TestErrorCodeError, TestErrorCodeResponse, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Error, NonAsciiæøåÆøÅöôêÊ字符串Response, PutWithFormUrlEncodedData } from '../types.gen'; +import { client, export_, import_, apiVVersionOdataControllerCount, getApiVbyApiVersionSimpleOperation, getCallWithoutParametersAndResponse, putCallWithoutParametersAndResponse, postCallWithoutParametersAndResponse, deleteCallWithoutParametersAndResponse, patchCallWithoutParametersAndResponse, deleteFoo, callWithDescriptions, deprecatedCall, callWithParameters, callWithWeirdParameterNames, getCallWithOptionalParam, postCallWithOptionalParam, postApiVbyApiVersionRequestBody, postApiVbyApiVersionFormData, callWithDefaultParameters, callWithDefaultOptionalParameters, callToTestOrderOfParams, duplicateName, duplicateName1, duplicateName2, duplicateName3, callWithNoContentResponse, callWithResponseAndNoContentResponse, dummyA, dummyB, callWithResponse, callWithDuplicateResponses, callWithResponses, collectionFormat, types, uploadFile, fileResponse, complexTypes, multipartRequest, multipartResponse, complexParams, callWithResultFromHeader, testErrorCode, nonAsciiæøåÆøÅöôêÊ字符串, putWithFormUrlEncoded } from '../services.gen'; +import type { ImportData, ImportError, ImportResponse, GetApiVbyApiVersionSimpleOperationData, DeleteFooData3, CallWithDescriptionsData, DeprecatedCallData, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamData, PostCallWithOptionalParamError, PostCallWithOptionalParamResponse, PostApiVbyApiVersionRequestBodyData, PostApiVbyApiVersionFormDataData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, CallWithDuplicateResponsesError, CallWithDuplicateResponsesResponse, CallWithResponsesError, CallWithResponsesResponse, CollectionFormatData, TypesData, UploadFileData, UploadFileError, UploadFileResponse, FileResponseData, ComplexTypesData, MultipartRequestData, ComplexParamsData, ComplexParamsError, ComplexParamsResponse, CallWithResultFromHeaderError, CallWithResultFromHeaderResponse, TestErrorCodeData, TestErrorCodeError, TestErrorCodeResponse, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Error, NonAsciiæøåÆøÅöôêÊ字符串Response, PutWithFormUrlEncodedData } from '../types.gen'; import type { AxiosError } from 'axios'; type QueryKey = [ @@ -91,6 +91,22 @@ export const apiVVersionOdataControllerCountOptions = (options?: Options) => { r queryKey: apiVVersionOdataControllerCountQueryKey(options) }); }; +export const getApiVbyApiVersionSimpleOperationQueryKey = (options: Options) => [ + createQueryKey("getApiVbyApiVersionSimpleOperation", options) +]; + +export const getApiVbyApiVersionSimpleOperationOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await getApiVbyApiVersionSimpleOperation({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: getApiVbyApiVersionSimpleOperationQueryKey(options) +}); }; + export const getCallWithoutParametersAndResponseQueryKey = (options?: Options) => [ createQueryKey("getCallWithoutParametersAndResponse", options) ]; diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-vue-query/services.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-vue-query/services.gen.ts.snap index c1ca53fa3..a9d7b030a 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-vue-query/services.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-vue-query/services.gen.ts.snap @@ -1,7 +1,7 @@ // This file is auto-generated by @hey-api/openapi-ts import { createClient, createConfig, type Options, formDataBodySerializer, urlSearchParamsBodySerializer } from '@hey-api/client-axios'; -import type { ImportData, ImportError, ImportResponse, ApiVversionOdataControllerCountError, ApiVversionOdataControllerCountResponse, DeleteFooData3, CallWithDescriptionsData, DeprecatedCallData, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamData, PostCallWithOptionalParamError, PostCallWithOptionalParamResponse, PostApiVbyApiVersionRequestBodyData, PostApiVbyApiVersionFormDataData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, CallWithNoContentResponseError, CallWithNoContentResponseResponse, CallWithResponseAndNoContentResponseError, CallWithResponseAndNoContentResponseResponse, DummyAError, DummyAResponse, DummyBError, DummyBResponse, CallWithResponseError, CallWithResponseResponse, CallWithDuplicateResponsesError, CallWithDuplicateResponsesResponse, CallWithResponsesError, CallWithResponsesResponse, CollectionFormatData, TypesData, TypesError, TypesResponse, UploadFileData, UploadFileError, UploadFileResponse, FileResponseData, FileResponseError, FileResponseResponse, ComplexTypesData, ComplexTypesError, ComplexTypesResponse, MultipartRequestData, MultipartResponseError, MultipartResponseResponse, ComplexParamsData, ComplexParamsError, ComplexParamsResponse, CallWithResultFromHeaderError, CallWithResultFromHeaderResponse, TestErrorCodeData, TestErrorCodeError, TestErrorCodeResponse, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Error, NonAsciiæøåÆøÅöôêÊ字符串Response, PutWithFormUrlEncodedData } from './types.gen'; +import type { ImportData, ImportError, ImportResponse, ApiVversionOdataControllerCountError, ApiVversionOdataControllerCountResponse, GetApiVbyApiVersionSimpleOperationData, GetApiVbyApiVersionSimpleOperationError, GetApiVbyApiVersionSimpleOperationResponse, DeleteFooData3, CallWithDescriptionsData, DeprecatedCallData, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamData, PostCallWithOptionalParamError, PostCallWithOptionalParamResponse, PostApiVbyApiVersionRequestBodyData, PostApiVbyApiVersionFormDataData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, CallWithNoContentResponseError, CallWithNoContentResponseResponse, CallWithResponseAndNoContentResponseError, CallWithResponseAndNoContentResponseResponse, DummyAError, DummyAResponse, DummyBError, DummyBResponse, CallWithResponseError, CallWithResponseResponse, CallWithDuplicateResponsesError, CallWithDuplicateResponsesResponse, CallWithResponsesError, CallWithResponsesResponse, CollectionFormatData, TypesData, TypesError, TypesResponse, UploadFileData, UploadFileError, UploadFileResponse, FileResponseData, FileResponseError, FileResponseResponse, ComplexTypesData, ComplexTypesError, ComplexTypesResponse, MultipartRequestData, MultipartResponseError, MultipartResponseResponse, ComplexParamsData, ComplexParamsError, ComplexParamsResponse, CallWithResultFromHeaderError, CallWithResultFromHeaderResponse, TestErrorCodeData, TestErrorCodeError, TestErrorCodeResponse, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Error, NonAsciiæøåÆøÅöôêÊ字符串Response, PutWithFormUrlEncodedData } from './types.gen'; export const client = createClient(createConfig()); @@ -20,6 +20,11 @@ export const apiVVersionOdataControllerCount = (options: Options) => { return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/simple:operation' +}); }; + export const getCallWithoutParametersAndResponse = (options?: Options) => { return (options?.client ?? client).get({ ...options, url: '/api/v{api-version}/simple' diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-vue-query/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-vue-query/types.gen.ts.snap index 551e477cf..a854a09d1 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-vue-query/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-vue-query/types.gen.ts.snap @@ -1098,6 +1098,19 @@ export type ApiVversionOdataControllerCountResponse = (Model_From_Zendesk); export type ApiVversionOdataControllerCountError = unknown; +export type GetApiVbyApiVersionSimpleOperationData = { + path: { + /** + * foo in method + */ + foo_param: string; + }; +}; + +export type GetApiVbyApiVersionSimpleOperationResponse = (number); + +export type GetApiVbyApiVersionSimpleOperationError = (ModelWithBoolean); + export type DeleteFooData3 = { headers: { /** diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios/services.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios/services.gen.ts.snap index c1ca53fa3..a9d7b030a 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios/services.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios/services.gen.ts.snap @@ -1,7 +1,7 @@ // This file is auto-generated by @hey-api/openapi-ts import { createClient, createConfig, type Options, formDataBodySerializer, urlSearchParamsBodySerializer } from '@hey-api/client-axios'; -import type { ImportData, ImportError, ImportResponse, ApiVversionOdataControllerCountError, ApiVversionOdataControllerCountResponse, DeleteFooData3, CallWithDescriptionsData, DeprecatedCallData, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamData, PostCallWithOptionalParamError, PostCallWithOptionalParamResponse, PostApiVbyApiVersionRequestBodyData, PostApiVbyApiVersionFormDataData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, CallWithNoContentResponseError, CallWithNoContentResponseResponse, CallWithResponseAndNoContentResponseError, CallWithResponseAndNoContentResponseResponse, DummyAError, DummyAResponse, DummyBError, DummyBResponse, CallWithResponseError, CallWithResponseResponse, CallWithDuplicateResponsesError, CallWithDuplicateResponsesResponse, CallWithResponsesError, CallWithResponsesResponse, CollectionFormatData, TypesData, TypesError, TypesResponse, UploadFileData, UploadFileError, UploadFileResponse, FileResponseData, FileResponseError, FileResponseResponse, ComplexTypesData, ComplexTypesError, ComplexTypesResponse, MultipartRequestData, MultipartResponseError, MultipartResponseResponse, ComplexParamsData, ComplexParamsError, ComplexParamsResponse, CallWithResultFromHeaderError, CallWithResultFromHeaderResponse, TestErrorCodeData, TestErrorCodeError, TestErrorCodeResponse, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Error, NonAsciiæøåÆøÅöôêÊ字符串Response, PutWithFormUrlEncodedData } from './types.gen'; +import type { ImportData, ImportError, ImportResponse, ApiVversionOdataControllerCountError, ApiVversionOdataControllerCountResponse, GetApiVbyApiVersionSimpleOperationData, GetApiVbyApiVersionSimpleOperationError, GetApiVbyApiVersionSimpleOperationResponse, DeleteFooData3, CallWithDescriptionsData, DeprecatedCallData, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamData, PostCallWithOptionalParamError, PostCallWithOptionalParamResponse, PostApiVbyApiVersionRequestBodyData, PostApiVbyApiVersionFormDataData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, CallWithNoContentResponseError, CallWithNoContentResponseResponse, CallWithResponseAndNoContentResponseError, CallWithResponseAndNoContentResponseResponse, DummyAError, DummyAResponse, DummyBError, DummyBResponse, CallWithResponseError, CallWithResponseResponse, CallWithDuplicateResponsesError, CallWithDuplicateResponsesResponse, CallWithResponsesError, CallWithResponsesResponse, CollectionFormatData, TypesData, TypesError, TypesResponse, UploadFileData, UploadFileError, UploadFileResponse, FileResponseData, FileResponseError, FileResponseResponse, ComplexTypesData, ComplexTypesError, ComplexTypesResponse, MultipartRequestData, MultipartResponseError, MultipartResponseResponse, ComplexParamsData, ComplexParamsError, ComplexParamsResponse, CallWithResultFromHeaderError, CallWithResultFromHeaderResponse, TestErrorCodeData, TestErrorCodeError, TestErrorCodeResponse, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Error, NonAsciiæøåÆøÅöôêÊ字符串Response, PutWithFormUrlEncodedData } from './types.gen'; export const client = createClient(createConfig()); @@ -20,6 +20,11 @@ export const apiVVersionOdataControllerCount = (options: Options) => { return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/simple:operation' +}); }; + export const getCallWithoutParametersAndResponse = (options?: Options) => { return (options?.client ?? client).get({ ...options, url: '/api/v{api-version}/simple' diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios/types.gen.ts.snap index 551e477cf..a854a09d1 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios/types.gen.ts.snap @@ -1098,6 +1098,19 @@ export type ApiVversionOdataControllerCountResponse = (Model_From_Zendesk); export type ApiVversionOdataControllerCountError = unknown; +export type GetApiVbyApiVersionSimpleOperationData = { + path: { + /** + * foo in method + */ + foo_param: string; + }; +}; + +export type GetApiVbyApiVersionSimpleOperationResponse = (number); + +export type GetApiVbyApiVersionSimpleOperationError = (ModelWithBoolean); + export type DeleteFooData3 = { headers: { /** diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle/services.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle/services.gen.ts.snap index 6788d7ccd..a5bcc8f61 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle/services.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle/services.gen.ts.snap @@ -1,7 +1,7 @@ // This file is auto-generated by @hey-api/openapi-ts import { createClient, createConfig, type Options, formDataBodySerializer, urlSearchParamsBodySerializer } from './client'; -import type { ImportData, ImportError, ImportResponse, ApiVversionOdataControllerCountError, ApiVversionOdataControllerCountResponse, DeleteFooData3, CallWithDescriptionsData, DeprecatedCallData, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamData, PostCallWithOptionalParamError, PostCallWithOptionalParamResponse, PostApiVbyApiVersionRequestBodyData, PostApiVbyApiVersionFormDataData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, CallWithNoContentResponseError, CallWithNoContentResponseResponse, CallWithResponseAndNoContentResponseError, CallWithResponseAndNoContentResponseResponse, DummyAError, DummyAResponse, DummyBError, DummyBResponse, CallWithResponseError, CallWithResponseResponse, CallWithDuplicateResponsesError, CallWithDuplicateResponsesResponse, CallWithResponsesError, CallWithResponsesResponse, CollectionFormatData, TypesData, TypesError, TypesResponse, UploadFileData, UploadFileError, UploadFileResponse, FileResponseData, FileResponseError, FileResponseResponse, ComplexTypesData, ComplexTypesError, ComplexTypesResponse, MultipartRequestData, MultipartResponseError, MultipartResponseResponse, ComplexParamsData, ComplexParamsError, ComplexParamsResponse, CallWithResultFromHeaderError, CallWithResultFromHeaderResponse, TestErrorCodeData, TestErrorCodeError, TestErrorCodeResponse, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Error, NonAsciiæøåÆøÅöôêÊ字符串Response, PutWithFormUrlEncodedData } from './types.gen'; +import type { ImportData, ImportError, ImportResponse, ApiVversionOdataControllerCountError, ApiVversionOdataControllerCountResponse, GetApiVbyApiVersionSimpleOperationData, GetApiVbyApiVersionSimpleOperationError, GetApiVbyApiVersionSimpleOperationResponse, DeleteFooData3, CallWithDescriptionsData, DeprecatedCallData, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamData, PostCallWithOptionalParamError, PostCallWithOptionalParamResponse, PostApiVbyApiVersionRequestBodyData, PostApiVbyApiVersionFormDataData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, CallWithNoContentResponseError, CallWithNoContentResponseResponse, CallWithResponseAndNoContentResponseError, CallWithResponseAndNoContentResponseResponse, DummyAError, DummyAResponse, DummyBError, DummyBResponse, CallWithResponseError, CallWithResponseResponse, CallWithDuplicateResponsesError, CallWithDuplicateResponsesResponse, CallWithResponsesError, CallWithResponsesResponse, CollectionFormatData, TypesData, TypesError, TypesResponse, UploadFileData, UploadFileError, UploadFileResponse, FileResponseData, FileResponseError, FileResponseResponse, ComplexTypesData, ComplexTypesError, ComplexTypesResponse, MultipartRequestData, MultipartResponseError, MultipartResponseResponse, ComplexParamsData, ComplexParamsError, ComplexParamsResponse, CallWithResultFromHeaderError, CallWithResultFromHeaderResponse, TestErrorCodeData, TestErrorCodeError, TestErrorCodeResponse, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Error, NonAsciiæøåÆøÅöôêÊ字符串Response, PutWithFormUrlEncodedData } from './types.gen'; export const client = createClient(createConfig()); @@ -20,6 +20,11 @@ export const apiVVersionOdataControllerCount = (options: Options) => { return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/simple:operation' +}); }; + export const getCallWithoutParametersAndResponse = (options?: Options) => { return (options?.client ?? client).get({ ...options, url: '/api/v{api-version}/simple' diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle/types.gen.ts.snap index 551e477cf..a854a09d1 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle/types.gen.ts.snap @@ -1098,6 +1098,19 @@ export type ApiVversionOdataControllerCountResponse = (Model_From_Zendesk); export type ApiVversionOdataControllerCountError = unknown; +export type GetApiVbyApiVersionSimpleOperationData = { + path: { + /** + * foo in method + */ + foo_param: string; + }; +}; + +export type GetApiVbyApiVersionSimpleOperationResponse = (number); + +export type GetApiVbyApiVersionSimpleOperationError = (ModelWithBoolean); + export type DeleteFooData3 = { headers: { /** diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-class/services.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-class/services.gen.ts.snap index a9455b595..45f6402b0 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-class/services.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-class/services.gen.ts.snap @@ -1,7 +1,7 @@ // This file is auto-generated by @hey-api/openapi-ts import { createClient, createConfig, type Options, formDataBodySerializer, urlSearchParamsBodySerializer } from '@hey-api/client-fetch'; -import type { ImportData, ImportError, ImportResponse, ApiVversionOdataControllerCountError, ApiVversionOdataControllerCountResponse, DeleteFooData3, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamData, PostCallWithOptionalParamError, PostCallWithOptionalParamResponse, CallWithDescriptionsData, DeprecatedCallData, PostApiVbyApiVersionRequestBodyData, PostApiVbyApiVersionFormDataData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, CallWithNoContentResponseError, CallWithNoContentResponseResponse, CallWithResponseAndNoContentResponseError, CallWithResponseAndNoContentResponseResponse, CallWithResponseError, CallWithResponseResponse, CallWithDuplicateResponsesError, CallWithDuplicateResponsesResponse, CallWithResponsesError, CallWithResponsesResponse, DummyAError, DummyAResponse, DummyBError, DummyBResponse, CollectionFormatData, TypesData, TypesError, TypesResponse, UploadFileData, UploadFileError, UploadFileResponse, FileResponseData, FileResponseError, FileResponseResponse, ComplexTypesData, ComplexTypesError, ComplexTypesResponse, ComplexParamsData, ComplexParamsError, ComplexParamsResponse, MultipartRequestData, MultipartResponseError, MultipartResponseResponse, CallWithResultFromHeaderError, CallWithResultFromHeaderResponse, TestErrorCodeData, TestErrorCodeError, TestErrorCodeResponse, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Error, NonAsciiæøåÆøÅöôêÊ字符串Response, PutWithFormUrlEncodedData } from './types.gen'; +import type { ImportData, ImportError, ImportResponse, GetApiVbyApiVersionSimpleOperationData, GetApiVbyApiVersionSimpleOperationError, GetApiVbyApiVersionSimpleOperationResponse, ApiVversionOdataControllerCountError, ApiVversionOdataControllerCountResponse, DeleteFooData3, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamData, PostCallWithOptionalParamError, PostCallWithOptionalParamResponse, CallWithDescriptionsData, DeprecatedCallData, PostApiVbyApiVersionRequestBodyData, PostApiVbyApiVersionFormDataData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, CallWithNoContentResponseError, CallWithNoContentResponseResponse, CallWithResponseAndNoContentResponseError, CallWithResponseAndNoContentResponseResponse, CallWithResponseError, CallWithResponseResponse, CallWithDuplicateResponsesError, CallWithDuplicateResponsesResponse, CallWithResponsesError, CallWithResponsesResponse, DummyAError, DummyAResponse, DummyBError, DummyBResponse, CollectionFormatData, TypesData, TypesError, TypesResponse, UploadFileData, UploadFileError, UploadFileResponse, FileResponseData, FileResponseError, FileResponseResponse, ComplexTypesData, ComplexTypesError, ComplexTypesResponse, ComplexParamsData, ComplexParamsError, ComplexParamsResponse, MultipartRequestData, MultipartResponseError, MultipartResponseResponse, CallWithResultFromHeaderError, CallWithResultFromHeaderResponse, TestErrorCodeData, TestErrorCodeError, TestErrorCodeResponse, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Error, NonAsciiæøåÆøÅöôêÊ字符串Response, PutWithFormUrlEncodedData } from './types.gen'; export const client = createClient(createConfig()); @@ -20,6 +20,13 @@ export class DefaultService { }); } + public static getApiVbyApiVersionSimpleOperation(options: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/simple:operation' + }); + } + } export class SimpleService { diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-class/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-class/types.gen.ts.snap index f8b80270a..93de0e1be 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-class/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-class/types.gen.ts.snap @@ -1094,6 +1094,19 @@ export type ImportResponse = (Model_From_Zendesk | ModelWithReadOnlyAndWriteOnly export type ImportError = unknown; +export type GetApiVbyApiVersionSimpleOperationData = { + path: { + /** + * foo in method + */ + foo_param: string; + }; +}; + +export type GetApiVbyApiVersionSimpleOperationResponse = (number); + +export type GetApiVbyApiVersionSimpleOperationError = (ModelWithBoolean); + export type ApiVversionOdataControllerCountResponse = (Model_From_Zendesk); export type ApiVversionOdataControllerCountError = unknown; diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-react-query/@tanstack/react-query.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-react-query/@tanstack/react-query.gen.ts.snap index a26aba5de..aef9e65fa 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-react-query/@tanstack/react-query.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-react-query/@tanstack/react-query.gen.ts.snap @@ -2,8 +2,8 @@ import type { Options } from '@hey-api/client-fetch'; import { queryOptions, type UseMutationOptions, type DefaultError, infiniteQueryOptions, type InfiniteData } from '@tanstack/react-query'; -import { client, export_, import_, apiVVersionOdataControllerCount, getCallWithoutParametersAndResponse, putCallWithoutParametersAndResponse, postCallWithoutParametersAndResponse, deleteCallWithoutParametersAndResponse, patchCallWithoutParametersAndResponse, deleteFoo, callWithDescriptions, deprecatedCall, callWithParameters, callWithWeirdParameterNames, getCallWithOptionalParam, postCallWithOptionalParam, postApiVbyApiVersionRequestBody, postApiVbyApiVersionFormData, callWithDefaultParameters, callWithDefaultOptionalParameters, callToTestOrderOfParams, duplicateName, duplicateName1, duplicateName2, duplicateName3, callWithNoContentResponse, callWithResponseAndNoContentResponse, dummyA, dummyB, callWithResponse, callWithDuplicateResponses, callWithResponses, collectionFormat, types, uploadFile, fileResponse, complexTypes, multipartRequest, multipartResponse, complexParams, callWithResultFromHeader, testErrorCode, nonAsciiæøåÆøÅöôêÊ字符串, putWithFormUrlEncoded } from '../services.gen'; -import type { ImportData, ImportError, ImportResponse, DeleteFooData3, CallWithDescriptionsData, DeprecatedCallData, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamData, PostCallWithOptionalParamError, PostCallWithOptionalParamResponse, PostApiVbyApiVersionRequestBodyData, PostApiVbyApiVersionFormDataData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, CallWithDuplicateResponsesError, CallWithDuplicateResponsesResponse, CallWithResponsesError, CallWithResponsesResponse, CollectionFormatData, TypesData, UploadFileData, UploadFileError, UploadFileResponse, FileResponseData, ComplexTypesData, MultipartRequestData, ComplexParamsData, ComplexParamsError, ComplexParamsResponse, CallWithResultFromHeaderError, CallWithResultFromHeaderResponse, TestErrorCodeData, TestErrorCodeError, TestErrorCodeResponse, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Error, NonAsciiæøåÆøÅöôêÊ字符串Response, PutWithFormUrlEncodedData } from '../types.gen'; +import { client, export_, import_, apiVVersionOdataControllerCount, getApiVbyApiVersionSimpleOperation, getCallWithoutParametersAndResponse, putCallWithoutParametersAndResponse, postCallWithoutParametersAndResponse, deleteCallWithoutParametersAndResponse, patchCallWithoutParametersAndResponse, deleteFoo, callWithDescriptions, deprecatedCall, callWithParameters, callWithWeirdParameterNames, getCallWithOptionalParam, postCallWithOptionalParam, postApiVbyApiVersionRequestBody, postApiVbyApiVersionFormData, callWithDefaultParameters, callWithDefaultOptionalParameters, callToTestOrderOfParams, duplicateName, duplicateName1, duplicateName2, duplicateName3, callWithNoContentResponse, callWithResponseAndNoContentResponse, dummyA, dummyB, callWithResponse, callWithDuplicateResponses, callWithResponses, collectionFormat, types, uploadFile, fileResponse, complexTypes, multipartRequest, multipartResponse, complexParams, callWithResultFromHeader, testErrorCode, nonAsciiæøåÆøÅöôêÊ字符串, putWithFormUrlEncoded } from '../services.gen'; +import type { ImportData, ImportError, ImportResponse, GetApiVbyApiVersionSimpleOperationData, DeleteFooData3, CallWithDescriptionsData, DeprecatedCallData, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamData, PostCallWithOptionalParamError, PostCallWithOptionalParamResponse, PostApiVbyApiVersionRequestBodyData, PostApiVbyApiVersionFormDataData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, CallWithDuplicateResponsesError, CallWithDuplicateResponsesResponse, CallWithResponsesError, CallWithResponsesResponse, CollectionFormatData, TypesData, UploadFileData, UploadFileError, UploadFileResponse, FileResponseData, ComplexTypesData, MultipartRequestData, ComplexParamsData, ComplexParamsError, ComplexParamsResponse, CallWithResultFromHeaderError, CallWithResultFromHeaderResponse, TestErrorCodeData, TestErrorCodeError, TestErrorCodeResponse, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Error, NonAsciiæøåÆøÅöôêÊ字符串Response, PutWithFormUrlEncodedData } from '../types.gen'; type QueryKey = [ Pick & { @@ -90,6 +90,22 @@ export const apiVVersionOdataControllerCountOptions = (options?: Options) => { r queryKey: apiVVersionOdataControllerCountQueryKey(options) }); }; +export const getApiVbyApiVersionSimpleOperationQueryKey = (options: Options) => [ + createQueryKey("getApiVbyApiVersionSimpleOperation", options) +]; + +export const getApiVbyApiVersionSimpleOperationOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await getApiVbyApiVersionSimpleOperation({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: getApiVbyApiVersionSimpleOperationQueryKey(options) +}); }; + export const getCallWithoutParametersAndResponseQueryKey = (options?: Options) => [ createQueryKey("getCallWithoutParametersAndResponse", options) ]; diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-react-query/services.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-react-query/services.gen.ts.snap index 83a74f503..69c1d614d 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-react-query/services.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-react-query/services.gen.ts.snap @@ -1,7 +1,7 @@ // This file is auto-generated by @hey-api/openapi-ts import { createClient, createConfig, type Options, formDataBodySerializer, urlSearchParamsBodySerializer } from '@hey-api/client-fetch'; -import type { ImportData, ImportError, ImportResponse, ApiVversionOdataControllerCountError, ApiVversionOdataControllerCountResponse, DeleteFooData3, CallWithDescriptionsData, DeprecatedCallData, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamData, PostCallWithOptionalParamError, PostCallWithOptionalParamResponse, PostApiVbyApiVersionRequestBodyData, PostApiVbyApiVersionFormDataData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, CallWithNoContentResponseError, CallWithNoContentResponseResponse, CallWithResponseAndNoContentResponseError, CallWithResponseAndNoContentResponseResponse, DummyAError, DummyAResponse, DummyBError, DummyBResponse, CallWithResponseError, CallWithResponseResponse, CallWithDuplicateResponsesError, CallWithDuplicateResponsesResponse, CallWithResponsesError, CallWithResponsesResponse, CollectionFormatData, TypesData, TypesError, TypesResponse, UploadFileData, UploadFileError, UploadFileResponse, FileResponseData, FileResponseError, FileResponseResponse, ComplexTypesData, ComplexTypesError, ComplexTypesResponse, MultipartRequestData, MultipartResponseError, MultipartResponseResponse, ComplexParamsData, ComplexParamsError, ComplexParamsResponse, CallWithResultFromHeaderError, CallWithResultFromHeaderResponse, TestErrorCodeData, TestErrorCodeError, TestErrorCodeResponse, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Error, NonAsciiæøåÆøÅöôêÊ字符串Response, PutWithFormUrlEncodedData } from './types.gen'; +import type { ImportData, ImportError, ImportResponse, ApiVversionOdataControllerCountError, ApiVversionOdataControllerCountResponse, GetApiVbyApiVersionSimpleOperationData, GetApiVbyApiVersionSimpleOperationError, GetApiVbyApiVersionSimpleOperationResponse, DeleteFooData3, CallWithDescriptionsData, DeprecatedCallData, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamData, PostCallWithOptionalParamError, PostCallWithOptionalParamResponse, PostApiVbyApiVersionRequestBodyData, PostApiVbyApiVersionFormDataData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, CallWithNoContentResponseError, CallWithNoContentResponseResponse, CallWithResponseAndNoContentResponseError, CallWithResponseAndNoContentResponseResponse, DummyAError, DummyAResponse, DummyBError, DummyBResponse, CallWithResponseError, CallWithResponseResponse, CallWithDuplicateResponsesError, CallWithDuplicateResponsesResponse, CallWithResponsesError, CallWithResponsesResponse, CollectionFormatData, TypesData, TypesError, TypesResponse, UploadFileData, UploadFileError, UploadFileResponse, FileResponseData, FileResponseError, FileResponseResponse, ComplexTypesData, ComplexTypesError, ComplexTypesResponse, MultipartRequestData, MultipartResponseError, MultipartResponseResponse, ComplexParamsData, ComplexParamsError, ComplexParamsResponse, CallWithResultFromHeaderError, CallWithResultFromHeaderResponse, TestErrorCodeData, TestErrorCodeError, TestErrorCodeResponse, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Error, NonAsciiæøåÆøÅöôêÊ字符串Response, PutWithFormUrlEncodedData } from './types.gen'; export const client = createClient(createConfig()); @@ -20,6 +20,11 @@ export const apiVVersionOdataControllerCount = (options: Options) => { return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/simple:operation' +}); }; + export const getCallWithoutParametersAndResponse = (options?: Options) => { return (options?.client ?? client).get({ ...options, url: '/api/v{api-version}/simple' diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-react-query/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-react-query/types.gen.ts.snap index 551e477cf..a854a09d1 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-react-query/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-react-query/types.gen.ts.snap @@ -1098,6 +1098,19 @@ export type ApiVversionOdataControllerCountResponse = (Model_From_Zendesk); export type ApiVversionOdataControllerCountError = unknown; +export type GetApiVbyApiVersionSimpleOperationData = { + path: { + /** + * foo in method + */ + foo_param: string; + }; +}; + +export type GetApiVbyApiVersionSimpleOperationResponse = (number); + +export type GetApiVbyApiVersionSimpleOperationError = (ModelWithBoolean); + export type DeleteFooData3 = { headers: { /** diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-solid-query/@tanstack/solid-query.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-solid-query/@tanstack/solid-query.gen.ts.snap index 5d6a8f4c9..4b2ecf0fc 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-solid-query/@tanstack/solid-query.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-solid-query/@tanstack/solid-query.gen.ts.snap @@ -2,8 +2,8 @@ import type { Options } from '@hey-api/client-fetch'; import { queryOptions, type MutationOptions, type DefaultError, infiniteQueryOptions, type InfiniteData } from '@tanstack/solid-query'; -import { client, export_, import_, apiVVersionOdataControllerCount, getCallWithoutParametersAndResponse, putCallWithoutParametersAndResponse, postCallWithoutParametersAndResponse, deleteCallWithoutParametersAndResponse, patchCallWithoutParametersAndResponse, deleteFoo, callWithDescriptions, deprecatedCall, callWithParameters, callWithWeirdParameterNames, getCallWithOptionalParam, postCallWithOptionalParam, postApiVbyApiVersionRequestBody, postApiVbyApiVersionFormData, callWithDefaultParameters, callWithDefaultOptionalParameters, callToTestOrderOfParams, duplicateName, duplicateName1, duplicateName2, duplicateName3, callWithNoContentResponse, callWithResponseAndNoContentResponse, dummyA, dummyB, callWithResponse, callWithDuplicateResponses, callWithResponses, collectionFormat, types, uploadFile, fileResponse, complexTypes, multipartRequest, multipartResponse, complexParams, callWithResultFromHeader, testErrorCode, nonAsciiæøåÆøÅöôêÊ字符串, putWithFormUrlEncoded } from '../services.gen'; -import type { ImportData, ImportError, ImportResponse, DeleteFooData3, CallWithDescriptionsData, DeprecatedCallData, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamData, PostCallWithOptionalParamError, PostCallWithOptionalParamResponse, PostApiVbyApiVersionRequestBodyData, PostApiVbyApiVersionFormDataData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, CallWithDuplicateResponsesError, CallWithDuplicateResponsesResponse, CallWithResponsesError, CallWithResponsesResponse, CollectionFormatData, TypesData, UploadFileData, UploadFileError, UploadFileResponse, FileResponseData, ComplexTypesData, MultipartRequestData, ComplexParamsData, ComplexParamsError, ComplexParamsResponse, CallWithResultFromHeaderError, CallWithResultFromHeaderResponse, TestErrorCodeData, TestErrorCodeError, TestErrorCodeResponse, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Error, NonAsciiæøåÆøÅöôêÊ字符串Response, PutWithFormUrlEncodedData } from '../types.gen'; +import { client, export_, import_, apiVVersionOdataControllerCount, getApiVbyApiVersionSimpleOperation, getCallWithoutParametersAndResponse, putCallWithoutParametersAndResponse, postCallWithoutParametersAndResponse, deleteCallWithoutParametersAndResponse, patchCallWithoutParametersAndResponse, deleteFoo, callWithDescriptions, deprecatedCall, callWithParameters, callWithWeirdParameterNames, getCallWithOptionalParam, postCallWithOptionalParam, postApiVbyApiVersionRequestBody, postApiVbyApiVersionFormData, callWithDefaultParameters, callWithDefaultOptionalParameters, callToTestOrderOfParams, duplicateName, duplicateName1, duplicateName2, duplicateName3, callWithNoContentResponse, callWithResponseAndNoContentResponse, dummyA, dummyB, callWithResponse, callWithDuplicateResponses, callWithResponses, collectionFormat, types, uploadFile, fileResponse, complexTypes, multipartRequest, multipartResponse, complexParams, callWithResultFromHeader, testErrorCode, nonAsciiæøåÆøÅöôêÊ字符串, putWithFormUrlEncoded } from '../services.gen'; +import type { ImportData, ImportError, ImportResponse, GetApiVbyApiVersionSimpleOperationData, DeleteFooData3, CallWithDescriptionsData, DeprecatedCallData, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamData, PostCallWithOptionalParamError, PostCallWithOptionalParamResponse, PostApiVbyApiVersionRequestBodyData, PostApiVbyApiVersionFormDataData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, CallWithDuplicateResponsesError, CallWithDuplicateResponsesResponse, CallWithResponsesError, CallWithResponsesResponse, CollectionFormatData, TypesData, UploadFileData, UploadFileError, UploadFileResponse, FileResponseData, ComplexTypesData, MultipartRequestData, ComplexParamsData, ComplexParamsError, ComplexParamsResponse, CallWithResultFromHeaderError, CallWithResultFromHeaderResponse, TestErrorCodeData, TestErrorCodeError, TestErrorCodeResponse, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Error, NonAsciiæøåÆøÅöôêÊ字符串Response, PutWithFormUrlEncodedData } from '../types.gen'; type QueryKey = [ Pick & { @@ -90,6 +90,22 @@ export const apiVVersionOdataControllerCountOptions = (options?: Options) => { r queryKey: apiVVersionOdataControllerCountQueryKey(options) }); }; +export const getApiVbyApiVersionSimpleOperationQueryKey = (options: Options) => [ + createQueryKey("getApiVbyApiVersionSimpleOperation", options) +]; + +export const getApiVbyApiVersionSimpleOperationOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await getApiVbyApiVersionSimpleOperation({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: getApiVbyApiVersionSimpleOperationQueryKey(options) +}); }; + export const getCallWithoutParametersAndResponseQueryKey = (options?: Options) => [ createQueryKey("getCallWithoutParametersAndResponse", options) ]; diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-solid-query/services.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-solid-query/services.gen.ts.snap index 83a74f503..69c1d614d 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-solid-query/services.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-solid-query/services.gen.ts.snap @@ -1,7 +1,7 @@ // This file is auto-generated by @hey-api/openapi-ts import { createClient, createConfig, type Options, formDataBodySerializer, urlSearchParamsBodySerializer } from '@hey-api/client-fetch'; -import type { ImportData, ImportError, ImportResponse, ApiVversionOdataControllerCountError, ApiVversionOdataControllerCountResponse, DeleteFooData3, CallWithDescriptionsData, DeprecatedCallData, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamData, PostCallWithOptionalParamError, PostCallWithOptionalParamResponse, PostApiVbyApiVersionRequestBodyData, PostApiVbyApiVersionFormDataData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, CallWithNoContentResponseError, CallWithNoContentResponseResponse, CallWithResponseAndNoContentResponseError, CallWithResponseAndNoContentResponseResponse, DummyAError, DummyAResponse, DummyBError, DummyBResponse, CallWithResponseError, CallWithResponseResponse, CallWithDuplicateResponsesError, CallWithDuplicateResponsesResponse, CallWithResponsesError, CallWithResponsesResponse, CollectionFormatData, TypesData, TypesError, TypesResponse, UploadFileData, UploadFileError, UploadFileResponse, FileResponseData, FileResponseError, FileResponseResponse, ComplexTypesData, ComplexTypesError, ComplexTypesResponse, MultipartRequestData, MultipartResponseError, MultipartResponseResponse, ComplexParamsData, ComplexParamsError, ComplexParamsResponse, CallWithResultFromHeaderError, CallWithResultFromHeaderResponse, TestErrorCodeData, TestErrorCodeError, TestErrorCodeResponse, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Error, NonAsciiæøåÆøÅöôêÊ字符串Response, PutWithFormUrlEncodedData } from './types.gen'; +import type { ImportData, ImportError, ImportResponse, ApiVversionOdataControllerCountError, ApiVversionOdataControllerCountResponse, GetApiVbyApiVersionSimpleOperationData, GetApiVbyApiVersionSimpleOperationError, GetApiVbyApiVersionSimpleOperationResponse, DeleteFooData3, CallWithDescriptionsData, DeprecatedCallData, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamData, PostCallWithOptionalParamError, PostCallWithOptionalParamResponse, PostApiVbyApiVersionRequestBodyData, PostApiVbyApiVersionFormDataData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, CallWithNoContentResponseError, CallWithNoContentResponseResponse, CallWithResponseAndNoContentResponseError, CallWithResponseAndNoContentResponseResponse, DummyAError, DummyAResponse, DummyBError, DummyBResponse, CallWithResponseError, CallWithResponseResponse, CallWithDuplicateResponsesError, CallWithDuplicateResponsesResponse, CallWithResponsesError, CallWithResponsesResponse, CollectionFormatData, TypesData, TypesError, TypesResponse, UploadFileData, UploadFileError, UploadFileResponse, FileResponseData, FileResponseError, FileResponseResponse, ComplexTypesData, ComplexTypesError, ComplexTypesResponse, MultipartRequestData, MultipartResponseError, MultipartResponseResponse, ComplexParamsData, ComplexParamsError, ComplexParamsResponse, CallWithResultFromHeaderError, CallWithResultFromHeaderResponse, TestErrorCodeData, TestErrorCodeError, TestErrorCodeResponse, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Error, NonAsciiæøåÆøÅöôêÊ字符串Response, PutWithFormUrlEncodedData } from './types.gen'; export const client = createClient(createConfig()); @@ -20,6 +20,11 @@ export const apiVVersionOdataControllerCount = (options: Options) => { return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/simple:operation' +}); }; + export const getCallWithoutParametersAndResponse = (options?: Options) => { return (options?.client ?? client).get({ ...options, url: '/api/v{api-version}/simple' diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-solid-query/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-solid-query/types.gen.ts.snap index 551e477cf..a854a09d1 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-solid-query/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-solid-query/types.gen.ts.snap @@ -1098,6 +1098,19 @@ export type ApiVversionOdataControllerCountResponse = (Model_From_Zendesk); export type ApiVversionOdataControllerCountError = unknown; +export type GetApiVbyApiVersionSimpleOperationData = { + path: { + /** + * foo in method + */ + foo_param: string; + }; +}; + +export type GetApiVbyApiVersionSimpleOperationResponse = (number); + +export type GetApiVbyApiVersionSimpleOperationError = (ModelWithBoolean); + export type DeleteFooData3 = { headers: { /** diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-svelte-query/@tanstack/svelte-query.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-svelte-query/@tanstack/svelte-query.gen.ts.snap index a413a6926..a20ed8feb 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-svelte-query/@tanstack/svelte-query.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-svelte-query/@tanstack/svelte-query.gen.ts.snap @@ -2,8 +2,8 @@ import type { Options } from '@hey-api/client-fetch'; import { queryOptions, type MutationOptions, type DefaultError, infiniteQueryOptions, type InfiniteData } from '@tanstack/svelte-query'; -import { client, export_, import_, apiVVersionOdataControllerCount, getCallWithoutParametersAndResponse, putCallWithoutParametersAndResponse, postCallWithoutParametersAndResponse, deleteCallWithoutParametersAndResponse, patchCallWithoutParametersAndResponse, deleteFoo, callWithDescriptions, deprecatedCall, callWithParameters, callWithWeirdParameterNames, getCallWithOptionalParam, postCallWithOptionalParam, postApiVbyApiVersionRequestBody, postApiVbyApiVersionFormData, callWithDefaultParameters, callWithDefaultOptionalParameters, callToTestOrderOfParams, duplicateName, duplicateName1, duplicateName2, duplicateName3, callWithNoContentResponse, callWithResponseAndNoContentResponse, dummyA, dummyB, callWithResponse, callWithDuplicateResponses, callWithResponses, collectionFormat, types, uploadFile, fileResponse, complexTypes, multipartRequest, multipartResponse, complexParams, callWithResultFromHeader, testErrorCode, nonAsciiæøåÆøÅöôêÊ字符串, putWithFormUrlEncoded } from '../services.gen'; -import type { ImportData, ImportError, ImportResponse, DeleteFooData3, CallWithDescriptionsData, DeprecatedCallData, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamData, PostCallWithOptionalParamError, PostCallWithOptionalParamResponse, PostApiVbyApiVersionRequestBodyData, PostApiVbyApiVersionFormDataData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, CallWithDuplicateResponsesError, CallWithDuplicateResponsesResponse, CallWithResponsesError, CallWithResponsesResponse, CollectionFormatData, TypesData, UploadFileData, UploadFileError, UploadFileResponse, FileResponseData, ComplexTypesData, MultipartRequestData, ComplexParamsData, ComplexParamsError, ComplexParamsResponse, CallWithResultFromHeaderError, CallWithResultFromHeaderResponse, TestErrorCodeData, TestErrorCodeError, TestErrorCodeResponse, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Error, NonAsciiæøåÆøÅöôêÊ字符串Response, PutWithFormUrlEncodedData } from '../types.gen'; +import { client, export_, import_, apiVVersionOdataControllerCount, getApiVbyApiVersionSimpleOperation, getCallWithoutParametersAndResponse, putCallWithoutParametersAndResponse, postCallWithoutParametersAndResponse, deleteCallWithoutParametersAndResponse, patchCallWithoutParametersAndResponse, deleteFoo, callWithDescriptions, deprecatedCall, callWithParameters, callWithWeirdParameterNames, getCallWithOptionalParam, postCallWithOptionalParam, postApiVbyApiVersionRequestBody, postApiVbyApiVersionFormData, callWithDefaultParameters, callWithDefaultOptionalParameters, callToTestOrderOfParams, duplicateName, duplicateName1, duplicateName2, duplicateName3, callWithNoContentResponse, callWithResponseAndNoContentResponse, dummyA, dummyB, callWithResponse, callWithDuplicateResponses, callWithResponses, collectionFormat, types, uploadFile, fileResponse, complexTypes, multipartRequest, multipartResponse, complexParams, callWithResultFromHeader, testErrorCode, nonAsciiæøåÆøÅöôêÊ字符串, putWithFormUrlEncoded } from '../services.gen'; +import type { ImportData, ImportError, ImportResponse, GetApiVbyApiVersionSimpleOperationData, DeleteFooData3, CallWithDescriptionsData, DeprecatedCallData, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamData, PostCallWithOptionalParamError, PostCallWithOptionalParamResponse, PostApiVbyApiVersionRequestBodyData, PostApiVbyApiVersionFormDataData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, CallWithDuplicateResponsesError, CallWithDuplicateResponsesResponse, CallWithResponsesError, CallWithResponsesResponse, CollectionFormatData, TypesData, UploadFileData, UploadFileError, UploadFileResponse, FileResponseData, ComplexTypesData, MultipartRequestData, ComplexParamsData, ComplexParamsError, ComplexParamsResponse, CallWithResultFromHeaderError, CallWithResultFromHeaderResponse, TestErrorCodeData, TestErrorCodeError, TestErrorCodeResponse, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Error, NonAsciiæøåÆøÅöôêÊ字符串Response, PutWithFormUrlEncodedData } from '../types.gen'; type QueryKey = [ Pick & { @@ -90,6 +90,22 @@ export const apiVVersionOdataControllerCountOptions = (options?: Options) => { r queryKey: apiVVersionOdataControllerCountQueryKey(options) }); }; +export const getApiVbyApiVersionSimpleOperationQueryKey = (options: Options) => [ + createQueryKey("getApiVbyApiVersionSimpleOperation", options) +]; + +export const getApiVbyApiVersionSimpleOperationOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await getApiVbyApiVersionSimpleOperation({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: getApiVbyApiVersionSimpleOperationQueryKey(options) +}); }; + export const getCallWithoutParametersAndResponseQueryKey = (options?: Options) => [ createQueryKey("getCallWithoutParametersAndResponse", options) ]; diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-svelte-query/services.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-svelte-query/services.gen.ts.snap index 83a74f503..69c1d614d 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-svelte-query/services.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-svelte-query/services.gen.ts.snap @@ -1,7 +1,7 @@ // This file is auto-generated by @hey-api/openapi-ts import { createClient, createConfig, type Options, formDataBodySerializer, urlSearchParamsBodySerializer } from '@hey-api/client-fetch'; -import type { ImportData, ImportError, ImportResponse, ApiVversionOdataControllerCountError, ApiVversionOdataControllerCountResponse, DeleteFooData3, CallWithDescriptionsData, DeprecatedCallData, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamData, PostCallWithOptionalParamError, PostCallWithOptionalParamResponse, PostApiVbyApiVersionRequestBodyData, PostApiVbyApiVersionFormDataData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, CallWithNoContentResponseError, CallWithNoContentResponseResponse, CallWithResponseAndNoContentResponseError, CallWithResponseAndNoContentResponseResponse, DummyAError, DummyAResponse, DummyBError, DummyBResponse, CallWithResponseError, CallWithResponseResponse, CallWithDuplicateResponsesError, CallWithDuplicateResponsesResponse, CallWithResponsesError, CallWithResponsesResponse, CollectionFormatData, TypesData, TypesError, TypesResponse, UploadFileData, UploadFileError, UploadFileResponse, FileResponseData, FileResponseError, FileResponseResponse, ComplexTypesData, ComplexTypesError, ComplexTypesResponse, MultipartRequestData, MultipartResponseError, MultipartResponseResponse, ComplexParamsData, ComplexParamsError, ComplexParamsResponse, CallWithResultFromHeaderError, CallWithResultFromHeaderResponse, TestErrorCodeData, TestErrorCodeError, TestErrorCodeResponse, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Error, NonAsciiæøåÆøÅöôêÊ字符串Response, PutWithFormUrlEncodedData } from './types.gen'; +import type { ImportData, ImportError, ImportResponse, ApiVversionOdataControllerCountError, ApiVversionOdataControllerCountResponse, GetApiVbyApiVersionSimpleOperationData, GetApiVbyApiVersionSimpleOperationError, GetApiVbyApiVersionSimpleOperationResponse, DeleteFooData3, CallWithDescriptionsData, DeprecatedCallData, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamData, PostCallWithOptionalParamError, PostCallWithOptionalParamResponse, PostApiVbyApiVersionRequestBodyData, PostApiVbyApiVersionFormDataData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, CallWithNoContentResponseError, CallWithNoContentResponseResponse, CallWithResponseAndNoContentResponseError, CallWithResponseAndNoContentResponseResponse, DummyAError, DummyAResponse, DummyBError, DummyBResponse, CallWithResponseError, CallWithResponseResponse, CallWithDuplicateResponsesError, CallWithDuplicateResponsesResponse, CallWithResponsesError, CallWithResponsesResponse, CollectionFormatData, TypesData, TypesError, TypesResponse, UploadFileData, UploadFileError, UploadFileResponse, FileResponseData, FileResponseError, FileResponseResponse, ComplexTypesData, ComplexTypesError, ComplexTypesResponse, MultipartRequestData, MultipartResponseError, MultipartResponseResponse, ComplexParamsData, ComplexParamsError, ComplexParamsResponse, CallWithResultFromHeaderError, CallWithResultFromHeaderResponse, TestErrorCodeData, TestErrorCodeError, TestErrorCodeResponse, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Error, NonAsciiæøåÆøÅöôêÊ字符串Response, PutWithFormUrlEncodedData } from './types.gen'; export const client = createClient(createConfig()); @@ -20,6 +20,11 @@ export const apiVVersionOdataControllerCount = (options: Options) => { return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/simple:operation' +}); }; + export const getCallWithoutParametersAndResponse = (options?: Options) => { return (options?.client ?? client).get({ ...options, url: '/api/v{api-version}/simple' diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-svelte-query/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-svelte-query/types.gen.ts.snap index 551e477cf..a854a09d1 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-svelte-query/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-svelte-query/types.gen.ts.snap @@ -1098,6 +1098,19 @@ export type ApiVversionOdataControllerCountResponse = (Model_From_Zendesk); export type ApiVversionOdataControllerCountError = unknown; +export type GetApiVbyApiVersionSimpleOperationData = { + path: { + /** + * foo in method + */ + foo_param: string; + }; +}; + +export type GetApiVbyApiVersionSimpleOperationResponse = (number); + +export type GetApiVbyApiVersionSimpleOperationError = (ModelWithBoolean); + export type DeleteFooData3 = { headers: { /** diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-vue-query/@tanstack/vue-query.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-vue-query/@tanstack/vue-query.gen.ts.snap index cef84e8de..041d3c50e 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-vue-query/@tanstack/vue-query.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-vue-query/@tanstack/vue-query.gen.ts.snap @@ -2,8 +2,8 @@ import type { Options } from '@hey-api/client-fetch'; import { queryOptions, type UseMutationOptions, type DefaultError, infiniteQueryOptions, type InfiniteData } from '@tanstack/vue-query'; -import { client, export_, import_, apiVVersionOdataControllerCount, getCallWithoutParametersAndResponse, putCallWithoutParametersAndResponse, postCallWithoutParametersAndResponse, deleteCallWithoutParametersAndResponse, patchCallWithoutParametersAndResponse, deleteFoo, callWithDescriptions, deprecatedCall, callWithParameters, callWithWeirdParameterNames, getCallWithOptionalParam, postCallWithOptionalParam, postApiVbyApiVersionRequestBody, postApiVbyApiVersionFormData, callWithDefaultParameters, callWithDefaultOptionalParameters, callToTestOrderOfParams, duplicateName, duplicateName1, duplicateName2, duplicateName3, callWithNoContentResponse, callWithResponseAndNoContentResponse, dummyA, dummyB, callWithResponse, callWithDuplicateResponses, callWithResponses, collectionFormat, types, uploadFile, fileResponse, complexTypes, multipartRequest, multipartResponse, complexParams, callWithResultFromHeader, testErrorCode, nonAsciiæøåÆøÅöôêÊ字符串, putWithFormUrlEncoded } from '../services.gen'; -import type { ImportData, ImportError, ImportResponse, DeleteFooData3, CallWithDescriptionsData, DeprecatedCallData, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamData, PostCallWithOptionalParamError, PostCallWithOptionalParamResponse, PostApiVbyApiVersionRequestBodyData, PostApiVbyApiVersionFormDataData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, CallWithDuplicateResponsesError, CallWithDuplicateResponsesResponse, CallWithResponsesError, CallWithResponsesResponse, CollectionFormatData, TypesData, UploadFileData, UploadFileError, UploadFileResponse, FileResponseData, ComplexTypesData, MultipartRequestData, ComplexParamsData, ComplexParamsError, ComplexParamsResponse, CallWithResultFromHeaderError, CallWithResultFromHeaderResponse, TestErrorCodeData, TestErrorCodeError, TestErrorCodeResponse, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Error, NonAsciiæøåÆøÅöôêÊ字符串Response, PutWithFormUrlEncodedData } from '../types.gen'; +import { client, export_, import_, apiVVersionOdataControllerCount, getApiVbyApiVersionSimpleOperation, getCallWithoutParametersAndResponse, putCallWithoutParametersAndResponse, postCallWithoutParametersAndResponse, deleteCallWithoutParametersAndResponse, patchCallWithoutParametersAndResponse, deleteFoo, callWithDescriptions, deprecatedCall, callWithParameters, callWithWeirdParameterNames, getCallWithOptionalParam, postCallWithOptionalParam, postApiVbyApiVersionRequestBody, postApiVbyApiVersionFormData, callWithDefaultParameters, callWithDefaultOptionalParameters, callToTestOrderOfParams, duplicateName, duplicateName1, duplicateName2, duplicateName3, callWithNoContentResponse, callWithResponseAndNoContentResponse, dummyA, dummyB, callWithResponse, callWithDuplicateResponses, callWithResponses, collectionFormat, types, uploadFile, fileResponse, complexTypes, multipartRequest, multipartResponse, complexParams, callWithResultFromHeader, testErrorCode, nonAsciiæøåÆøÅöôêÊ字符串, putWithFormUrlEncoded } from '../services.gen'; +import type { ImportData, ImportError, ImportResponse, GetApiVbyApiVersionSimpleOperationData, DeleteFooData3, CallWithDescriptionsData, DeprecatedCallData, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamData, PostCallWithOptionalParamError, PostCallWithOptionalParamResponse, PostApiVbyApiVersionRequestBodyData, PostApiVbyApiVersionFormDataData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, CallWithDuplicateResponsesError, CallWithDuplicateResponsesResponse, CallWithResponsesError, CallWithResponsesResponse, CollectionFormatData, TypesData, UploadFileData, UploadFileError, UploadFileResponse, FileResponseData, ComplexTypesData, MultipartRequestData, ComplexParamsData, ComplexParamsError, ComplexParamsResponse, CallWithResultFromHeaderError, CallWithResultFromHeaderResponse, TestErrorCodeData, TestErrorCodeError, TestErrorCodeResponse, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Error, NonAsciiæøåÆøÅöôêÊ字符串Response, PutWithFormUrlEncodedData } from '../types.gen'; type QueryKey = [ Pick & { @@ -90,6 +90,22 @@ export const apiVVersionOdataControllerCountOptions = (options?: Options) => { r queryKey: apiVVersionOdataControllerCountQueryKey(options) }); }; +export const getApiVbyApiVersionSimpleOperationQueryKey = (options: Options) => [ + createQueryKey("getApiVbyApiVersionSimpleOperation", options) +]; + +export const getApiVbyApiVersionSimpleOperationOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await getApiVbyApiVersionSimpleOperation({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: getApiVbyApiVersionSimpleOperationQueryKey(options) +}); }; + export const getCallWithoutParametersAndResponseQueryKey = (options?: Options) => [ createQueryKey("getCallWithoutParametersAndResponse", options) ]; diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-vue-query/services.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-vue-query/services.gen.ts.snap index 83a74f503..69c1d614d 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-vue-query/services.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-vue-query/services.gen.ts.snap @@ -1,7 +1,7 @@ // This file is auto-generated by @hey-api/openapi-ts import { createClient, createConfig, type Options, formDataBodySerializer, urlSearchParamsBodySerializer } from '@hey-api/client-fetch'; -import type { ImportData, ImportError, ImportResponse, ApiVversionOdataControllerCountError, ApiVversionOdataControllerCountResponse, DeleteFooData3, CallWithDescriptionsData, DeprecatedCallData, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamData, PostCallWithOptionalParamError, PostCallWithOptionalParamResponse, PostApiVbyApiVersionRequestBodyData, PostApiVbyApiVersionFormDataData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, CallWithNoContentResponseError, CallWithNoContentResponseResponse, CallWithResponseAndNoContentResponseError, CallWithResponseAndNoContentResponseResponse, DummyAError, DummyAResponse, DummyBError, DummyBResponse, CallWithResponseError, CallWithResponseResponse, CallWithDuplicateResponsesError, CallWithDuplicateResponsesResponse, CallWithResponsesError, CallWithResponsesResponse, CollectionFormatData, TypesData, TypesError, TypesResponse, UploadFileData, UploadFileError, UploadFileResponse, FileResponseData, FileResponseError, FileResponseResponse, ComplexTypesData, ComplexTypesError, ComplexTypesResponse, MultipartRequestData, MultipartResponseError, MultipartResponseResponse, ComplexParamsData, ComplexParamsError, ComplexParamsResponse, CallWithResultFromHeaderError, CallWithResultFromHeaderResponse, TestErrorCodeData, TestErrorCodeError, TestErrorCodeResponse, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Error, NonAsciiæøåÆøÅöôêÊ字符串Response, PutWithFormUrlEncodedData } from './types.gen'; +import type { ImportData, ImportError, ImportResponse, ApiVversionOdataControllerCountError, ApiVversionOdataControllerCountResponse, GetApiVbyApiVersionSimpleOperationData, GetApiVbyApiVersionSimpleOperationError, GetApiVbyApiVersionSimpleOperationResponse, DeleteFooData3, CallWithDescriptionsData, DeprecatedCallData, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamData, PostCallWithOptionalParamError, PostCallWithOptionalParamResponse, PostApiVbyApiVersionRequestBodyData, PostApiVbyApiVersionFormDataData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, CallWithNoContentResponseError, CallWithNoContentResponseResponse, CallWithResponseAndNoContentResponseError, CallWithResponseAndNoContentResponseResponse, DummyAError, DummyAResponse, DummyBError, DummyBResponse, CallWithResponseError, CallWithResponseResponse, CallWithDuplicateResponsesError, CallWithDuplicateResponsesResponse, CallWithResponsesError, CallWithResponsesResponse, CollectionFormatData, TypesData, TypesError, TypesResponse, UploadFileData, UploadFileError, UploadFileResponse, FileResponseData, FileResponseError, FileResponseResponse, ComplexTypesData, ComplexTypesError, ComplexTypesResponse, MultipartRequestData, MultipartResponseError, MultipartResponseResponse, ComplexParamsData, ComplexParamsError, ComplexParamsResponse, CallWithResultFromHeaderError, CallWithResultFromHeaderResponse, TestErrorCodeData, TestErrorCodeError, TestErrorCodeResponse, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Error, NonAsciiæøåÆøÅöôêÊ字符串Response, PutWithFormUrlEncodedData } from './types.gen'; export const client = createClient(createConfig()); @@ -20,6 +20,11 @@ export const apiVVersionOdataControllerCount = (options: Options) => { return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/simple:operation' +}); }; + export const getCallWithoutParametersAndResponse = (options?: Options) => { return (options?.client ?? client).get({ ...options, url: '/api/v{api-version}/simple' diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-vue-query/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-vue-query/types.gen.ts.snap index 551e477cf..a854a09d1 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-vue-query/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-vue-query/types.gen.ts.snap @@ -1098,6 +1098,19 @@ export type ApiVversionOdataControllerCountResponse = (Model_From_Zendesk); export type ApiVversionOdataControllerCountError = unknown; +export type GetApiVbyApiVersionSimpleOperationData = { + path: { + /** + * foo in method + */ + foo_param: string; + }; +}; + +export type GetApiVbyApiVersionSimpleOperationResponse = (number); + +export type GetApiVbyApiVersionSimpleOperationError = (ModelWithBoolean); + export type DeleteFooData3 = { headers: { /** diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch/services.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch/services.gen.ts.snap index 83a74f503..69c1d614d 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch/services.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch/services.gen.ts.snap @@ -1,7 +1,7 @@ // This file is auto-generated by @hey-api/openapi-ts import { createClient, createConfig, type Options, formDataBodySerializer, urlSearchParamsBodySerializer } from '@hey-api/client-fetch'; -import type { ImportData, ImportError, ImportResponse, ApiVversionOdataControllerCountError, ApiVversionOdataControllerCountResponse, DeleteFooData3, CallWithDescriptionsData, DeprecatedCallData, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamData, PostCallWithOptionalParamError, PostCallWithOptionalParamResponse, PostApiVbyApiVersionRequestBodyData, PostApiVbyApiVersionFormDataData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, CallWithNoContentResponseError, CallWithNoContentResponseResponse, CallWithResponseAndNoContentResponseError, CallWithResponseAndNoContentResponseResponse, DummyAError, DummyAResponse, DummyBError, DummyBResponse, CallWithResponseError, CallWithResponseResponse, CallWithDuplicateResponsesError, CallWithDuplicateResponsesResponse, CallWithResponsesError, CallWithResponsesResponse, CollectionFormatData, TypesData, TypesError, TypesResponse, UploadFileData, UploadFileError, UploadFileResponse, FileResponseData, FileResponseError, FileResponseResponse, ComplexTypesData, ComplexTypesError, ComplexTypesResponse, MultipartRequestData, MultipartResponseError, MultipartResponseResponse, ComplexParamsData, ComplexParamsError, ComplexParamsResponse, CallWithResultFromHeaderError, CallWithResultFromHeaderResponse, TestErrorCodeData, TestErrorCodeError, TestErrorCodeResponse, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Error, NonAsciiæøåÆøÅöôêÊ字符串Response, PutWithFormUrlEncodedData } from './types.gen'; +import type { ImportData, ImportError, ImportResponse, ApiVversionOdataControllerCountError, ApiVversionOdataControllerCountResponse, GetApiVbyApiVersionSimpleOperationData, GetApiVbyApiVersionSimpleOperationError, GetApiVbyApiVersionSimpleOperationResponse, DeleteFooData3, CallWithDescriptionsData, DeprecatedCallData, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamData, PostCallWithOptionalParamError, PostCallWithOptionalParamResponse, PostApiVbyApiVersionRequestBodyData, PostApiVbyApiVersionFormDataData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, CallWithNoContentResponseError, CallWithNoContentResponseResponse, CallWithResponseAndNoContentResponseError, CallWithResponseAndNoContentResponseResponse, DummyAError, DummyAResponse, DummyBError, DummyBResponse, CallWithResponseError, CallWithResponseResponse, CallWithDuplicateResponsesError, CallWithDuplicateResponsesResponse, CallWithResponsesError, CallWithResponsesResponse, CollectionFormatData, TypesData, TypesError, TypesResponse, UploadFileData, UploadFileError, UploadFileResponse, FileResponseData, FileResponseError, FileResponseResponse, ComplexTypesData, ComplexTypesError, ComplexTypesResponse, MultipartRequestData, MultipartResponseError, MultipartResponseResponse, ComplexParamsData, ComplexParamsError, ComplexParamsResponse, CallWithResultFromHeaderError, CallWithResultFromHeaderResponse, TestErrorCodeData, TestErrorCodeError, TestErrorCodeResponse, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Error, NonAsciiæøåÆøÅöôêÊ字符串Response, PutWithFormUrlEncodedData } from './types.gen'; export const client = createClient(createConfig()); @@ -20,6 +20,11 @@ export const apiVVersionOdataControllerCount = (options: Options) => { return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/simple:operation' +}); }; + export const getCallWithoutParametersAndResponse = (options?: Options) => { return (options?.client ?? client).get({ ...options, url: '/api/v{api-version}/simple' diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch/types.gen.ts.snap index 551e477cf..a854a09d1 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch/types.gen.ts.snap @@ -1098,6 +1098,19 @@ export type ApiVversionOdataControllerCountResponse = (Model_From_Zendesk); export type ApiVversionOdataControllerCountError = unknown; +export type GetApiVbyApiVersionSimpleOperationData = { + path: { + /** + * foo in method + */ + foo_param: string; + }; +}; + +export type GetApiVbyApiVersionSimpleOperationResponse = (number); + +export type GetApiVbyApiVersionSimpleOperationError = (ModelWithBoolean); + export type DeleteFooData3 = { headers: { /** diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-types-PascalCase/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-types-PascalCase/types.gen.ts.snap index 3d246a451..628d84898 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-types-PascalCase/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-types-PascalCase/types.gen.ts.snap @@ -971,6 +971,15 @@ export type ImportResponse = (ModelFromZendesk | ModelWithReadOnlyAndWriteOnly); export type ApiVversionOdataControllerCountResponse = (ModelFromZendesk); +export type GetApiSimpleOperationData = { + /** + * foo in method + */ + fooParam: string; +}; + +export type GetApiSimpleOperationResponse = (number); + export type DeleteFooData3 = { /** * bar in method @@ -1414,6 +1423,21 @@ export type $OpenApiTs = { }; }; }; + '/api/v{api-version}/simple:operation': { + get: { + req: GetApiSimpleOperationData; + res: { + /** + * Response is a simple number + */ + 200: number; + /** + * Default error response + */ + default: ModelWithBoolean; + }; + }; + }; '/api/v{api-version}/foo/{foo_param}/bar/{BarParam}': { delete: { req: DeleteFooData3; diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3/services.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3/services.gen.ts.snap index 6f45b0b8f..2a6aaa80e 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3/services.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3/services.gen.ts.snap @@ -3,7 +3,7 @@ import type { CancelablePromise } from './core/CancelablePromise'; import { OpenAPI } from './core/OpenAPI'; import { request as __request } from './core/request'; -import type { ImportData, ImportResponse, ApiVversionOdataControllerCountResponse, DeleteFooData3, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamData, PostCallWithOptionalParamResponse, CallWithDescriptionsData, DeprecatedCallData, PostApiRequestBodyData, PostApiFormDataData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, CallWithNoContentResponseResponse, CallWithResponseAndNoContentResponseResponse, CallWithResponseResponse, CallWithDuplicateResponsesResponse, CallWithResponsesResponse, DummyAResponse, DummyBResponse, CollectionFormatData, TypesData, TypesResponse, UploadFileData, UploadFileResponse, FileResponseData, FileResponseResponse, ComplexTypesData, ComplexTypesResponse, ComplexParamsData, ComplexParamsResponse, MultipartRequestData, MultipartResponseResponse, CallWithResultFromHeaderResponse, TestErrorCodeData, TestErrorCodeResponse, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Response, PutWithFormUrlEncodedData } from './types.gen'; +import type { ImportData, ImportResponse, GetApiSimpleOperationData, GetApiSimpleOperationResponse, ApiVversionOdataControllerCountResponse, DeleteFooData3, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamData, PostCallWithOptionalParamResponse, CallWithDescriptionsData, DeprecatedCallData, PostApiRequestBodyData, PostApiFormDataData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, CallWithNoContentResponseResponse, CallWithResponseAndNoContentResponseResponse, CallWithResponseResponse, CallWithDuplicateResponsesResponse, CallWithResponsesResponse, DummyAResponse, DummyBResponse, CollectionFormatData, TypesData, TypesResponse, UploadFileData, UploadFileResponse, FileResponseData, FileResponseResponse, ComplexTypesData, ComplexTypesResponse, ComplexParamsData, ComplexParamsResponse, MultipartRequestData, MultipartResponseResponse, CallWithResultFromHeaderResponse, TestErrorCodeData, TestErrorCodeResponse, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Response, PutWithFormUrlEncodedData } from './types.gen'; export class DefaultService { /** @@ -32,6 +32,25 @@ export class DefaultService { }); } + /** + * @param data The data for the request. + * @param data.fooParam foo in method + * @returns number Response is a simple number + * @throws ApiError + */ + public static getApiSimpleOperation(data: GetApiSimpleOperationData): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/api/v{api-version}/simple:operation', + path: { + foo_param: data.fooParam + }, + errors: { + default: 'Default error response' + } + }); + } + } export class SimpleService { diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3/types.gen.ts.snap index 74093a0bf..e279b0733 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3/types.gen.ts.snap @@ -1092,6 +1092,15 @@ export type ImportData = { export type ImportResponse = (Model_From_Zendesk | ModelWithReadOnlyAndWriteOnly); +export type GetApiSimpleOperationData = { + /** + * foo in method + */ + fooParam: string; +}; + +export type GetApiSimpleOperationResponse = (number); + export type ApiVversionOdataControllerCountResponse = (Model_From_Zendesk); export type DeleteFooData3 = { diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_angular/services.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3_angular/services.gen.ts.snap index d77f4c7e1..521df9d69 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3_angular/services.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3_angular/services.gen.ts.snap @@ -5,7 +5,7 @@ import { HttpClient } from '@angular/common/http'; import type { Observable } from 'rxjs'; import { OpenAPI } from './core/OpenAPI'; import { request as __request } from './core/request'; -import type { ImportData, ImportResponse, ApiVversionOdataControllerCountResponse, DeleteFooData3, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamData, PostCallWithOptionalParamResponse, CallWithDescriptionsData, DeprecatedCallData, PostApiRequestBodyData, PostApiFormDataData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, CallWithNoContentResponseResponse, CallWithResponseAndNoContentResponseResponse, CallWithResponseResponse, CallWithDuplicateResponsesResponse, CallWithResponsesResponse, DummyAResponse, DummyBResponse, CollectionFormatData, TypesData, TypesResponse, UploadFileData, UploadFileResponse, FileResponseData, FileResponseResponse, ComplexTypesData, ComplexTypesResponse, ComplexParamsData, ComplexParamsResponse, MultipartRequestData, MultipartResponseResponse, CallWithResultFromHeaderResponse, TestErrorCodeData, TestErrorCodeResponse, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Response, PutWithFormUrlEncodedData } from './types.gen'; +import type { ImportData, ImportResponse, GetApiSimpleOperationData, GetApiSimpleOperationResponse, ApiVversionOdataControllerCountResponse, DeleteFooData3, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamData, PostCallWithOptionalParamResponse, CallWithDescriptionsData, DeprecatedCallData, PostApiRequestBodyData, PostApiFormDataData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, CallWithNoContentResponseResponse, CallWithResponseAndNoContentResponseResponse, CallWithResponseResponse, CallWithDuplicateResponsesResponse, CallWithResponsesResponse, DummyAResponse, DummyBResponse, CollectionFormatData, TypesData, TypesResponse, UploadFileData, UploadFileResponse, FileResponseData, FileResponseResponse, ComplexTypesData, ComplexTypesResponse, ComplexParamsData, ComplexParamsResponse, MultipartRequestData, MultipartResponseResponse, CallWithResultFromHeaderResponse, TestErrorCodeData, TestErrorCodeResponse, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Response, PutWithFormUrlEncodedData } from './types.gen'; @Injectable({ providedIn: 'root' @@ -39,6 +39,25 @@ export class DefaultService { }); } + /** + * @param data The data for the request. + * @param data.fooParam foo in method + * @returns number Response is a simple number + * @throws ApiError + */ + public getApiSimpleOperation(data: GetApiSimpleOperationData): Observable { + return __request(OpenAPI, this.http, { + method: 'GET', + url: '/api/v{api-version}/simple:operation', + path: { + foo_param: data.fooParam + }, + errors: { + default: 'Default error response' + } + }); + } + } @Injectable({ diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_angular/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3_angular/types.gen.ts.snap index e75f8acc5..5f3e1d0f2 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3_angular/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3_angular/types.gen.ts.snap @@ -969,6 +969,15 @@ export type ImportData = { export type ImportResponse = (Model_From_Zendesk | ModelWithReadOnlyAndWriteOnly); +export type GetApiSimpleOperationData = { + /** + * foo in method + */ + fooParam: string; +}; + +export type GetApiSimpleOperationResponse = (number); + export type ApiVversionOdataControllerCountResponse = (Model_From_Zendesk); export type DeleteFooData3 = { diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_angular_tree_shakeable/services.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3_angular_tree_shakeable/services.gen.ts.snap index 1ec81cb39..36408a5fc 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3_angular_tree_shakeable/services.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3_angular_tree_shakeable/services.gen.ts.snap @@ -5,7 +5,7 @@ import { HttpClient } from '@angular/common/http'; import type { Observable } from 'rxjs'; import { OpenAPI } from './core/OpenAPI'; import { request as __request } from './core/request'; -import type { ImportData, ImportResponse, ApiVversionOdataControllerCountResponse, DeleteFooData3, CallWithDescriptionsData, DeprecatedCallData, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamData, PostCallWithOptionalParamResponse, PostApiRequestBodyData, PostApiFormDataData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, CallWithNoContentResponseResponse, CallWithResponseAndNoContentResponseResponse, DummyAResponse, DummyBResponse, CallWithResponseResponse, CallWithDuplicateResponsesResponse, CallWithResponsesResponse, CollectionFormatData, TypesData, TypesResponse, UploadFileData, UploadFileResponse, FileResponseData, FileResponseResponse, ComplexTypesData, ComplexTypesResponse, MultipartRequestData, MultipartResponseResponse, ComplexParamsData, ComplexParamsResponse, CallWithResultFromHeaderResponse, TestErrorCodeData, TestErrorCodeResponse, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Response, PutWithFormUrlEncodedData } from './types.gen'; +import type { ImportData, ImportResponse, ApiVversionOdataControllerCountResponse, GetApiSimpleOperationData, GetApiSimpleOperationResponse, DeleteFooData3, CallWithDescriptionsData, DeprecatedCallData, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamData, PostCallWithOptionalParamResponse, PostApiRequestBodyData, PostApiFormDataData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, CallWithNoContentResponseResponse, CallWithResponseAndNoContentResponseResponse, DummyAResponse, DummyBResponse, CallWithResponseResponse, CallWithDuplicateResponsesResponse, CallWithResponsesResponse, CollectionFormatData, TypesData, TypesResponse, UploadFileData, UploadFileResponse, FileResponseData, FileResponseResponse, ComplexTypesData, ComplexTypesResponse, MultipartRequestData, MultipartResponseResponse, ComplexParamsData, ComplexParamsResponse, CallWithResultFromHeaderResponse, TestErrorCodeData, TestErrorCodeResponse, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Response, PutWithFormUrlEncodedData } from './types.gen'; /** * @throws ApiError @@ -38,6 +38,23 @@ export const apiVVersionOdataControllerCount = function (): Observable { return __request(OpenAPI, this.http, { + method: 'GET', + url: '/api/v{api-version}/simple:operation', + path: { + foo_param: data.fooParam + }, + errors: { + default: 'Default error response' + } +}); }; + /** * @throws ApiError */ diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_angular_tree_shakeable/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3_angular_tree_shakeable/types.gen.ts.snap index d155e1045..8d30343ec 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3_angular_tree_shakeable/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3_angular_tree_shakeable/types.gen.ts.snap @@ -971,6 +971,15 @@ export type ImportResponse = (Model_From_Zendesk | ModelWithReadOnlyAndWriteOnly export type ApiVversionOdataControllerCountResponse = (Model_From_Zendesk); +export type GetApiSimpleOperationData = { + /** + * foo in method + */ + fooParam: string; +}; + +export type GetApiSimpleOperationResponse = (number); + export type DeleteFooData3 = { /** * bar in method diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_axios/services.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3_axios/services.gen.ts.snap index 6f45b0b8f..2a6aaa80e 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3_axios/services.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3_axios/services.gen.ts.snap @@ -3,7 +3,7 @@ import type { CancelablePromise } from './core/CancelablePromise'; import { OpenAPI } from './core/OpenAPI'; import { request as __request } from './core/request'; -import type { ImportData, ImportResponse, ApiVversionOdataControllerCountResponse, DeleteFooData3, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamData, PostCallWithOptionalParamResponse, CallWithDescriptionsData, DeprecatedCallData, PostApiRequestBodyData, PostApiFormDataData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, CallWithNoContentResponseResponse, CallWithResponseAndNoContentResponseResponse, CallWithResponseResponse, CallWithDuplicateResponsesResponse, CallWithResponsesResponse, DummyAResponse, DummyBResponse, CollectionFormatData, TypesData, TypesResponse, UploadFileData, UploadFileResponse, FileResponseData, FileResponseResponse, ComplexTypesData, ComplexTypesResponse, ComplexParamsData, ComplexParamsResponse, MultipartRequestData, MultipartResponseResponse, CallWithResultFromHeaderResponse, TestErrorCodeData, TestErrorCodeResponse, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Response, PutWithFormUrlEncodedData } from './types.gen'; +import type { ImportData, ImportResponse, GetApiSimpleOperationData, GetApiSimpleOperationResponse, ApiVversionOdataControllerCountResponse, DeleteFooData3, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamData, PostCallWithOptionalParamResponse, CallWithDescriptionsData, DeprecatedCallData, PostApiRequestBodyData, PostApiFormDataData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, CallWithNoContentResponseResponse, CallWithResponseAndNoContentResponseResponse, CallWithResponseResponse, CallWithDuplicateResponsesResponse, CallWithResponsesResponse, DummyAResponse, DummyBResponse, CollectionFormatData, TypesData, TypesResponse, UploadFileData, UploadFileResponse, FileResponseData, FileResponseResponse, ComplexTypesData, ComplexTypesResponse, ComplexParamsData, ComplexParamsResponse, MultipartRequestData, MultipartResponseResponse, CallWithResultFromHeaderResponse, TestErrorCodeData, TestErrorCodeResponse, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Response, PutWithFormUrlEncodedData } from './types.gen'; export class DefaultService { /** @@ -32,6 +32,25 @@ export class DefaultService { }); } + /** + * @param data The data for the request. + * @param data.fooParam foo in method + * @returns number Response is a simple number + * @throws ApiError + */ + public static getApiSimpleOperation(data: GetApiSimpleOperationData): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/api/v{api-version}/simple:operation', + path: { + foo_param: data.fooParam + }, + errors: { + default: 'Default error response' + } + }); + } + } export class SimpleService { diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_axios/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3_axios/types.gen.ts.snap index 74093a0bf..e279b0733 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3_axios/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3_axios/types.gen.ts.snap @@ -1092,6 +1092,15 @@ export type ImportData = { export type ImportResponse = (Model_From_Zendesk | ModelWithReadOnlyAndWriteOnly); +export type GetApiSimpleOperationData = { + /** + * foo in method + */ + fooParam: string; +}; + +export type GetApiSimpleOperationResponse = (number); + export type ApiVversionOdataControllerCountResponse = (Model_From_Zendesk); export type DeleteFooData3 = { diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_client/services.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3_client/services.gen.ts.snap index 261b60d4b..402f83a4d 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3_client/services.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3_client/services.gen.ts.snap @@ -2,7 +2,7 @@ import type { CancelablePromise } from './core/CancelablePromise'; import type { BaseHttpRequest } from './core/BaseHttpRequest'; -import type { ImportData, ImportResponse, ApiVversionOdataControllerCountResponse, DeleteFooData3, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamData, PostCallWithOptionalParamResponse, CallWithDescriptionsData, DeprecatedCallData, PostApiRequestBodyData, PostApiFormDataData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, CallWithNoContentResponseResponse, CallWithResponseAndNoContentResponseResponse, CallWithResponseResponse, CallWithDuplicateResponsesResponse, CallWithResponsesResponse, DummyAResponse, DummyBResponse, CollectionFormatData, TypesData, TypesResponse, UploadFileData, UploadFileResponse, FileResponseData, FileResponseResponse, ComplexTypesData, ComplexTypesResponse, ComplexParamsData, ComplexParamsResponse, MultipartRequestData, MultipartResponseResponse, CallWithResultFromHeaderResponse, TestErrorCodeData, TestErrorCodeResponse, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Response, PutWithFormUrlEncodedData } from './types.gen'; +import type { ImportData, ImportResponse, GetApiSimpleOperationData, GetApiSimpleOperationResponse, ApiVversionOdataControllerCountResponse, DeleteFooData3, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamData, PostCallWithOptionalParamResponse, CallWithDescriptionsData, DeprecatedCallData, PostApiRequestBodyData, PostApiFormDataData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, CallWithNoContentResponseResponse, CallWithResponseAndNoContentResponseResponse, CallWithResponseResponse, CallWithDuplicateResponsesResponse, CallWithResponsesResponse, DummyAResponse, DummyBResponse, CollectionFormatData, TypesData, TypesResponse, UploadFileData, UploadFileResponse, FileResponseData, FileResponseResponse, ComplexTypesData, ComplexTypesResponse, ComplexParamsData, ComplexParamsResponse, MultipartRequestData, MultipartResponseResponse, CallWithResultFromHeaderResponse, TestErrorCodeData, TestErrorCodeResponse, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Response, PutWithFormUrlEncodedData } from './types.gen'; export class DefaultService { constructor(public readonly httpRequest: BaseHttpRequest) { } @@ -33,6 +33,25 @@ export class DefaultService { }); } + /** + * @param data The data for the request. + * @param data.fooParam foo in method + * @returns number Response is a simple number + * @throws ApiError + */ + public getApiSimpleOperation(data: GetApiSimpleOperationData): CancelablePromise { + return this.httpRequest.request({ + method: 'GET', + url: '/api/v{api-version}/simple:operation', + path: { + foo_param: data.fooParam + }, + errors: { + default: 'Default error response' + } + }); + } + } export class SimpleService { diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_client/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3_client/types.gen.ts.snap index d88e06c86..44a945db4 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3_client/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3_client/types.gen.ts.snap @@ -969,6 +969,15 @@ export type ImportData = { export type ImportResponse = (Model_From_Zendesk | ModelWithReadOnlyAndWriteOnly); +export type GetApiSimpleOperationData = { + /** + * foo in method + */ + fooParam: string; +}; + +export type GetApiSimpleOperationResponse = (number); + export type ApiVversionOdataControllerCountResponse = (Model_From_Zendesk); export type DeleteFooData3 = { diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_date/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3_date/types.gen.ts.snap index 41817783f..00e23c946 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3_date/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3_date/types.gen.ts.snap @@ -23,6 +23,15 @@ export type ImportResponse = (Model_From_Zendesk | ModelWithReadOnlyAndWriteOnly export type ApiVversionOdataControllerCountResponse = (Model_From_Zendesk); +export type GetApiSimpleOperationData = { + /** + * foo in method + */ + fooParam: string; +}; + +export type GetApiSimpleOperationResponse = (number); + export type DeleteFooData = { /** * bar in method @@ -466,6 +475,21 @@ export type $OpenApiTs = { }; }; }; + '/api/v{api-version}/simple:operation': { + get: { + req: GetApiSimpleOperationData; + res: { + /** + * Response is a simple number + */ + 200: number; + /** + * Default error response + */ + default: ModelWithBoolean; + }; + }; + }; '/api/v{api-version}/foo/{foo_param}/bar/{BarParam}': { delete: { req: DeleteFooData; diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_enums_typescript/services.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3_enums_typescript/services.gen.ts.snap index 6f45b0b8f..2a6aaa80e 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3_enums_typescript/services.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3_enums_typescript/services.gen.ts.snap @@ -3,7 +3,7 @@ import type { CancelablePromise } from './core/CancelablePromise'; import { OpenAPI } from './core/OpenAPI'; import { request as __request } from './core/request'; -import type { ImportData, ImportResponse, ApiVversionOdataControllerCountResponse, DeleteFooData3, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamData, PostCallWithOptionalParamResponse, CallWithDescriptionsData, DeprecatedCallData, PostApiRequestBodyData, PostApiFormDataData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, CallWithNoContentResponseResponse, CallWithResponseAndNoContentResponseResponse, CallWithResponseResponse, CallWithDuplicateResponsesResponse, CallWithResponsesResponse, DummyAResponse, DummyBResponse, CollectionFormatData, TypesData, TypesResponse, UploadFileData, UploadFileResponse, FileResponseData, FileResponseResponse, ComplexTypesData, ComplexTypesResponse, ComplexParamsData, ComplexParamsResponse, MultipartRequestData, MultipartResponseResponse, CallWithResultFromHeaderResponse, TestErrorCodeData, TestErrorCodeResponse, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Response, PutWithFormUrlEncodedData } from './types.gen'; +import type { ImportData, ImportResponse, GetApiSimpleOperationData, GetApiSimpleOperationResponse, ApiVversionOdataControllerCountResponse, DeleteFooData3, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamData, PostCallWithOptionalParamResponse, CallWithDescriptionsData, DeprecatedCallData, PostApiRequestBodyData, PostApiFormDataData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, CallWithNoContentResponseResponse, CallWithResponseAndNoContentResponseResponse, CallWithResponseResponse, CallWithDuplicateResponsesResponse, CallWithResponsesResponse, DummyAResponse, DummyBResponse, CollectionFormatData, TypesData, TypesResponse, UploadFileData, UploadFileResponse, FileResponseData, FileResponseResponse, ComplexTypesData, ComplexTypesResponse, ComplexParamsData, ComplexParamsResponse, MultipartRequestData, MultipartResponseResponse, CallWithResultFromHeaderResponse, TestErrorCodeData, TestErrorCodeResponse, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Response, PutWithFormUrlEncodedData } from './types.gen'; export class DefaultService { /** @@ -32,6 +32,25 @@ export class DefaultService { }); } + /** + * @param data The data for the request. + * @param data.fooParam foo in method + * @returns number Response is a simple number + * @throws ApiError + */ + public static getApiSimpleOperation(data: GetApiSimpleOperationData): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/api/v{api-version}/simple:operation', + path: { + foo_param: data.fooParam + }, + errors: { + default: 'Default error response' + } + }); + } + } export class SimpleService { diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_enums_typescript/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3_enums_typescript/types.gen.ts.snap index 52418cda9..796ce9beb 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3_enums_typescript/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3_enums_typescript/types.gen.ts.snap @@ -1048,6 +1048,15 @@ export type ImportData = { export type ImportResponse = (Model_From_Zendesk | ModelWithReadOnlyAndWriteOnly); +export type GetApiSimpleOperationData = { + /** + * foo in method + */ + fooParam: string; +}; + +export type GetApiSimpleOperationResponse = (number); + export type ApiVversionOdataControllerCountResponse = (Model_From_Zendesk); export type DeleteFooData3 = { diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_enums_typescript_namespace/services.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3_enums_typescript_namespace/services.gen.ts.snap index 6f45b0b8f..2a6aaa80e 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3_enums_typescript_namespace/services.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3_enums_typescript_namespace/services.gen.ts.snap @@ -3,7 +3,7 @@ import type { CancelablePromise } from './core/CancelablePromise'; import { OpenAPI } from './core/OpenAPI'; import { request as __request } from './core/request'; -import type { ImportData, ImportResponse, ApiVversionOdataControllerCountResponse, DeleteFooData3, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamData, PostCallWithOptionalParamResponse, CallWithDescriptionsData, DeprecatedCallData, PostApiRequestBodyData, PostApiFormDataData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, CallWithNoContentResponseResponse, CallWithResponseAndNoContentResponseResponse, CallWithResponseResponse, CallWithDuplicateResponsesResponse, CallWithResponsesResponse, DummyAResponse, DummyBResponse, CollectionFormatData, TypesData, TypesResponse, UploadFileData, UploadFileResponse, FileResponseData, FileResponseResponse, ComplexTypesData, ComplexTypesResponse, ComplexParamsData, ComplexParamsResponse, MultipartRequestData, MultipartResponseResponse, CallWithResultFromHeaderResponse, TestErrorCodeData, TestErrorCodeResponse, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Response, PutWithFormUrlEncodedData } from './types.gen'; +import type { ImportData, ImportResponse, GetApiSimpleOperationData, GetApiSimpleOperationResponse, ApiVversionOdataControllerCountResponse, DeleteFooData3, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamData, PostCallWithOptionalParamResponse, CallWithDescriptionsData, DeprecatedCallData, PostApiRequestBodyData, PostApiFormDataData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, CallWithNoContentResponseResponse, CallWithResponseAndNoContentResponseResponse, CallWithResponseResponse, CallWithDuplicateResponsesResponse, CallWithResponsesResponse, DummyAResponse, DummyBResponse, CollectionFormatData, TypesData, TypesResponse, UploadFileData, UploadFileResponse, FileResponseData, FileResponseResponse, ComplexTypesData, ComplexTypesResponse, ComplexParamsData, ComplexParamsResponse, MultipartRequestData, MultipartResponseResponse, CallWithResultFromHeaderResponse, TestErrorCodeData, TestErrorCodeResponse, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Response, PutWithFormUrlEncodedData } from './types.gen'; export class DefaultService { /** @@ -32,6 +32,25 @@ export class DefaultService { }); } + /** + * @param data The data for the request. + * @param data.fooParam foo in method + * @returns number Response is a simple number + * @throws ApiError + */ + public static getApiSimpleOperation(data: GetApiSimpleOperationData): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/api/v{api-version}/simple:operation', + path: { + foo_param: data.fooParam + }, + errors: { + default: 'Default error response' + } + }); + } + } export class SimpleService { diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_enums_typescript_namespace/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3_enums_typescript_namespace/types.gen.ts.snap index d61318681..cfb3790dd 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3_enums_typescript_namespace/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3_enums_typescript_namespace/types.gen.ts.snap @@ -1079,6 +1079,15 @@ export type ImportData = { export type ImportResponse = (Model_From_Zendesk | ModelWithReadOnlyAndWriteOnly); +export type GetApiSimpleOperationData = { + /** + * foo in method + */ + fooParam: string; +}; + +export type GetApiSimpleOperationResponse = (number); + export type ApiVversionOdataControllerCountResponse = (Model_From_Zendesk); export type DeleteFooData3 = { diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_node/services.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3_node/services.gen.ts.snap index 6f45b0b8f..2a6aaa80e 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3_node/services.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3_node/services.gen.ts.snap @@ -3,7 +3,7 @@ import type { CancelablePromise } from './core/CancelablePromise'; import { OpenAPI } from './core/OpenAPI'; import { request as __request } from './core/request'; -import type { ImportData, ImportResponse, ApiVversionOdataControllerCountResponse, DeleteFooData3, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamData, PostCallWithOptionalParamResponse, CallWithDescriptionsData, DeprecatedCallData, PostApiRequestBodyData, PostApiFormDataData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, CallWithNoContentResponseResponse, CallWithResponseAndNoContentResponseResponse, CallWithResponseResponse, CallWithDuplicateResponsesResponse, CallWithResponsesResponse, DummyAResponse, DummyBResponse, CollectionFormatData, TypesData, TypesResponse, UploadFileData, UploadFileResponse, FileResponseData, FileResponseResponse, ComplexTypesData, ComplexTypesResponse, ComplexParamsData, ComplexParamsResponse, MultipartRequestData, MultipartResponseResponse, CallWithResultFromHeaderResponse, TestErrorCodeData, TestErrorCodeResponse, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Response, PutWithFormUrlEncodedData } from './types.gen'; +import type { ImportData, ImportResponse, GetApiSimpleOperationData, GetApiSimpleOperationResponse, ApiVversionOdataControllerCountResponse, DeleteFooData3, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamData, PostCallWithOptionalParamResponse, CallWithDescriptionsData, DeprecatedCallData, PostApiRequestBodyData, PostApiFormDataData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, CallWithNoContentResponseResponse, CallWithResponseAndNoContentResponseResponse, CallWithResponseResponse, CallWithDuplicateResponsesResponse, CallWithResponsesResponse, DummyAResponse, DummyBResponse, CollectionFormatData, TypesData, TypesResponse, UploadFileData, UploadFileResponse, FileResponseData, FileResponseResponse, ComplexTypesData, ComplexTypesResponse, ComplexParamsData, ComplexParamsResponse, MultipartRequestData, MultipartResponseResponse, CallWithResultFromHeaderResponse, TestErrorCodeData, TestErrorCodeResponse, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Response, PutWithFormUrlEncodedData } from './types.gen'; export class DefaultService { /** @@ -32,6 +32,25 @@ export class DefaultService { }); } + /** + * @param data The data for the request. + * @param data.fooParam foo in method + * @returns number Response is a simple number + * @throws ApiError + */ + public static getApiSimpleOperation(data: GetApiSimpleOperationData): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/api/v{api-version}/simple:operation', + path: { + foo_param: data.fooParam + }, + errors: { + default: 'Default error response' + } + }); + } + } export class SimpleService { diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_node/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3_node/types.gen.ts.snap index 74093a0bf..e279b0733 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3_node/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3_node/types.gen.ts.snap @@ -1092,6 +1092,15 @@ export type ImportData = { export type ImportResponse = (Model_From_Zendesk | ModelWithReadOnlyAndWriteOnly); +export type GetApiSimpleOperationData = { + /** + * foo in method + */ + fooParam: string; +}; + +export type GetApiSimpleOperationResponse = (number); + export type ApiVversionOdataControllerCountResponse = (Model_From_Zendesk); export type DeleteFooData3 = { diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_tree_shakeable/services.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3_tree_shakeable/services.gen.ts.snap index a97e70c6c..f8864d4d2 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3_tree_shakeable/services.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3_tree_shakeable/services.gen.ts.snap @@ -3,7 +3,7 @@ import type { CancelablePromise } from './core/CancelablePromise'; import { OpenAPI } from './core/OpenAPI'; import { request as __request } from './core/request'; -import type { ImportData, ImportResponse, ApiVversionOdataControllerCountResponse, DeleteFooData3, CallWithDescriptionsData, DeprecatedCallData, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamData, PostCallWithOptionalParamResponse, PostApiRequestBodyData, PostApiFormDataData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, CallWithNoContentResponseResponse, CallWithResponseAndNoContentResponseResponse, DummyAResponse, DummyBResponse, CallWithResponseResponse, CallWithDuplicateResponsesResponse, CallWithResponsesResponse, CollectionFormatData, TypesData, TypesResponse, UploadFileData, UploadFileResponse, FileResponseData, FileResponseResponse, ComplexTypesData, ComplexTypesResponse, MultipartRequestData, MultipartResponseResponse, ComplexParamsData, ComplexParamsResponse, CallWithResultFromHeaderResponse, TestErrorCodeData, TestErrorCodeResponse, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Response, PutWithFormUrlEncodedData } from './types.gen'; +import type { ImportData, ImportResponse, ApiVversionOdataControllerCountResponse, GetApiSimpleOperationData, GetApiSimpleOperationResponse, DeleteFooData3, CallWithDescriptionsData, DeprecatedCallData, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamData, PostCallWithOptionalParamResponse, PostApiRequestBodyData, PostApiFormDataData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, CallWithNoContentResponseResponse, CallWithResponseAndNoContentResponseResponse, DummyAResponse, DummyBResponse, CallWithResponseResponse, CallWithDuplicateResponsesResponse, CallWithResponsesResponse, CollectionFormatData, TypesData, TypesResponse, UploadFileData, UploadFileResponse, FileResponseData, FileResponseResponse, ComplexTypesData, ComplexTypesResponse, MultipartRequestData, MultipartResponseResponse, ComplexParamsData, ComplexParamsResponse, CallWithResultFromHeaderResponse, TestErrorCodeData, TestErrorCodeResponse, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Response, PutWithFormUrlEncodedData } from './types.gen'; /** * @throws ApiError @@ -36,6 +36,23 @@ export const apiVVersionOdataControllerCount = (): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/api/v{api-version}/simple:operation', + path: { + foo_param: data.fooParam + }, + errors: { + default: 'Default error response' + } +}); }; + /** * @throws ApiError */ diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_tree_shakeable/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3_tree_shakeable/types.gen.ts.snap index 4a86d8b61..dfc37aa6a 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3_tree_shakeable/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3_tree_shakeable/types.gen.ts.snap @@ -1094,6 +1094,15 @@ export type ImportResponse = (Model_From_Zendesk | ModelWithReadOnlyAndWriteOnly export type ApiVversionOdataControllerCountResponse = (Model_From_Zendesk); +export type GetApiSimpleOperationData = { + /** + * foo in method + */ + fooParam: string; +}; + +export type GetApiSimpleOperationResponse = (number); + export type DeleteFooData3 = { /** * bar in method diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_types/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3_types/types.gen.ts.snap index 04a19e534..ff3345cd0 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3_types/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3_types/types.gen.ts.snap @@ -971,6 +971,15 @@ export type ImportResponse = (Model_From_Zendesk | ModelWithReadOnlyAndWriteOnly export type ApiVversionOdataControllerCountResponse = (Model_From_Zendesk); +export type GetApiSimpleOperationData = { + /** + * foo in method + */ + fooParam: string; +}; + +export type GetApiSimpleOperationResponse = (number); + export type DeleteFooData3 = { /** * bar in method @@ -1414,6 +1423,21 @@ export type $OpenApiTs = { }; }; }; + '/api/v{api-version}/simple:operation': { + get: { + req: GetApiSimpleOperationData; + res: { + /** + * Response is a simple number + */ + 200: number; + /** + * Default error response + */ + default: ModelWithBoolean; + }; + }; + }; '/api/v{api-version}/foo/{foo_param}/bar/{BarParam}': { delete: { req: DeleteFooData3; diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_xhr/services.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3_xhr/services.gen.ts.snap index 6f45b0b8f..2a6aaa80e 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3_xhr/services.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3_xhr/services.gen.ts.snap @@ -3,7 +3,7 @@ import type { CancelablePromise } from './core/CancelablePromise'; import { OpenAPI } from './core/OpenAPI'; import { request as __request } from './core/request'; -import type { ImportData, ImportResponse, ApiVversionOdataControllerCountResponse, DeleteFooData3, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamData, PostCallWithOptionalParamResponse, CallWithDescriptionsData, DeprecatedCallData, PostApiRequestBodyData, PostApiFormDataData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, CallWithNoContentResponseResponse, CallWithResponseAndNoContentResponseResponse, CallWithResponseResponse, CallWithDuplicateResponsesResponse, CallWithResponsesResponse, DummyAResponse, DummyBResponse, CollectionFormatData, TypesData, TypesResponse, UploadFileData, UploadFileResponse, FileResponseData, FileResponseResponse, ComplexTypesData, ComplexTypesResponse, ComplexParamsData, ComplexParamsResponse, MultipartRequestData, MultipartResponseResponse, CallWithResultFromHeaderResponse, TestErrorCodeData, TestErrorCodeResponse, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Response, PutWithFormUrlEncodedData } from './types.gen'; +import type { ImportData, ImportResponse, GetApiSimpleOperationData, GetApiSimpleOperationResponse, ApiVversionOdataControllerCountResponse, DeleteFooData3, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamData, PostCallWithOptionalParamResponse, CallWithDescriptionsData, DeprecatedCallData, PostApiRequestBodyData, PostApiFormDataData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, CallWithNoContentResponseResponse, CallWithResponseAndNoContentResponseResponse, CallWithResponseResponse, CallWithDuplicateResponsesResponse, CallWithResponsesResponse, DummyAResponse, DummyBResponse, CollectionFormatData, TypesData, TypesResponse, UploadFileData, UploadFileResponse, FileResponseData, FileResponseResponse, ComplexTypesData, ComplexTypesResponse, ComplexParamsData, ComplexParamsResponse, MultipartRequestData, MultipartResponseResponse, CallWithResultFromHeaderResponse, TestErrorCodeData, TestErrorCodeResponse, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Response, PutWithFormUrlEncodedData } from './types.gen'; export class DefaultService { /** @@ -32,6 +32,25 @@ export class DefaultService { }); } + /** + * @param data The data for the request. + * @param data.fooParam foo in method + * @returns number Response is a simple number + * @throws ApiError + */ + public static getApiSimpleOperation(data: GetApiSimpleOperationData): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/api/v{api-version}/simple:operation', + path: { + foo_param: data.fooParam + }, + errors: { + default: 'Default error response' + } + }); + } + } export class SimpleService { diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_xhr/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3_xhr/types.gen.ts.snap index 74093a0bf..e279b0733 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3_xhr/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3_xhr/types.gen.ts.snap @@ -1092,6 +1092,15 @@ export type ImportData = { export type ImportResponse = (Model_From_Zendesk | ModelWithReadOnlyAndWriteOnly); +export type GetApiSimpleOperationData = { + /** + * foo in method + */ + fooParam: string; +}; + +export type GetApiSimpleOperationResponse = (number); + export type ApiVversionOdataControllerCountResponse = (Model_From_Zendesk); export type DeleteFooData3 = { diff --git a/packages/openapi-ts/test/sample.cjs b/packages/openapi-ts/test/sample.cjs index 3ab0bbc31..95b3b744f 100644 --- a/packages/openapi-ts/test/sample.cjs +++ b/packages/openapi-ts/test/sample.cjs @@ -6,8 +6,7 @@ const main = async () => { client: { // bundle: true, // name: '@hey-api/client-axios', - // name: '@hey-api/client-fetch', - name: 'foooooo', + name: '@hey-api/client-fetch', }, // debug: true, // experimental_parser: true, @@ -34,7 +33,7 @@ const main = async () => { services: { // export: false, // asClass: true, - filter: '^POST /api/v{api-version}/upload$', + filter: '^GET /api/v{api-version}/simple:operation$', // export: false, // name: '^Parameters', }, @@ -45,7 +44,7 @@ const main = async () => { // include: // '^(_400|CompositionWithOneOfAndProperties)', // name: 'PascalCase', - tree: false, + // tree: false, }, // useOptions: false, }; diff --git a/packages/openapi-ts/test/spec/v3.json b/packages/openapi-ts/test/spec/v3.json index 5b380e62a..85696a4cb 100644 --- a/packages/openapi-ts/test/spec/v3.json +++ b/packages/openapi-ts/test/spec/v3.json @@ -77,6 +77,43 @@ } } }, + "/api/v{api-version}/simple:operation": { + "get": { + "parameters": [ + { + "description": "foo in method", + "in": "path", + "name": "foo_param", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "default": { + "description": "Default error response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ModelWithBoolean" + } + } + } + }, + "200": { + "description": "Response is a simple number", + "content": { + "application/json": { + "schema": { + "type": "number" + } + } + } + } + } + } + }, "/api/v{api-version}/simple": { "get": { "tags": ["Simple"], -- 2.51.2 From f330d847ee9c4873999fe59bd2497ebda602db80 Mon Sep 17 00:00:00 2001 From: Lubos Date: Thu, 19 Sep 2024 08:12:29 +0100 Subject: [PATCH 17/49] chore: bump dependencies in examples --- examples/openapi-ts-axios/package.json | 2 +- examples/openapi-ts-fetch/package.json | 2 +- .../package.json | 2 +- .../package.json | 6 +- .../package.json | 2 +- packages/openapi-ts/package.json | 2 +- pnpm-lock.yaml | 567 +++++++++++------- 7 files changed, 359 insertions(+), 224 deletions(-) diff --git a/examples/openapi-ts-axios/package.json b/examples/openapi-ts-axios/package.json index f7564ae40..8a80115df 100644 --- a/examples/openapi-ts-axios/package.json +++ b/examples/openapi-ts-axios/package.json @@ -35,6 +35,6 @@ "prettier": "3.3.2", "tailwindcss": "3.4.4", "typescript": "5.5.3", - "vite": "5.3.3" + "vite": "5.4.6" } } diff --git a/examples/openapi-ts-fetch/package.json b/examples/openapi-ts-fetch/package.json index 7274a2e61..74f56525f 100644 --- a/examples/openapi-ts-fetch/package.json +++ b/examples/openapi-ts-fetch/package.json @@ -34,6 +34,6 @@ "prettier": "3.3.2", "tailwindcss": "3.4.4", "typescript": "5.5.3", - "vite": "5.3.3" + "vite": "5.4.6" } } diff --git a/examples/openapi-ts-tanstack-react-query/package.json b/examples/openapi-ts-tanstack-react-query/package.json index 52788e90a..50ab6a1da 100644 --- a/examples/openapi-ts-tanstack-react-query/package.json +++ b/examples/openapi-ts-tanstack-react-query/package.json @@ -36,6 +36,6 @@ "prettier": "3.3.2", "tailwindcss": "3.4.4", "typescript": "5.5.3", - "vite": "5.3.3" + "vite": "5.4.6" } } diff --git a/examples/openapi-ts-tanstack-svelte-query/package.json b/examples/openapi-ts-tanstack-svelte-query/package.json index 68723ed74..2a963b935 100644 --- a/examples/openapi-ts-tanstack-svelte-query/package.json +++ b/examples/openapi-ts-tanstack-svelte-query/package.json @@ -24,7 +24,7 @@ "@hey-api/openapi-ts": "workspace:*", "@neoconfetti/svelte": "2.0.0", "@sveltejs/adapter-auto": "3.0.0", - "@sveltejs/kit": "2.0.0", + "@sveltejs/kit": "2.5.28", "@sveltejs/vite-plugin-svelte": "3.0.0", "@types/eslint": "9.6.0", "eslint": "9.0.0", @@ -33,11 +33,11 @@ "globals": "15.0.0", "prettier": "3.1.1", "prettier-plugin-svelte": "3.1.2", - "svelte": "4.2.7", + "svelte": "4.2.19", "svelte-check": "3.6.0", "typescript": "5.5.3", "typescript-eslint": "8.0.0", - "vite": "5.0.3", + "vite": "5.4.6", "vitest": "2.0.0" } } diff --git a/examples/openapi-ts-tanstack-vue-query/package.json b/examples/openapi-ts-tanstack-vue-query/package.json index 381a0c811..e52cdd3b8 100644 --- a/examples/openapi-ts-tanstack-vue-query/package.json +++ b/examples/openapi-ts-tanstack-vue-query/package.json @@ -44,7 +44,7 @@ "prettier": "3.3.2", "tailwindcss": "3.4.9", "typescript": "5.5.3", - "vite": "5.3.3", + "vite": "5.4.6", "vite-plugin-vue-devtools": "7.3.1", "vitest": "1.6.0", "vue-tsc": "2.0.29" diff --git a/packages/openapi-ts/package.json b/packages/openapi-ts/package.json index 3b60c55c4..b95b7ef48 100644 --- a/packages/openapi-ts/package.json +++ b/packages/openapi-ts/package.json @@ -94,7 +94,7 @@ "axios": "1.7.7", "cross-spawn": "7.0.3", "eslint": "9.6.0", - "express": "4.19.2", + "express": "4.21.0", "glob": "10.4.3", "node-fetch": "3.3.2", "prettier": "3.3.2", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 1f39333ac..a226610bd 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -132,7 +132,7 @@ importers: version: 7.15.0(eslint@9.6.0)(typescript@5.5.3) '@vitejs/plugin-react': specifier: 4.3.1 - version: 4.3.1(vite@5.3.3(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1)) + version: 4.3.1(vite@5.4.6(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1)) autoprefixer: specifier: 10.4.19 version: 10.4.19(postcss@8.4.39) @@ -158,8 +158,8 @@ importers: specifier: 5.5.3 version: 5.5.3 vite: - specifier: 5.3.3 - version: 5.3.3(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1) + specifier: 5.4.6 + version: 5.4.6(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1) examples/openapi-ts-fetch: dependencies: @@ -199,7 +199,7 @@ importers: version: 7.15.0(eslint@9.6.0)(typescript@5.5.3) '@vitejs/plugin-react': specifier: 4.3.1 - version: 4.3.1(vite@5.3.3(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1)) + version: 4.3.1(vite@5.4.6(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1)) autoprefixer: specifier: 10.4.19 version: 10.4.19(postcss@8.4.39) @@ -225,8 +225,8 @@ importers: specifier: 5.5.3 version: 5.5.3 vite: - specifier: 5.3.3 - version: 5.3.3(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1) + specifier: 5.4.6 + version: 5.4.6(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1) examples/openapi-ts-tanstack-react-query: dependencies: @@ -272,7 +272,7 @@ importers: version: 7.15.0(eslint@9.6.0)(typescript@5.5.3) '@vitejs/plugin-react': specifier: 4.3.1 - version: 4.3.1(vite@5.3.3(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1)) + version: 4.3.1(vite@5.4.6(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1)) autoprefixer: specifier: 10.4.19 version: 10.4.19(postcss@8.4.39) @@ -298,8 +298,8 @@ importers: specifier: 5.5.3 version: 5.5.3 vite: - specifier: 5.3.3 - version: 5.3.3(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1) + specifier: 5.4.6 + version: 5.4.6(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1) examples/openapi-ts-tanstack-svelte-query: dependencies: @@ -308,7 +308,7 @@ importers: version: link:../../packages/client-fetch '@tanstack/svelte-query': specifier: 5.56.2 - version: 5.56.2(svelte@4.2.7) + version: 5.56.2(svelte@4.2.19) devDependencies: '@fontsource/fira-mono': specifier: 5.0.0 @@ -321,13 +321,13 @@ importers: version: 2.0.0 '@sveltejs/adapter-auto': specifier: 3.0.0 - version: 3.0.0(@sveltejs/kit@2.0.0(@sveltejs/vite-plugin-svelte@3.0.0(svelte@4.2.7)(vite@5.0.3(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1)))(svelte@4.2.7)(vite@5.0.3(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1))) + version: 3.0.0(@sveltejs/kit@2.5.28(@sveltejs/vite-plugin-svelte@3.0.0(svelte@4.2.19)(vite@5.4.6(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1)))(svelte@4.2.19)(vite@5.4.6(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1))) '@sveltejs/kit': - specifier: 2.0.0 - version: 2.0.0(@sveltejs/vite-plugin-svelte@3.0.0(svelte@4.2.7)(vite@5.0.3(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1)))(svelte@4.2.7)(vite@5.0.3(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1)) + specifier: 2.5.28 + version: 2.5.28(@sveltejs/vite-plugin-svelte@3.0.0(svelte@4.2.19)(vite@5.4.6(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1)))(svelte@4.2.19)(vite@5.4.6(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1)) '@sveltejs/vite-plugin-svelte': specifier: 3.0.0 - version: 3.0.0(svelte@4.2.7)(vite@5.0.3(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1)) + version: 3.0.0(svelte@4.2.19)(vite@5.4.6(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1)) '@types/eslint': specifier: 9.6.0 version: 9.6.0 @@ -339,7 +339,7 @@ importers: version: 9.1.0(eslint@9.0.0) eslint-plugin-svelte: specifier: 2.36.0 - version: 2.36.0(eslint@9.0.0)(svelte@4.2.7)(ts-node@10.9.2(@types/node@20.14.10)(typescript@5.5.3)) + version: 2.36.0(eslint@9.0.0)(svelte@4.2.19)(ts-node@10.9.2(@types/node@20.14.10)(typescript@5.5.3)) globals: specifier: 15.0.0 version: 15.0.0 @@ -348,13 +348,13 @@ importers: version: 3.1.1 prettier-plugin-svelte: specifier: 3.1.2 - version: 3.1.2(prettier@3.1.1)(svelte@4.2.7) + version: 3.1.2(prettier@3.1.1)(svelte@4.2.19) svelte: - specifier: 4.2.7 - version: 4.2.7 + specifier: 4.2.19 + version: 4.2.19 svelte-check: specifier: 3.6.0 - version: 3.6.0(@babel/core@7.24.7)(less@4.2.0)(postcss-load-config@4.0.2(postcss@8.4.39)(ts-node@10.9.2(@types/node@20.14.10)(typescript@5.5.3)))(postcss@8.4.39)(sass@1.71.1)(svelte@4.2.7) + version: 3.6.0(@babel/core@7.24.7)(less@4.2.0)(postcss-load-config@4.0.2(postcss@8.4.39)(ts-node@10.9.2(@types/node@20.14.10)(typescript@5.5.3)))(postcss@8.4.39)(sass@1.71.1)(svelte@4.2.19) typescript: specifier: 5.5.3 version: 5.5.3 @@ -362,8 +362,8 @@ importers: specifier: 8.0.0 version: 8.0.0(eslint@9.0.0)(typescript@5.5.3) vite: - specifier: 5.0.3 - version: 5.0.3(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1) + specifier: 5.4.6 + version: 5.4.6(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1) vitest: specifier: 2.0.0 version: 2.0.0(@types/node@20.14.10)(jsdom@24.1.0)(less@4.2.0)(sass@1.71.1)(terser@5.31.1) @@ -406,10 +406,10 @@ importers: version: 20.14.5 '@vitejs/plugin-vue': specifier: 5.0.5 - version: 5.0.5(vite@5.3.3(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1))(vue@3.5.5(typescript@5.5.3)) + version: 5.0.5(vite@5.4.6(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1))(vue@3.5.5(typescript@5.5.3)) '@vitejs/plugin-vue-jsx': specifier: 4.0.0 - version: 4.0.0(vite@5.3.3(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1))(vue@3.5.5(typescript@5.5.3)) + version: 4.0.0(vite@5.4.6(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1))(vue@3.5.5(typescript@5.5.3)) '@vue/eslint-config-prettier': specifier: 9.0.0 version: 9.0.0(@types/eslint@9.6.0)(eslint@9.6.0)(prettier@3.3.2) @@ -450,11 +450,11 @@ importers: specifier: 5.5.3 version: 5.5.3 vite: - specifier: 5.3.3 - version: 5.3.3(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1) + specifier: 5.4.6 + version: 5.4.6(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1) vite-plugin-vue-devtools: specifier: 7.3.1 - version: 7.3.1(rollup@4.18.0)(vite@5.3.3(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1))(vue@3.5.5(typescript@5.5.3)) + version: 7.3.1(rollup@4.22.0)(vite@5.4.6(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1))(vue@3.5.5(typescript@5.5.3)) vitest: specifier: 1.6.0 version: 1.6.0(@types/node@20.14.5)(jsdom@24.1.0)(less@4.2.0)(sass@1.71.1)(terser@5.31.1) @@ -528,10 +528,10 @@ importers: version: link:../client-fetch '@rollup/plugin-json': specifier: 6.1.0 - version: 6.1.0(rollup@4.18.0) + version: 6.1.0(rollup@4.22.0) '@rollup/plugin-node-resolve': specifier: 15.2.3 - version: 15.2.3(rollup@4.18.0) + version: 15.2.3(rollup@4.22.0) '@tanstack/react-query': specifier: 5.56.2 version: 5.56.2(react@18.3.1) @@ -540,7 +540,7 @@ importers: version: 5.51.21(solid-js@1.8.20) '@tanstack/svelte-query': specifier: 5.56.2 - version: 5.56.2(svelte@4.2.7) + version: 5.56.2(svelte@4.2.19) '@tanstack/vue-query': specifier: 5.56.2 version: 5.56.2(vue@3.5.5(typescript@5.5.3)) @@ -560,8 +560,8 @@ importers: specifier: 9.6.0 version: 9.6.0 express: - specifier: 4.19.2 - version: 4.19.2 + specifier: 4.21.0 + version: 4.21.0 glob: specifier: 10.4.3 version: 10.4.3 @@ -2864,81 +2864,161 @@ packages: cpu: [arm] os: [android] + '@rollup/rollup-android-arm-eabi@4.22.0': + resolution: {integrity: sha512-/IZQvg6ZR0tAkEi4tdXOraQoWeJy9gbQ/cx4I7k9dJaCk9qrXEcdouxRVz5kZXt5C2bQ9pILoAA+KB4C/d3pfw==} + cpu: [arm] + os: [android] + '@rollup/rollup-android-arm64@4.18.0': resolution: {integrity: sha512-avCea0RAP03lTsDhEyfy+hpfr85KfyTctMADqHVhLAF3MlIkq83CP8UfAHUssgXTYd+6er6PaAhx/QGv4L1EiA==} cpu: [arm64] os: [android] + '@rollup/rollup-android-arm64@4.22.0': + resolution: {integrity: sha512-ETHi4bxrYnvOtXeM7d4V4kZWixib2jddFacJjsOjwbgYSRsyXYtZHC4ht134OsslPIcnkqT+TKV4eU8rNBKyyQ==} + cpu: [arm64] + os: [android] + '@rollup/rollup-darwin-arm64@4.18.0': resolution: {integrity: sha512-IWfdwU7KDSm07Ty0PuA/W2JYoZ4iTj3TUQjkVsO/6U+4I1jN5lcR71ZEvRh52sDOERdnNhhHU57UITXz5jC1/w==} cpu: [arm64] os: [darwin] + '@rollup/rollup-darwin-arm64@4.22.0': + resolution: {integrity: sha512-ZWgARzhSKE+gVUX7QWaECoRQsPwaD8ZR0Oxb3aUpzdErTvlEadfQpORPXkKSdKbFci9v8MJfkTtoEHnnW9Ulng==} + cpu: [arm64] + os: [darwin] + '@rollup/rollup-darwin-x64@4.18.0': resolution: {integrity: sha512-n2LMsUz7Ynu7DoQrSQkBf8iNrjOGyPLrdSg802vk6XT3FtsgX6JbE8IHRvposskFm9SNxzkLYGSq9QdpLYpRNA==} cpu: [x64] os: [darwin] + '@rollup/rollup-darwin-x64@4.22.0': + resolution: {integrity: sha512-h0ZAtOfHyio8Az6cwIGS+nHUfRMWBDO5jXB8PQCARVF6Na/G6XS2SFxDl8Oem+S5ZsHQgtsI7RT4JQnI1qrlaw==} + cpu: [x64] + os: [darwin] + '@rollup/rollup-linux-arm-gnueabihf@4.18.0': resolution: {integrity: sha512-C/zbRYRXFjWvz9Z4haRxcTdnkPt1BtCkz+7RtBSuNmKzMzp3ZxdM28Mpccn6pt28/UWUCTXa+b0Mx1k3g6NOMA==} cpu: [arm] os: [linux] + '@rollup/rollup-linux-arm-gnueabihf@4.22.0': + resolution: {integrity: sha512-9pxQJSPwFsVi0ttOmqLY4JJ9pg9t1gKhK0JDbV1yUEETSx55fdyCjt39eBQ54OQCzAF0nVGO6LfEH1KnCPvelA==} + cpu: [arm] + os: [linux] + '@rollup/rollup-linux-arm-musleabihf@4.18.0': resolution: {integrity: sha512-l3m9ewPgjQSXrUMHg93vt0hYCGnrMOcUpTz6FLtbwljo2HluS4zTXFy2571YQbisTnfTKPZ01u/ukJdQTLGh9A==} cpu: [arm] os: [linux] + '@rollup/rollup-linux-arm-musleabihf@4.22.0': + resolution: {integrity: sha512-YJ5Ku5BmNJZb58A4qSEo3JlIG4d3G2lWyBi13ABlXzO41SsdnUKi3HQHe83VpwBVG4jHFTW65jOQb8qyoR+qzg==} + cpu: [arm] + os: [linux] + '@rollup/rollup-linux-arm64-gnu@4.18.0': resolution: {integrity: sha512-rJ5D47d8WD7J+7STKdCUAgmQk49xuFrRi9pZkWoRD1UeSMakbcepWXPF8ycChBoAqs1pb2wzvbY6Q33WmN2ftw==} cpu: [arm64] os: [linux] + '@rollup/rollup-linux-arm64-gnu@4.22.0': + resolution: {integrity: sha512-U4G4u7f+QCqHlVg1Nlx+qapZy+QoG+NV6ux+upo/T7arNGwKvKP2kmGM4W5QTbdewWFgudQxi3kDNST9GT1/mg==} + cpu: [arm64] + os: [linux] + '@rollup/rollup-linux-arm64-musl@4.18.0': resolution: {integrity: sha512-be6Yx37b24ZwxQ+wOQXXLZqpq4jTckJhtGlWGZs68TgdKXJgw54lUUoFYrg6Zs/kjzAQwEwYbp8JxZVzZLRepQ==} cpu: [arm64] os: [linux] + '@rollup/rollup-linux-arm64-musl@4.22.0': + resolution: {integrity: sha512-aQpNlKmx3amwkA3a5J6nlXSahE1ijl0L9KuIjVOUhfOh7uw2S4piR3mtpxpRtbnK809SBtyPsM9q15CPTsY7HQ==} + cpu: [arm64] + os: [linux] + '@rollup/rollup-linux-powerpc64le-gnu@4.18.0': resolution: {integrity: sha512-hNVMQK+qrA9Todu9+wqrXOHxFiD5YmdEi3paj6vP02Kx1hjd2LLYR2eaN7DsEshg09+9uzWi2W18MJDlG0cxJA==} cpu: [ppc64] os: [linux] + '@rollup/rollup-linux-powerpc64le-gnu@4.22.0': + resolution: {integrity: sha512-9fx6Zj/7vve/Fp4iexUFRKb5+RjLCff6YTRQl4CoDhdMfDoobWmhAxQWV3NfShMzQk1Q/iCnageFyGfqnsmeqQ==} + cpu: [ppc64] + os: [linux] + '@rollup/rollup-linux-riscv64-gnu@4.18.0': resolution: {integrity: sha512-ROCM7i+m1NfdrsmvwSzoxp9HFtmKGHEqu5NNDiZWQtXLA8S5HBCkVvKAxJ8U+CVctHwV2Gb5VUaK7UAkzhDjlg==} cpu: [riscv64] os: [linux] + '@rollup/rollup-linux-riscv64-gnu@4.22.0': + resolution: {integrity: sha512-VWQiCcN7zBgZYLjndIEh5tamtnKg5TGxyZPWcN9zBtXBwfcGSZ5cHSdQZfQH/GB4uRxk0D3VYbOEe/chJhPGLQ==} + cpu: [riscv64] + os: [linux] + '@rollup/rollup-linux-s390x-gnu@4.18.0': resolution: {integrity: sha512-0UyyRHyDN42QL+NbqevXIIUnKA47A+45WyasO+y2bGJ1mhQrfrtXUpTxCOrfxCR4esV3/RLYyucGVPiUsO8xjg==} cpu: [s390x] os: [linux] + '@rollup/rollup-linux-s390x-gnu@4.22.0': + resolution: {integrity: sha512-EHmPnPWvyYqncObwqrosb/CpH3GOjE76vWVs0g4hWsDRUVhg61hBmlVg5TPXqF+g+PvIbqkC7i3h8wbn4Gp2Fg==} + cpu: [s390x] + os: [linux] + '@rollup/rollup-linux-x64-gnu@4.18.0': resolution: {integrity: sha512-xuglR2rBVHA5UsI8h8UbX4VJ470PtGCf5Vpswh7p2ukaqBGFTnsfzxUBetoWBWymHMxbIG0Cmx7Y9qDZzr648w==} cpu: [x64] os: [linux] + '@rollup/rollup-linux-x64-gnu@4.22.0': + resolution: {integrity: sha512-tsSWy3YQzmpjDKnQ1Vcpy3p9Z+kMFbSIesCdMNgLizDWFhrLZIoN21JSq01g+MZMDFF+Y1+4zxgrlqPjid5ohg==} + cpu: [x64] + os: [linux] + '@rollup/rollup-linux-x64-musl@4.18.0': resolution: {integrity: sha512-LKaqQL9osY/ir2geuLVvRRs+utWUNilzdE90TpyoX0eNqPzWjRm14oMEE+YLve4k/NAqCdPkGYDaDF5Sw+xBfg==} cpu: [x64] os: [linux] + '@rollup/rollup-linux-x64-musl@4.22.0': + resolution: {integrity: sha512-anr1Y11uPOQrpuU8XOikY5lH4Qu94oS6j0xrulHk3NkLDq19MlX8Ng/pVipjxBJ9a2l3+F39REZYyWQFkZ4/fw==} + cpu: [x64] + os: [linux] + '@rollup/rollup-win32-arm64-msvc@4.18.0': resolution: {integrity: sha512-7J6TkZQFGo9qBKH0pk2cEVSRhJbL6MtfWxth7Y5YmZs57Pi+4x6c2dStAUvaQkHQLnEQv1jzBUW43GvZW8OFqA==} cpu: [arm64] os: [win32] + '@rollup/rollup-win32-arm64-msvc@4.22.0': + resolution: {integrity: sha512-7LB+Bh+Ut7cfmO0m244/asvtIGQr5pG5Rvjz/l1Rnz1kDzM02pSX9jPaS0p+90H5I1x4d1FkCew+B7MOnoatNw==} + cpu: [arm64] + os: [win32] + '@rollup/rollup-win32-ia32-msvc@4.18.0': resolution: {integrity: sha512-Txjh+IxBPbkUB9+SXZMpv+b/vnTEtFyfWZgJ6iyCmt2tdx0OF5WhFowLmnh8ENGNpfUlUZkdI//4IEmhwPieNg==} cpu: [ia32] os: [win32] + '@rollup/rollup-win32-ia32-msvc@4.22.0': + resolution: {integrity: sha512-+3qZ4rer7t/QsC5JwMpcvCVPRcJt1cJrYS/TMJZzXIJbxWFQEVhrIc26IhB+5Z9fT9umfVc+Es2mOZgl+7jdJQ==} + cpu: [ia32] + os: [win32] + '@rollup/rollup-win32-x64-msvc@4.18.0': resolution: {integrity: sha512-UOo5FdvOL0+eIVTgS4tIdbW+TtnBLWg1YBCcU2KWM7nuNwRz9bksDX1bekJJCpu25N1DVWaCwnT39dVQxzqS8g==} cpu: [x64] os: [win32] + '@rollup/rollup-win32-x64-msvc@4.22.0': + resolution: {integrity: sha512-YdicNOSJONVx/vuPkgPTyRoAPx3GbknBZRCOUkK84FJ/YTfs/F0vl/YsMscrB6Y177d+yDRcj+JWMPMCgshwrA==} + cpu: [x64] + os: [win32] + '@rushstack/eslint-patch@1.10.4': resolution: {integrity: sha512-WJgX9nzTqknM393q1QJDJmoW28kUfEnybeTfVNcNAPnIx210RXm2DiXiHzfNPJNIUUb1tJnz/l4QGtJ30PgWmA==} @@ -2987,12 +3067,12 @@ packages: peerDependencies: '@sveltejs/kit': ^2.0.0 - '@sveltejs/kit@2.0.0': - resolution: {integrity: sha512-/GFxvit+q7PztRbgGTFXhVB6jvb0fZSeWuz5f4siQ2r/5BVhxYh7++Bw3/ZUjiOuyoZFiNBmOPcRNQbkzEce0g==} + '@sveltejs/kit@2.5.28': + resolution: {integrity: sha512-/O7pvFGBsQPcFa9UrW8eUC5uHTOXLsUp3SN0dY6YmRAL9nfPSrJsSJk//j5vMpinSshzUjteAFcfQTU+04Ka1w==} engines: {node: '>=18.13'} hasBin: true peerDependencies: - '@sveltejs/vite-plugin-svelte': ^3.0.0 + '@sveltejs/vite-plugin-svelte': ^3.0.0 || ^4.0.0-next.1 svelte: ^4.0.0 || ^5.0.0-next.0 vite: ^5.0.3 @@ -3866,8 +3946,8 @@ packages: axios@1.7.7: resolution: {integrity: sha512-S4kL7XrjgBmvdGut0sN3yJxqYzrDOnivkBiN0OFs6hLiUam3UPvswUo0kqGyhqUZGEOytHyumEdXsAkgCOUf3Q==} - axobject-query@3.2.4: - resolution: {integrity: sha512-aPTElBrbifBU1krmZxGZOlBkslORe7Ll7+BDnI50Wy4LgOt69luMgevkDfTq1O/ZgprooPCtWpjCwKSZw/iZ4A==} + axobject-query@4.1.0: + resolution: {integrity: sha512-qIj0G9wZbMGNLjLmg1PT6v2mE9AH2zlnADJD/2tC6E00hgmhUOfEB6greHPAfLRSufHqROIUTkw6E+M3lH0PTQ==} engines: {node: '>= 0.4'} b4a@1.6.6: @@ -3944,8 +4024,8 @@ packages: bl@4.1.0: resolution: {integrity: sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==} - body-parser@1.20.2: - resolution: {integrity: sha512-ml9pReCu3M61kGlqoTm2umSXTlRTuGTx0bfYj+uIUKKYycG5NtSbeetV3faSU6R7ajOPw0g/J1PvK4qNy7s5bA==} + body-parser@1.20.3: + resolution: {integrity: sha512-7rAxByjUMqQ3/bHJy7D6OGXvx/MMc4IqBn/X0fcM1QUcAItpZrBEYhWGem+tzXH90c+G01ypMcYJBO9Y30203g==} engines: {node: '>= 0.8', npm: 1.2.8000 || >= 1.4.16} bonjour-service@1.2.1: @@ -4436,8 +4516,8 @@ packages: detect-node@2.1.0: resolution: {integrity: sha512-T0NIuQpnTvFDATNuHN5roPwSBG83rFsuO+MXXH9/3N1eFbn4wcPjttvjMLEPWJ0RGUYgQE7cGgS3tNxbqCGM7g==} - devalue@4.3.3: - resolution: {integrity: sha512-UH8EL6H2ifcY8TbD2QsxwCC/pr5xSwPvv85LrLXVihmHVC3T3YqTCIwnR5ak0yO1KYqlxrPVOA/JVZJYPy2ATg==} + devalue@5.0.0: + resolution: {integrity: sha512-gO+/OMXF7488D+u3ue+G7Y4AA3ZmUnB3eHJXmBTgNHvr4ZNzl36A0ZtG+XCRNYCkYx/bFmw4qtkoFLa+wSrwAA==} devtools-protocol@0.0.1299070: resolution: {integrity: sha512-+qtL3eX50qsJ7c+qVyagqi7AWMoQCBGNfoyJZMwm/NSXVqLYbuitrWEEIzxfUmTNy7//Xe8yhMmQ+elj3uAqSg==} @@ -4519,6 +4599,10 @@ packages: resolution: {integrity: sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==} engines: {node: '>= 0.8'} + encodeurl@2.0.0: + resolution: {integrity: sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==} + engines: {node: '>= 0.8'} + encoding@0.1.13: resolution: {integrity: sha512-ETBauow1T35Y/WZMkio9jiM0Z5xjHHmJ4XmjZOq1l/dXz3lr2sRn87nJy20RupqSh1F2m3HHPSp8ShIPQJrJ3A==} @@ -4789,8 +4873,8 @@ packages: exponential-backoff@3.1.1: resolution: {integrity: sha512-dX7e/LHVJ6W3DE1MHWi9S1EYzDESENfLrYohG2G++ovZrYOkm4Knwa0mc1cn84xJOR4KEU0WSchhLbd0UklbHw==} - express@4.19.2: - resolution: {integrity: sha512-5T6nhjsT+EOMzuck8JjBHARTHfMht0POzlA60WV2pMD3gyXw2LZnZ+ueGdNxG+0calOJcWKbpFcuzLZ91YWq9Q==} + express@4.21.0: + resolution: {integrity: sha512-VqcNGcj/Id5ZT1LZ/cfihi3ttTn+NJmkli2eZADigjq29qTlWi/hAQ43t/VLPq8+UX06FCEx3ByOYet6ZFblng==} engines: {node: '>= 0.10.0'} extendable-error@0.1.7: @@ -4850,8 +4934,8 @@ packages: resolution: {integrity: sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==} engines: {node: '>=8'} - finalhandler@1.2.0: - resolution: {integrity: sha512-5uXcUVftlQMFnWC9qu/svkWv3GTd2PfUhK/3PLkYNAe7FbqJMt3515HaxE6eRL74GdsriiwujiawdaB1BpEISg==} + finalhandler@1.3.1: + resolution: {integrity: sha512-6BN9trH7bp3qvnrRyzsBz+g3lZxTNZTbVO2EV1CS0WIcDbawYVdYvGflME/9QP0h0pYlCDBCTjYa9nZzMDpyxQ==} engines: {node: '>= 0.8'} find-cache-dir@4.0.0: @@ -5713,8 +5797,8 @@ packages: resolution: {integrity: sha512-S3UwM3yj5mtUSEfP41UZmt/0SCoVYUcU1rkXv+BQ5Ig8ndL4sPoJNBUJERafdPb5jjHJGuMgytgKvKIf58XNBw==} engines: {node: '>= 0.10.0'} - merge-descriptors@1.0.1: - resolution: {integrity: sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w==} + merge-descriptors@1.0.3: + resolution: {integrity: sha512-gaNvAS7TZ897/rVaZ0nMtAyxNyi/pdbjbAwUpFQpN70GqnVfOiXpeUUMKRBmzXaSQ8DdTX4/0ms62r2K+hE6mQ==} merge-stream@2.0.0: resolution: {integrity: sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==} @@ -5840,10 +5924,6 @@ packages: resolution: {integrity: sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA==} engines: {node: '>=4'} - mrmime@1.0.1: - resolution: {integrity: sha512-hzzEagAgDyoU1Q6yg5uI+AorQgdvMCur3FcKf7NhMKWsaYg+RnbTyHRa/9IlLF9rf455MOCtcqqrQQ83pPP7Uw==} - engines: {node: '>=10'} - mrmime@2.0.0: resolution: {integrity: sha512-eu38+hdgojoyq63s+yTpN4XMBdt5l8HhMhc4VKLO9KM5caLIBvUm4thi7fFaxyTmCKeNnXZ5pAlBwCUnhA09uw==} engines: {node: '>=10'} @@ -6192,8 +6272,8 @@ packages: resolution: {integrity: sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==} engines: {node: '>=16 || 14 >=14.18'} - path-to-regexp@0.1.7: - resolution: {integrity: sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ==} + path-to-regexp@0.1.10: + resolution: {integrity: sha512-7lf7qcQidTku0Gu3YDPc8DJ1q7OOucfa/BSsIwjuh56VU7katFvuM8hULfkwB3Fns/rsVF7PwPKVw1sl5KQS9w==} path-type@4.0.0: resolution: {integrity: sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==} @@ -6498,8 +6578,8 @@ packages: engines: {node: '>=18'} hasBin: true - qs@6.11.0: - resolution: {integrity: sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==} + qs@6.13.0: + resolution: {integrity: sha512-+38qI9SOr8tfZ4QmJNplMUxqjbe7LKvvZgWdExBOmd+egZTtjLB67Gu0HRX3u/XOq7UU2Nx6nsjvS16Z9uwfpg==} engines: {node: '>=0.6'} querystringify@2.2.0: @@ -6709,6 +6789,11 @@ packages: engines: {node: '>=18.0.0', npm: '>=8.0.0'} hasBin: true + rollup@4.22.0: + resolution: {integrity: sha512-W21MUIFPZ4+O2Je/EU+GP3iz7PH4pVPUXSbEZdatQnxo29+3rsUjgrJmzuAZU24z7yRAnFN6ukxeAhZh/c7hzg==} + engines: {node: '>=18.0.0', npm: '>=8.0.0'} + hasBin: true + rrweb-cssom@0.6.0: resolution: {integrity: sha512-APM0Gt1KoXBz0iIkkdB/kfvGOwC4UuJFeG/c+yV7wSc7q96cG/kJ0HiYCnzivD9SB53cLV1MlHFNfOuPaadYSw==} @@ -6817,8 +6902,8 @@ packages: engines: {node: '>=10'} hasBin: true - send@0.18.0: - resolution: {integrity: sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg==} + send@0.19.0: + resolution: {integrity: sha512-dW41u5VfLXu8SJh5bwRmyYUbAoSB3c9uQh6L8h/KtsFREPWpbX1lrljJo186Jc4nmci/sGUZ9a0a0J2zgfq2hw==} engines: {node: '>= 0.8.0'} serialize-javascript@6.0.2: @@ -6838,8 +6923,8 @@ packages: resolution: {integrity: sha512-pXHfKNP4qujrtteMrSBb0rc8HJ9Ms/GrXwcUtUtD5s4ewDJI8bT3Cz2zTVRMKtri49pLx2e0Ya8ziP5Ya2pZZw==} engines: {node: '>= 0.8.0'} - serve-static@1.15.0: - resolution: {integrity: sha512-XGuRDNjXUijsUL0vl6nSD7cwURuzEgglbOaFuZM9g3kwDXOWVTck0jLzjPzGD+TazWbboZYu52/9/XPdUgne9g==} + serve-static@1.16.2: + resolution: {integrity: sha512-VqpjJZKadQB/PEbEwvFdO43Ax5dFBZ2UECszz8bQ7pi7wt//PWe1P6MN7eCnjsatYtBT6EuiClbjSWP2WrIoTw==} engines: {node: '>= 0.8.0'} set-cookie-parser@2.7.0: @@ -7154,8 +7239,8 @@ packages: typescript: optional: true - svelte@4.2.7: - resolution: {integrity: sha512-UExR1KS7raTdycsUrKLtStayu4hpdV3VZQgM0akX8XbXgLBlosdE/Sf3crOgyh9xIjqSYB3UEBuUlIQKRQX2hg==} + svelte@4.2.19: + resolution: {integrity: sha512-IY1rnGr6izd10B0A8LqsBfmlT5OILVuZ7XsI0vdGPEvuonFV7NYEUK4dAkm9Zg2q0Um92kYjTpS1CAP3Nh/KWw==} engines: {node: '>=16'} svg-tags@1.0.0: @@ -7558,34 +7643,6 @@ packages: peerDependencies: vite: ^3.0.0-0 || ^4.0.0-0 || ^5.0.0-0 - vite@5.0.3: - resolution: {integrity: sha512-WgEq8WEKpZ8c0DL4M1+E+kBZEJyjBmGVrul6z8Ljfhv+PPbNF4aGq014DwNYxGz2FGq6NKL0N8usdiESWd2l2w==} - engines: {node: ^18.0.0 || >=20.0.0} - hasBin: true - peerDependencies: - '@types/node': ^18.0.0 || >=20.0.0 - less: '*' - lightningcss: ^1.21.0 - sass: '*' - stylus: '*' - sugarss: '*' - terser: ^5.4.0 - peerDependenciesMeta: - '@types/node': - optional: true - less: - optional: true - lightningcss: - optional: true - sass: - optional: true - stylus: - optional: true - sugarss: - optional: true - terser: - optional: true - vite@5.1.7: resolution: {integrity: sha512-sgnEEFTZYMui/sTlH1/XEnVNHMujOahPLGMxn1+5sIT45Xjng1Ec1K78jRP15dSmVgg5WBin9yO81j3o9OxofA==} engines: {node: ^18.0.0 || >=20.0.0} @@ -7614,8 +7671,8 @@ packages: terser: optional: true - vite@5.3.3: - resolution: {integrity: sha512-NPQdeCU0Dv2z5fu+ULotpuq5yfCS1BzKUIPhNbP3YBfAMGJXbt2nS+sbTFu+qchaqWTD+H3JK++nRwr6XIcp6A==} + vite@5.4.6: + resolution: {integrity: sha512-IeL5f8OO5nylsgzd9tq4qD2QqI0k2CQLGrWD0rCN0EQJZpBK5vJAx0I+GDkMOXxQX/OfFHMuLIx6ddAxGX/k+Q==} engines: {node: ^18.0.0 || >=20.0.0} hasBin: true peerDependencies: @@ -7623,6 +7680,7 @@ packages: less: '*' lightningcss: ^1.21.0 sass: '*' + sass-embedded: '*' stylus: '*' sugarss: '*' terser: ^5.4.0 @@ -7635,6 +7693,8 @@ packages: optional: true sass: optional: true + sass-embedded: + optional: true stylus: optional: true sugarss: @@ -9843,7 +9903,7 @@ snapshots: '@jridgewell/gen-mapping@0.3.5': dependencies: '@jridgewell/set-array': 1.2.1 - '@jridgewell/sourcemap-codec': 1.4.15 + '@jridgewell/sourcemap-codec': 1.5.0 '@jridgewell/trace-mapping': 0.3.25 '@jridgewell/resolve-uri@3.1.2': {} @@ -9867,7 +9927,7 @@ snapshots: '@jridgewell/trace-mapping@0.3.9': dependencies: '@jridgewell/resolve-uri': 3.1.2 - '@jridgewell/sourcemap-codec': 1.4.15 + '@jridgewell/sourcemap-codec': 1.5.0 '@jsdevtools/ono@7.1.3': {} @@ -10658,22 +10718,22 @@ snapshots: optionalDependencies: rollup: 4.18.0 - '@rollup/plugin-json@6.1.0(rollup@4.18.0)': + '@rollup/plugin-json@6.1.0(rollup@4.22.0)': dependencies: - '@rollup/pluginutils': 5.1.0(rollup@4.18.0) + '@rollup/pluginutils': 5.1.0(rollup@4.22.0) optionalDependencies: - rollup: 4.18.0 + rollup: 4.22.0 - '@rollup/plugin-node-resolve@15.2.3(rollup@4.18.0)': + '@rollup/plugin-node-resolve@15.2.3(rollup@4.22.0)': dependencies: - '@rollup/pluginutils': 5.1.0(rollup@4.18.0) + '@rollup/pluginutils': 5.1.0(rollup@4.22.0) '@types/resolve': 1.20.2 deepmerge: 4.3.1 is-builtin-module: 3.2.1 is-module: 1.0.0 resolve: 1.22.8 optionalDependencies: - rollup: 4.18.0 + rollup: 4.22.0 '@rollup/plugin-terser@0.4.4(rollup@4.18.0)': dependencies: @@ -10700,54 +10760,110 @@ snapshots: optionalDependencies: rollup: 4.18.0 + '@rollup/pluginutils@5.1.0(rollup@4.22.0)': + dependencies: + '@types/estree': 1.0.5 + estree-walker: 2.0.2 + picomatch: 2.3.1 + optionalDependencies: + rollup: 4.22.0 + '@rollup/rollup-android-arm-eabi@4.18.0': optional: true + '@rollup/rollup-android-arm-eabi@4.22.0': + optional: true + '@rollup/rollup-android-arm64@4.18.0': optional: true + '@rollup/rollup-android-arm64@4.22.0': + optional: true + '@rollup/rollup-darwin-arm64@4.18.0': optional: true + '@rollup/rollup-darwin-arm64@4.22.0': + optional: true + '@rollup/rollup-darwin-x64@4.18.0': optional: true + '@rollup/rollup-darwin-x64@4.22.0': + optional: true + '@rollup/rollup-linux-arm-gnueabihf@4.18.0': optional: true + '@rollup/rollup-linux-arm-gnueabihf@4.22.0': + optional: true + '@rollup/rollup-linux-arm-musleabihf@4.18.0': optional: true + '@rollup/rollup-linux-arm-musleabihf@4.22.0': + optional: true + '@rollup/rollup-linux-arm64-gnu@4.18.0': optional: true + '@rollup/rollup-linux-arm64-gnu@4.22.0': + optional: true + '@rollup/rollup-linux-arm64-musl@4.18.0': optional: true + '@rollup/rollup-linux-arm64-musl@4.22.0': + optional: true + '@rollup/rollup-linux-powerpc64le-gnu@4.18.0': optional: true + '@rollup/rollup-linux-powerpc64le-gnu@4.22.0': + optional: true + '@rollup/rollup-linux-riscv64-gnu@4.18.0': optional: true + '@rollup/rollup-linux-riscv64-gnu@4.22.0': + optional: true + '@rollup/rollup-linux-s390x-gnu@4.18.0': optional: true + '@rollup/rollup-linux-s390x-gnu@4.22.0': + optional: true + '@rollup/rollup-linux-x64-gnu@4.18.0': optional: true + '@rollup/rollup-linux-x64-gnu@4.22.0': + optional: true + '@rollup/rollup-linux-x64-musl@4.18.0': optional: true + '@rollup/rollup-linux-x64-musl@4.22.0': + optional: true + '@rollup/rollup-win32-arm64-msvc@4.18.0': optional: true + '@rollup/rollup-win32-arm64-msvc@4.22.0': + optional: true + '@rollup/rollup-win32-ia32-msvc@4.18.0': optional: true + '@rollup/rollup-win32-ia32-msvc@4.22.0': + optional: true + '@rollup/rollup-win32-x64-msvc@4.18.0': optional: true + '@rollup/rollup-win32-x64-msvc@4.22.0': + optional: true + '@rushstack/eslint-patch@1.10.4': {} '@schematics/angular@17.3.7(chokidar@3.6.0)': @@ -10802,48 +10918,49 @@ snapshots: '@stackblitz/sdk@1.11.0': {} - '@sveltejs/adapter-auto@3.0.0(@sveltejs/kit@2.0.0(@sveltejs/vite-plugin-svelte@3.0.0(svelte@4.2.7)(vite@5.0.3(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1)))(svelte@4.2.7)(vite@5.0.3(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1)))': + '@sveltejs/adapter-auto@3.0.0(@sveltejs/kit@2.5.28(@sveltejs/vite-plugin-svelte@3.0.0(svelte@4.2.19)(vite@5.4.6(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1)))(svelte@4.2.19)(vite@5.4.6(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1)))': dependencies: - '@sveltejs/kit': 2.0.0(@sveltejs/vite-plugin-svelte@3.0.0(svelte@4.2.7)(vite@5.0.3(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1)))(svelte@4.2.7)(vite@5.0.3(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1)) + '@sveltejs/kit': 2.5.28(@sveltejs/vite-plugin-svelte@3.0.0(svelte@4.2.19)(vite@5.4.6(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1)))(svelte@4.2.19)(vite@5.4.6(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1)) import-meta-resolve: 4.1.0 - '@sveltejs/kit@2.0.0(@sveltejs/vite-plugin-svelte@3.0.0(svelte@4.2.7)(vite@5.0.3(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1)))(svelte@4.2.7)(vite@5.0.3(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1))': + '@sveltejs/kit@2.5.28(@sveltejs/vite-plugin-svelte@3.0.0(svelte@4.2.19)(vite@5.4.6(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1)))(svelte@4.2.19)(vite@5.4.6(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1))': dependencies: - '@sveltejs/vite-plugin-svelte': 3.0.0(svelte@4.2.7)(vite@5.0.3(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1)) + '@sveltejs/vite-plugin-svelte': 3.0.0(svelte@4.2.19)(vite@5.4.6(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1)) '@types/cookie': 0.6.0 cookie: 0.6.0 - devalue: 4.3.3 + devalue: 5.0.0 esm-env: 1.0.0 + import-meta-resolve: 4.1.0 kleur: 4.1.5 - magic-string: 0.30.10 - mrmime: 1.0.1 + magic-string: 0.30.11 + mrmime: 2.0.0 sade: 1.8.1 set-cookie-parser: 2.7.0 sirv: 2.0.4 - svelte: 4.2.7 + svelte: 4.2.19 tiny-glob: 0.2.9 - vite: 5.0.3(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1) + vite: 5.4.6(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1) - '@sveltejs/vite-plugin-svelte-inspector@2.1.0(@sveltejs/vite-plugin-svelte@3.0.0(svelte@4.2.7)(vite@5.0.3(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1)))(svelte@4.2.7)(vite@5.0.3(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1))': + '@sveltejs/vite-plugin-svelte-inspector@2.1.0(@sveltejs/vite-plugin-svelte@3.0.0(svelte@4.2.19)(vite@5.4.6(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1)))(svelte@4.2.19)(vite@5.4.6(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1))': dependencies: - '@sveltejs/vite-plugin-svelte': 3.0.0(svelte@4.2.7)(vite@5.0.3(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1)) + '@sveltejs/vite-plugin-svelte': 3.0.0(svelte@4.2.19)(vite@5.4.6(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1)) debug: 4.3.5 - svelte: 4.2.7 - vite: 5.0.3(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1) + svelte: 4.2.19 + vite: 5.4.6(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1) transitivePeerDependencies: - supports-color - '@sveltejs/vite-plugin-svelte@3.0.0(svelte@4.2.7)(vite@5.0.3(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1))': + '@sveltejs/vite-plugin-svelte@3.0.0(svelte@4.2.19)(vite@5.4.6(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1))': dependencies: - '@sveltejs/vite-plugin-svelte-inspector': 2.1.0(@sveltejs/vite-plugin-svelte@3.0.0(svelte@4.2.7)(vite@5.0.3(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1)))(svelte@4.2.7)(vite@5.0.3(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1)) + '@sveltejs/vite-plugin-svelte-inspector': 2.1.0(@sveltejs/vite-plugin-svelte@3.0.0(svelte@4.2.19)(vite@5.4.6(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1)))(svelte@4.2.19)(vite@5.4.6(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1)) debug: 4.3.5 deepmerge: 4.3.1 kleur: 4.1.5 magic-string: 0.30.10 - svelte: 4.2.7 - svelte-hmr: 0.15.3(svelte@4.2.7) - vite: 5.0.3(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1) - vitefu: 0.2.5(vite@5.0.3(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1)) + svelte: 4.2.19 + svelte-hmr: 0.15.3(svelte@4.2.19) + vite: 5.4.6(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1) + vitefu: 0.2.5(vite@5.4.6(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1)) transitivePeerDependencies: - supports-color @@ -10873,10 +10990,10 @@ snapshots: '@tanstack/query-core': 5.51.21 solid-js: 1.8.20 - '@tanstack/svelte-query@5.56.2(svelte@4.2.7)': + '@tanstack/svelte-query@5.56.2(svelte@4.2.19)': dependencies: '@tanstack/query-core': 5.56.2 - svelte: 4.2.7 + svelte: 4.2.19 '@tanstack/vue-query-devtools@5.56.2(@tanstack/vue-query@5.56.2(vue@3.5.5(typescript@5.5.3)))(vue@3.5.5(typescript@5.5.3))': dependencies: @@ -11297,35 +11414,35 @@ snapshots: dependencies: vite: 5.1.7(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.29.1) - '@vitejs/plugin-react@4.3.1(vite@5.3.3(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1))': + '@vitejs/plugin-react@4.3.1(vite@5.4.6(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1))': dependencies: '@babel/core': 7.24.7 '@babel/plugin-transform-react-jsx-self': 7.24.7(@babel/core@7.24.7) '@babel/plugin-transform-react-jsx-source': 7.24.7(@babel/core@7.24.7) '@types/babel__core': 7.20.5 react-refresh: 0.14.2 - vite: 5.3.3(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1) + vite: 5.4.6(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1) transitivePeerDependencies: - supports-color - '@vitejs/plugin-vue-jsx@4.0.0(vite@5.3.3(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1))(vue@3.5.5(typescript@5.5.3))': + '@vitejs/plugin-vue-jsx@4.0.0(vite@5.4.6(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1))(vue@3.5.5(typescript@5.5.3))': dependencies: '@babel/core': 7.24.7 '@babel/plugin-transform-typescript': 7.25.2(@babel/core@7.24.7) '@vue/babel-plugin-jsx': 1.2.2(@babel/core@7.24.7) - vite: 5.3.3(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1) + vite: 5.4.6(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1) vue: 3.5.5(typescript@5.5.3) transitivePeerDependencies: - supports-color - '@vitejs/plugin-vue@5.0.5(vite@5.3.3(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1))(vue@3.5.3(typescript@5.5.3))': + '@vitejs/plugin-vue@5.0.5(vite@5.4.6(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1))(vue@3.5.3(typescript@5.5.3))': dependencies: - vite: 5.3.3(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1) + vite: 5.4.6(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1) vue: 3.5.3(typescript@5.5.3) - '@vitejs/plugin-vue@5.0.5(vite@5.3.3(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1))(vue@3.5.5(typescript@5.5.3))': + '@vitejs/plugin-vue@5.0.5(vite@5.4.6(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1))(vue@3.5.5(typescript@5.5.3))': dependencies: - vite: 5.3.3(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1) + vite: 5.4.6(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1) vue: 3.5.5(typescript@5.5.3) '@vitest/coverage-v8@1.6.0(vitest@1.6.0(@types/node@20.14.10)(jsdom@24.1.0)(less@4.2.0)(sass@1.71.1)(terser@5.31.1))': @@ -11518,14 +11635,14 @@ snapshots: dependencies: '@vue/devtools-kit': 7.3.5 - '@vue/devtools-core@7.3.7(vite@5.3.3(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1))(vue@3.5.5(typescript@5.5.3))': + '@vue/devtools-core@7.3.7(vite@5.4.6(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1))(vue@3.5.5(typescript@5.5.3))': dependencies: '@vue/devtools-kit': 7.3.7 '@vue/devtools-shared': 7.3.7 mitt: 3.0.1 nanoid: 3.3.7 pathe: 1.1.2 - vite-hot-client: 0.2.3(vite@5.3.3(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1)) + vite-hot-client: 0.2.3(vite@5.4.6(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1)) vue: 3.5.5(typescript@5.5.3) transitivePeerDependencies: - vite @@ -11960,7 +12077,7 @@ snapshots: transitivePeerDependencies: - debug - axobject-query@3.2.4: {} + axobject-query@4.1.0: {} b4a@1.6.6: {} @@ -12052,7 +12169,7 @@ snapshots: inherits: 2.0.4 readable-stream: 3.6.2 - body-parser@1.20.2: + body-parser@1.20.3: dependencies: bytes: 3.1.2 content-type: 1.0.5 @@ -12062,7 +12179,7 @@ snapshots: http-errors: 2.0.0 iconv-lite: 0.4.24 on-finished: 2.4.1 - qs: 6.11.0 + qs: 6.13.0 raw-body: 2.5.2 type-is: 1.6.18 unpipe: 1.0.0 @@ -12283,7 +12400,7 @@ snapshots: code-red@1.0.4: dependencies: - '@jridgewell/sourcemap-codec': 1.4.15 + '@jridgewell/sourcemap-codec': 1.5.0 '@types/estree': 1.0.5 acorn: 8.12.0 estree-walker: 3.0.3 @@ -12545,7 +12662,7 @@ snapshots: detect-node@2.1.0: {} - devalue@4.3.3: {} + devalue@5.0.0: {} devtools-protocol@0.0.1299070: {} @@ -12612,6 +12729,8 @@ snapshots: encodeurl@1.0.2: {} + encodeurl@2.0.0: {} + encoding@0.1.13: dependencies: iconv-lite: 0.6.3 @@ -12797,7 +12916,7 @@ snapshots: natural-compare: 1.4.0 requireindex: 1.2.0 - eslint-plugin-svelte@2.36.0(eslint@9.0.0)(svelte@4.2.7)(ts-node@10.9.2(@types/node@20.14.10)(typescript@5.5.3)): + eslint-plugin-svelte@2.36.0(eslint@9.0.0)(svelte@4.2.19)(ts-node@10.9.2(@types/node@20.14.10)(typescript@5.5.3)): dependencies: '@eslint-community/eslint-utils': 4.4.0(eslint@9.0.0) '@jridgewell/sourcemap-codec': 1.4.15 @@ -12811,9 +12930,9 @@ snapshots: postcss-safe-parser: 6.0.0(postcss@8.4.39) postcss-selector-parser: 6.1.0 semver: 7.6.2 - svelte-eslint-parser: 0.41.0(svelte@4.2.7) + svelte-eslint-parser: 0.41.0(svelte@4.2.19) optionalDependencies: - svelte: 4.2.7 + svelte: 4.2.19 transitivePeerDependencies: - supports-color - ts-node @@ -13031,34 +13150,34 @@ snapshots: exponential-backoff@3.1.1: {} - express@4.19.2: + express@4.21.0: dependencies: accepts: 1.3.8 array-flatten: 1.1.1 - body-parser: 1.20.2 + body-parser: 1.20.3 content-disposition: 0.5.4 content-type: 1.0.5 cookie: 0.6.0 cookie-signature: 1.0.6 debug: 2.6.9 depd: 2.0.0 - encodeurl: 1.0.2 + encodeurl: 2.0.0 escape-html: 1.0.3 etag: 1.8.1 - finalhandler: 1.2.0 + finalhandler: 1.3.1 fresh: 0.5.2 http-errors: 2.0.0 - merge-descriptors: 1.0.1 + merge-descriptors: 1.0.3 methods: 1.1.2 on-finished: 2.4.1 parseurl: 1.3.3 - path-to-regexp: 0.1.7 + path-to-regexp: 0.1.10 proxy-addr: 2.0.7 - qs: 6.11.0 + qs: 6.13.0 range-parser: 1.2.1 safe-buffer: 5.2.1 - send: 0.18.0 - serve-static: 1.15.0 + send: 0.19.0 + serve-static: 1.16.2 setprototypeof: 1.2.0 statuses: 2.0.1 type-is: 1.6.18 @@ -13132,10 +13251,10 @@ snapshots: dependencies: to-regex-range: 5.0.1 - finalhandler@1.2.0: + finalhandler@1.3.1: dependencies: debug: 2.6.9 - encodeurl: 1.0.2 + encodeurl: 2.0.0 escape-html: 1.0.3 on-finished: 2.4.1 parseurl: 1.3.3 @@ -13965,7 +14084,7 @@ snapshots: magic-string@0.30.8: dependencies: - '@jridgewell/sourcemap-codec': 1.4.15 + '@jridgewell/sourcemap-codec': 1.5.0 magicast@0.3.4: dependencies: @@ -14014,7 +14133,7 @@ snapshots: memorystream@0.3.1: {} - merge-descriptors@1.0.1: {} + merge-descriptors@1.0.3: {} merge-stream@2.0.0: {} @@ -14124,8 +14243,6 @@ snapshots: mri@1.2.0: {} - mrmime@1.0.1: {} - mrmime@2.0.0: {} ms@2.0.0: {} @@ -14507,7 +14624,7 @@ snapshots: lru-cache: 10.4.0 minipass: 7.1.2 - path-to-regexp@0.1.7: {} + path-to-regexp@0.1.10: {} path-type@4.0.0: {} @@ -14702,10 +14819,10 @@ snapshots: dependencies: fast-diff: 1.3.0 - prettier-plugin-svelte@3.1.2(prettier@3.1.1)(svelte@4.2.7): + prettier-plugin-svelte@3.1.2(prettier@3.1.1)(svelte@4.2.19): dependencies: prettier: 3.1.1 - svelte: 4.2.7 + svelte: 4.2.19 prettier@2.8.8: {} @@ -14794,7 +14911,7 @@ snapshots: - typescript - utf-8-validate - qs@6.11.0: + qs@6.13.0: dependencies: side-channel: 1.0.6 @@ -15024,6 +15141,28 @@ snapshots: '@rollup/rollup-win32-x64-msvc': 4.18.0 fsevents: 2.3.3 + rollup@4.22.0: + dependencies: + '@types/estree': 1.0.5 + optionalDependencies: + '@rollup/rollup-android-arm-eabi': 4.22.0 + '@rollup/rollup-android-arm64': 4.22.0 + '@rollup/rollup-darwin-arm64': 4.22.0 + '@rollup/rollup-darwin-x64': 4.22.0 + '@rollup/rollup-linux-arm-gnueabihf': 4.22.0 + '@rollup/rollup-linux-arm-musleabihf': 4.22.0 + '@rollup/rollup-linux-arm64-gnu': 4.22.0 + '@rollup/rollup-linux-arm64-musl': 4.22.0 + '@rollup/rollup-linux-powerpc64le-gnu': 4.22.0 + '@rollup/rollup-linux-riscv64-gnu': 4.22.0 + '@rollup/rollup-linux-s390x-gnu': 4.22.0 + '@rollup/rollup-linux-x64-gnu': 4.22.0 + '@rollup/rollup-linux-x64-musl': 4.22.0 + '@rollup/rollup-win32-arm64-msvc': 4.22.0 + '@rollup/rollup-win32-ia32-msvc': 4.22.0 + '@rollup/rollup-win32-x64-msvc': 4.22.0 + fsevents: 2.3.3 + rrweb-cssom@0.6.0: {} rrweb-cssom@0.7.1: {} @@ -15114,7 +15253,7 @@ snapshots: semver@7.6.2: {} - send@0.18.0: + send@0.19.0: dependencies: debug: 2.6.9 depd: 2.0.0 @@ -15154,12 +15293,12 @@ snapshots: transitivePeerDependencies: - supports-color - serve-static@1.15.0: + serve-static@1.16.2: dependencies: - encodeurl: 1.0.2 + encodeurl: 2.0.0 escape-html: 1.0.3 parseurl: 1.3.3 - send: 0.18.0 + send: 0.19.0 transitivePeerDependencies: - supports-color @@ -15276,7 +15415,7 @@ snapshots: sorcery@0.11.1: dependencies: - '@jridgewell/sourcemap-codec': 1.4.15 + '@jridgewell/sourcemap-codec': 1.5.0 buffer-crc32: 1.0.0 minimist: 1.2.8 sander: 0.5.1 @@ -15444,7 +15583,7 @@ snapshots: supports-preserve-symlinks-flag@1.0.0: {} - svelte-check@3.6.0(@babel/core@7.24.7)(less@4.2.0)(postcss-load-config@4.0.2(postcss@8.4.39)(ts-node@10.9.2(@types/node@20.14.10)(typescript@5.5.3)))(postcss@8.4.39)(sass@1.71.1)(svelte@4.2.7): + svelte-check@3.6.0(@babel/core@7.24.7)(less@4.2.0)(postcss-load-config@4.0.2(postcss@8.4.39)(ts-node@10.9.2(@types/node@20.14.10)(typescript@5.5.3)))(postcss@8.4.39)(sass@1.71.1)(svelte@4.2.19): dependencies: '@jridgewell/trace-mapping': 0.3.25 chokidar: 3.6.0 @@ -15452,8 +15591,8 @@ snapshots: import-fresh: 3.3.0 picocolors: 1.0.1 sade: 1.8.1 - svelte: 4.2.7 - svelte-preprocess: 5.1.4(@babel/core@7.24.7)(less@4.2.0)(postcss-load-config@4.0.2(postcss@8.4.39)(ts-node@10.9.2(@types/node@20.14.10)(typescript@5.5.3)))(postcss@8.4.39)(sass@1.71.1)(svelte@4.2.7)(typescript@5.5.3) + svelte: 4.2.19 + svelte-preprocess: 5.1.4(@babel/core@7.24.7)(less@4.2.0)(postcss-load-config@4.0.2(postcss@8.4.39)(ts-node@10.9.2(@types/node@20.14.10)(typescript@5.5.3)))(postcss@8.4.39)(sass@1.71.1)(svelte@4.2.19)(typescript@5.5.3) typescript: 5.5.3 transitivePeerDependencies: - '@babel/core' @@ -15466,7 +15605,7 @@ snapshots: - stylus - sugarss - svelte-eslint-parser@0.41.0(svelte@4.2.7): + svelte-eslint-parser@0.41.0(svelte@4.2.19): dependencies: eslint-scope: 7.2.2 eslint-visitor-keys: 3.4.3 @@ -15474,20 +15613,20 @@ snapshots: postcss: 8.4.39 postcss-scss: 4.0.9(postcss@8.4.39) optionalDependencies: - svelte: 4.2.7 + svelte: 4.2.19 - svelte-hmr@0.15.3(svelte@4.2.7): + svelte-hmr@0.15.3(svelte@4.2.19): dependencies: - svelte: 4.2.7 + svelte: 4.2.19 - svelte-preprocess@5.1.4(@babel/core@7.24.7)(less@4.2.0)(postcss-load-config@4.0.2(postcss@8.4.39)(ts-node@10.9.2(@types/node@20.14.10)(typescript@5.5.3)))(postcss@8.4.39)(sass@1.71.1)(svelte@4.2.7)(typescript@5.5.3): + svelte-preprocess@5.1.4(@babel/core@7.24.7)(less@4.2.0)(postcss-load-config@4.0.2(postcss@8.4.39)(ts-node@10.9.2(@types/node@20.14.10)(typescript@5.5.3)))(postcss@8.4.39)(sass@1.71.1)(svelte@4.2.19)(typescript@5.5.3): dependencies: '@types/pug': 2.0.10 detect-indent: 6.1.0 magic-string: 0.30.10 sorcery: 0.11.1 strip-indent: 3.0.0 - svelte: 4.2.7 + svelte: 4.2.19 optionalDependencies: '@babel/core': 7.24.7 less: 4.2.0 @@ -15496,20 +15635,21 @@ snapshots: sass: 1.71.1 typescript: 5.5.3 - svelte@4.2.7: + svelte@4.2.19: dependencies: '@ampproject/remapping': 2.3.0 - '@jridgewell/sourcemap-codec': 1.4.15 + '@jridgewell/sourcemap-codec': 1.5.0 '@jridgewell/trace-mapping': 0.3.25 + '@types/estree': 1.0.5 acorn: 8.12.0 aria-query: 5.3.0 - axobject-query: 3.2.4 + axobject-query: 4.1.0 code-red: 1.0.4 css-tree: 2.3.1 estree-walker: 3.0.3 is-reference: 3.0.2 locate-character: 3.0.0 - magic-string: 0.30.10 + magic-string: 0.30.11 periscopic: 3.1.0 svg-tags@1.0.0: {} @@ -15926,9 +16066,9 @@ snapshots: vary@1.1.2: {} - vite-hot-client@0.2.3(vite@5.3.3(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1)): + vite-hot-client@0.2.3(vite@5.4.6(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1)): dependencies: - vite: 5.3.3(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1) + vite: 5.4.6(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1) vite-node@1.6.0(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1): dependencies: @@ -15936,12 +16076,13 @@ snapshots: debug: 4.3.5 pathe: 1.1.2 picocolors: 1.0.1 - vite: 5.3.3(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1) + vite: 5.4.6(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1) transitivePeerDependencies: - '@types/node' - less - lightningcss - sass + - sass-embedded - stylus - sugarss - supports-color @@ -15953,12 +16094,13 @@ snapshots: debug: 4.3.5 pathe: 1.1.2 picocolors: 1.0.1 - vite: 5.3.3(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1) + vite: 5.4.6(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1) transitivePeerDependencies: - '@types/node' - less - lightningcss - sass + - sass-embedded - stylus - sugarss - supports-color @@ -15970,21 +16112,22 @@ snapshots: debug: 4.3.5 pathe: 1.1.2 picocolors: 1.0.1 - vite: 5.3.3(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1) + vite: 5.4.6(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1) transitivePeerDependencies: - '@types/node' - less - lightningcss - sass + - sass-embedded - stylus - sugarss - supports-color - terser - vite-plugin-inspect@0.8.5(rollup@4.18.0)(vite@5.3.3(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1)): + vite-plugin-inspect@0.8.5(rollup@4.22.0)(vite@5.4.6(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1)): dependencies: '@antfu/utils': 0.7.10 - '@rollup/pluginutils': 5.1.0(rollup@4.18.0) + '@rollup/pluginutils': 5.1.0(rollup@4.22.0) debug: 4.3.5 error-stack-parser-es: 0.1.5 fs-extra: 11.2.0 @@ -15992,28 +16135,28 @@ snapshots: perfect-debounce: 1.0.0 picocolors: 1.0.1 sirv: 2.0.4 - vite: 5.3.3(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1) + vite: 5.4.6(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1) transitivePeerDependencies: - rollup - supports-color - vite-plugin-vue-devtools@7.3.1(rollup@4.18.0)(vite@5.3.3(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1))(vue@3.5.5(typescript@5.5.3)): + vite-plugin-vue-devtools@7.3.1(rollup@4.22.0)(vite@5.4.6(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1))(vue@3.5.5(typescript@5.5.3)): dependencies: - '@vue/devtools-core': 7.3.7(vite@5.3.3(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1))(vue@3.5.5(typescript@5.5.3)) + '@vue/devtools-core': 7.3.7(vite@5.4.6(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1))(vue@3.5.5(typescript@5.5.3)) '@vue/devtools-kit': 7.3.7 '@vue/devtools-shared': 7.3.7 execa: 8.0.1 sirv: 2.0.4 - vite: 5.3.3(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1) - vite-plugin-inspect: 0.8.5(rollup@4.18.0)(vite@5.3.3(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1)) - vite-plugin-vue-inspector: 5.1.3(vite@5.3.3(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1)) + vite: 5.4.6(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1) + vite-plugin-inspect: 0.8.5(rollup@4.22.0)(vite@5.4.6(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1)) + vite-plugin-vue-inspector: 5.1.3(vite@5.4.6(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1)) transitivePeerDependencies: - '@nuxt/kit' - rollup - supports-color - vue - vite-plugin-vue-inspector@5.1.3(vite@5.3.3(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1)): + vite-plugin-vue-inspector@5.1.3(vite@5.4.6(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1)): dependencies: '@babel/core': 7.24.7 '@babel/plugin-proposal-decorators': 7.24.7(@babel/core@7.24.7) @@ -16023,23 +16166,11 @@ snapshots: '@vue/babel-plugin-jsx': 1.2.2(@babel/core@7.24.7) '@vue/compiler-dom': 3.5.3 kolorist: 1.8.0 - magic-string: 0.30.10 - vite: 5.3.3(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1) + magic-string: 0.30.11 + vite: 5.4.6(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1) transitivePeerDependencies: - supports-color - vite@5.0.3(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1): - dependencies: - esbuild: 0.19.12 - postcss: 8.4.39 - rollup: 4.18.0 - optionalDependencies: - '@types/node': 20.14.10 - fsevents: 2.3.3 - less: 4.2.0 - sass: 1.71.1 - terser: 5.31.1 - vite@5.1.7(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.29.1): dependencies: esbuild: 0.19.12 @@ -16052,11 +16183,11 @@ snapshots: sass: 1.71.1 terser: 5.29.1 - vite@5.3.3(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1): + vite@5.4.6(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1): dependencies: esbuild: 0.21.5 - postcss: 8.4.39 - rollup: 4.18.0 + postcss: 8.4.45 + rollup: 4.22.0 optionalDependencies: '@types/node': 20.14.10 fsevents: 2.3.3 @@ -16064,11 +16195,11 @@ snapshots: sass: 1.71.1 terser: 5.31.1 - vite@5.3.3(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1): + vite@5.4.6(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1): dependencies: esbuild: 0.21.5 - postcss: 8.4.39 - rollup: 4.18.0 + postcss: 8.4.45 + rollup: 4.22.0 optionalDependencies: '@types/node': 20.14.5 fsevents: 2.3.3 @@ -16076,9 +16207,9 @@ snapshots: sass: 1.71.1 terser: 5.31.1 - vitefu@0.2.5(vite@5.0.3(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1)): + vitefu@0.2.5(vite@5.4.6(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1)): optionalDependencies: - vite: 5.0.3(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1) + vite: 5.4.6(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1) vitepress@1.3.0(@algolia/client-search@4.23.3)(@types/node@20.14.10)(@types/react@18.3.3)(axios@1.7.7)(less@4.2.0)(postcss@8.4.45)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.71.1)(search-insights@2.14.0)(terser@5.31.1)(typescript@5.5.3): dependencies: @@ -16087,7 +16218,7 @@ snapshots: '@shikijs/core': 1.10.3 '@shikijs/transformers': 1.10.3 '@types/markdown-it': 14.1.1 - '@vitejs/plugin-vue': 5.0.5(vite@5.3.3(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1))(vue@3.5.3(typescript@5.5.3)) + '@vitejs/plugin-vue': 5.0.5(vite@5.4.6(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1))(vue@3.5.3(typescript@5.5.3)) '@vue/devtools-api': 7.3.5 '@vue/shared': 3.4.31 '@vueuse/core': 10.11.0(vue@3.5.3(typescript@5.5.3)) @@ -16096,7 +16227,7 @@ snapshots: mark.js: 8.11.1 minisearch: 6.3.0 shiki: 1.10.3 - vite: 5.3.3(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1) + vite: 5.4.6(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1) vue: 3.5.3(typescript@5.5.3) optionalDependencies: postcss: 8.4.45 @@ -16119,6 +16250,7 @@ snapshots: - react - react-dom - sass + - sass-embedded - search-insights - sortablejs - stylus @@ -16146,7 +16278,7 @@ snapshots: strip-literal: 2.1.0 tinybench: 2.8.0 tinypool: 0.8.4 - vite: 5.3.3(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1) + vite: 5.4.6(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1) vite-node: 1.6.0(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1) why-is-node-running: 2.2.2 optionalDependencies: @@ -16156,6 +16288,7 @@ snapshots: - less - lightningcss - sass + - sass-embedded - stylus - sugarss - supports-color @@ -16180,7 +16313,7 @@ snapshots: strip-literal: 2.1.0 tinybench: 2.8.0 tinypool: 0.8.4 - vite: 5.3.3(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1) + vite: 5.4.6(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1) vite-node: 1.6.0(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1) why-is-node-running: 2.2.2 optionalDependencies: @@ -16190,6 +16323,7 @@ snapshots: - less - lightningcss - sass + - sass-embedded - stylus - sugarss - supports-color @@ -16212,7 +16346,7 @@ snapshots: std-env: 3.7.0 tinybench: 2.8.0 tinypool: 1.0.0 - vite: 5.3.3(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1) + vite: 5.4.6(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1) vite-node: 2.0.0(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1) why-is-node-running: 2.3.0 optionalDependencies: @@ -16222,6 +16356,7 @@ snapshots: - less - lightningcss - sass + - sass-embedded - stylus - sugarss - supports-color @@ -16342,7 +16477,7 @@ snapshots: compression: 1.7.4 connect-history-api-fallback: 2.0.0 default-gateway: 6.0.3 - express: 4.19.2 + express: 4.21.0 graceful-fs: 4.2.11 html-entities: 2.5.2 http-proxy-middleware: 2.0.6(@types/express@4.17.21) -- 2.51.2 From 2079c6e83a6b71e157c8e7ea56260b4e9ff8411d Mon Sep 17 00:00:00 2001 From: Lubos Date: Thu, 19 Sep 2024 08:37:35 +0100 Subject: [PATCH 18/49] fix: encode path params --- .changeset/good-clouds-guess.md | 6 ++++++ packages/client-axios/src/utils.ts | 4 ++-- packages/client-fetch/src/utils.ts | 4 ++-- .../v3-hey-api-client-axios-bundle/core/utils.ts.snap | 4 ++-- .../core/utils.ts.snap | 4 ++-- .../v3-hey-api-client-fetch-bundle/core/utils.ts.snap | 4 ++-- .../core/utils.ts.snap | 4 ++-- 7 files changed, 18 insertions(+), 12 deletions(-) create mode 100644 .changeset/good-clouds-guess.md diff --git a/.changeset/good-clouds-guess.md b/.changeset/good-clouds-guess.md new file mode 100644 index 000000000..7818ab2ed --- /dev/null +++ b/.changeset/good-clouds-guess.md @@ -0,0 +1,6 @@ +--- +'@hey-api/client-axios': patch +'@hey-api/client-fetch': patch +--- + +fix: encode path params diff --git a/packages/client-axios/src/utils.ts b/packages/client-axios/src/utils.ts index f55d247d6..2d3e8a8ee 100644 --- a/packages/client-axios/src/utils.ts +++ b/packages/client-axios/src/utils.ts @@ -241,10 +241,10 @@ const defaultPathSerializer = ({ path, url: _url }: PathSerializer) => { continue; } - url = url.replace( - match, + const replaceValue = encodeURIComponent( style === 'label' ? `.${value as string}` : (value as string), ); + url = url.replace(match, replaceValue); } } return url; diff --git a/packages/client-fetch/src/utils.ts b/packages/client-fetch/src/utils.ts index 3fbc16855..2bcc2e5e5 100644 --- a/packages/client-fetch/src/utils.ts +++ b/packages/client-fetch/src/utils.ts @@ -253,10 +253,10 @@ const defaultPathSerializer = ({ path, url: _url }: PathSerializer) => { continue; } - url = url.replace( - match, + const replaceValue = encodeURIComponent( style === 'label' ? `.${value as string}` : (value as string), ); + url = url.replace(match, replaceValue); } } return url; diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle/core/utils.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle/core/utils.ts.snap index f55d247d6..2d3e8a8ee 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle/core/utils.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle/core/utils.ts.snap @@ -241,10 +241,10 @@ const defaultPathSerializer = ({ path, url: _url }: PathSerializer) => { continue; } - url = url.replace( - match, + const replaceValue = encodeURIComponent( style === 'label' ? `.${value as string}` : (value as string), ); + url = url.replace(match, replaceValue); } } return url; diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle_transform/core/utils.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle_transform/core/utils.ts.snap index f55d247d6..2d3e8a8ee 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle_transform/core/utils.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle_transform/core/utils.ts.snap @@ -241,10 +241,10 @@ const defaultPathSerializer = ({ path, url: _url }: PathSerializer) => { continue; } - url = url.replace( - match, + const replaceValue = encodeURIComponent( style === 'label' ? `.${value as string}` : (value as string), ); + url = url.replace(match, replaceValue); } } return url; diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle/core/utils.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle/core/utils.ts.snap index 3fbc16855..2bcc2e5e5 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle/core/utils.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle/core/utils.ts.snap @@ -253,10 +253,10 @@ const defaultPathSerializer = ({ path, url: _url }: PathSerializer) => { continue; } - url = url.replace( - match, + const replaceValue = encodeURIComponent( style === 'label' ? `.${value as string}` : (value as string), ); + url = url.replace(match, replaceValue); } } return url; diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle_transform/core/utils.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle_transform/core/utils.ts.snap index 3fbc16855..2bcc2e5e5 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle_transform/core/utils.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle_transform/core/utils.ts.snap @@ -253,10 +253,10 @@ const defaultPathSerializer = ({ path, url: _url }: PathSerializer) => { continue; } - url = url.replace( - match, + const replaceValue = encodeURIComponent( style === 'label' ? `.${value as string}` : (value as string), ); + url = url.replace(match, replaceValue); } } return url; -- 2.51.2 From a756987ad396fd7e68cc5eff63f6615bffef3782 Mon Sep 17 00:00:00 2001 From: Lubos Date: Thu, 19 Sep 2024 09:10:35 +0100 Subject: [PATCH 19/49] fix: allow overriding generated headers from options --- .changeset/empty-cats-impress.md | 5 +++ packages/openapi-ts/src/compiler/types.ts | 40 +++++++++---------- packages/openapi-ts/src/generate/services.ts | 26 ++++++++---- .../test/generated/v2/types.gen.ts.snap | 2 +- .../services.gen.ts.snap | 12 ++++-- .../types.gen.ts.snap | 6 +-- .../services.gen.ts.snap | 12 ++++-- .../types.gen.ts.snap | 6 +-- .../services.gen.ts.snap | 12 ++++-- .../types.gen.ts.snap | 6 +-- .../services.gen.ts.snap | 12 ++++-- .../types.gen.ts.snap | 6 +-- .../services.gen.ts.snap | 12 ++++-- .../types.gen.ts.snap | 6 +-- .../services.gen.ts.snap | 12 ++++-- .../types.gen.ts.snap | 6 +-- .../services.gen.ts.snap | 12 ++++-- .../v3-hey-api-client-axios/types.gen.ts.snap | 6 +-- .../services.gen.ts.snap | 12 ++++-- .../types.gen.ts.snap | 6 +-- .../services.gen.ts.snap | 12 ++++-- .../types.gen.ts.snap | 6 +-- .../services.gen.ts.snap | 12 ++++-- .../types.gen.ts.snap | 6 +-- .../services.gen.ts.snap | 12 ++++-- .../types.gen.ts.snap | 6 +-- .../services.gen.ts.snap | 12 ++++-- .../types.gen.ts.snap | 6 +-- .../services.gen.ts.snap | 12 ++++-- .../types.gen.ts.snap | 6 +-- .../services.gen.ts.snap | 12 ++++-- .../v3-hey-api-client-fetch/types.gen.ts.snap | 6 +-- .../test/generated/v3/types.gen.ts.snap | 6 +-- .../test/generated/v3_axios/types.gen.ts.snap | 6 +-- .../test/generated/v3_node/types.gen.ts.snap | 6 +-- .../v3_services_filter/types.gen.ts.snap | 6 +-- .../v3_services_name/types.gen.ts.snap | 6 +-- .../v3_tree_shakeable/types.gen.ts.snap | 6 +-- .../test/generated/v3_xhr/types.gen.ts.snap | 6 +-- packages/openapi-ts/test/sample.cjs | 2 +- 40 files changed, 221 insertions(+), 148 deletions(-) create mode 100644 .changeset/empty-cats-impress.md diff --git a/.changeset/empty-cats-impress.md b/.changeset/empty-cats-impress.md new file mode 100644 index 000000000..fe02e5045 --- /dev/null +++ b/.changeset/empty-cats-impress.md @@ -0,0 +1,5 @@ +--- +'@hey-api/openapi-ts': patch +--- + +fix: allow overriding generated headers from options diff --git a/packages/openapi-ts/src/compiler/types.ts b/packages/openapi-ts/src/compiler/types.ts index ee23ec730..9f5156ec7 100644 --- a/packages/openapi-ts/src/compiler/types.ts +++ b/packages/openapi-ts/src/compiler/types.ts @@ -418,22 +418,15 @@ export const createObjectType = < // Check key value equality before possibly modifying it let canShorthand = false; if ('key' in value) { - let { key } = value; + const { key } = value; canShorthand = key === value.value; if ( - key.match(/^[0-9]/) && - key.match(/\D+/g) && + ((key.match(/^[0-9]/) && key.match(/\D+/g)) || + key.match(/\W/g)) && !key.startsWith("'") && !key.endsWith("'") ) { - key = `'${key}'`; - } - if ( - key.match(/\W/g) && - !key.startsWith("'") && - !key.endsWith("'") - ) { - key = `'${key}'`; + value.key = `'${key}'`; } } let assignment: ObjectAssignment; @@ -456,15 +449,22 @@ export const createObjectType = < } else { let initializer: ts.Expression | undefined = isTsNode(value.value) ? value.value - : toExpression({ - identifiers: identifiers.includes(value.key) - ? Object.keys(value.value) - : [], - isValueAccess: value.isValueAccess, - shorthand, - unescape, - value: value.value, - }); + : Array.isArray(value.value) + ? createObjectType({ + multiLine, + obj: value.value, + shorthand, + unescape, + }) + : toExpression({ + identifiers: identifiers.includes(value.key) + ? Object.keys(value.value) + : [], + isValueAccess: value.isValueAccess, + shorthand, + unescape, + value: value.value, + }); if (!initializer) { return undefined; } diff --git a/packages/openapi-ts/src/generate/services.ts b/packages/openapi-ts/src/generate/services.ts index e97a5f15a..bc5065a17 100644 --- a/packages/openapi-ts/src/generate/services.ts +++ b/packages/openapi-ts/src/generate/services.ts @@ -296,10 +296,16 @@ const toRequestOptions = ( }, { key: 'headers', - value: { - // no need for Content-Type header, browser will set it automatically - 'Content-Type': null, - }, + value: [ + { + // no need for Content-Type header, browser will set it automatically + key: 'Content-Type', + value: null, + }, + { + spread: 'options?.headers', + }, + ], }, ]; onClientImport?.('formDataBodySerializer'); @@ -313,9 +319,15 @@ const toRequestOptions = ( }, { key: 'headers', - value: { - 'Content-Type': contents[0], - }, + value: [ + { + key: 'Content-Type', + value: contents[0], + }, + { + spread: 'options?.headers', + }, + ], }, ]; onClientImport?.('urlSearchParamsBodySerializer'); diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v2/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v2/types.gen.ts.snap index 8b99f174d..c1c495597 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v2/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v2/types.gen.ts.snap @@ -87,7 +87,7 @@ export const EnumWithStrings = { ERROR: 'Error', _SINGLE_QUOTE_: "'Single Quote'", _DOUBLE_QUOTES_: '"Double Quotes"', - NON_ASCII__ØÆÅÔÖ_ØÆÅÔÖ字符串: 'Non-ascii: øæåôöØÆÅÔÖ字符串' + 'NON_ASCII__ØÆÅÔÖ_ØÆÅÔÖ字符串': 'Non-ascii: øæåôöØÆÅÔÖ字符串' } as const; /** diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle/services.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle/services.gen.ts.snap index a5bcc8f61..1f6e20391 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle/services.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle/services.gen.ts.snap @@ -107,7 +107,8 @@ export const postApiVbyApiVersionFormData = (options: Option ...options, ...urlSearchParamsBodySerializer, headers: { - 'Content-Type': 'application/x-www-form-urlencoded' + 'Content-Type': 'application/x-www-form-urlencoded', + ...options?.headers }, url: '/api/v{api-version}/upload' }); }; @@ -215,7 +217,8 @@ export const multipartRequest = (options?: ...options, ...formDataBodySerializer, headers: { - 'Content-Type': null + 'Content-Type': null, + ...options?.headers }, url: '/api/v{api-version}/multipart' }); }; @@ -252,7 +255,8 @@ export const putWithFormUrlEncoded = (opti ...options, ...urlSearchParamsBodySerializer, headers: { - 'Content-Type': 'application/x-www-form-urlencoded' + 'Content-Type': 'application/x-www-form-urlencoded', + ...options?.headers }, url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串' }); }; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle/types.gen.ts.snap index a854a09d1..751050669 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle/types.gen.ts.snap @@ -100,7 +100,7 @@ export const EnumWithStrings = { ERROR: 'Error', _SINGLE_QUOTE_: "'Single Quote'", _DOUBLE_QUOTES_: '"Double Quotes"', - NON_ASCII__ØÆÅÔÖ_ØÆÅÔÖ字符串: 'Non-ascii: øæåôöØÆÅÔÖ字符串' + 'NON_ASCII__ØÆÅÔÖ_ØÆÅÔÖ字符串': 'Non-ascii: øæåôöØÆÅÔÖ字符串' } as const; export type EnumWithReplacedCharacters = "'Single Quote'" | '"Double Quotes"' | 'øæåôöØÆÅÔÖ字符串' | 3.1 | ''; @@ -108,7 +108,7 @@ export type EnumWithReplacedCharacters = "'Single Quote'" | '"Double Quotes"' | export const EnumWithReplacedCharacters = { _SINGLE_QUOTE_: "'Single Quote'", _DOUBLE_QUOTES_: '"Double Quotes"', - ØÆÅÔÖ_ØÆÅÔÖ字符串: 'øæåôöØÆÅÔÖ字符串', + 'ØÆÅÔÖ_ØÆÅÔÖ字符串': 'øæåôöØÆÅÔÖ字符串', '_3.1': 3.1, EMPTY_STRING: '' } as const; @@ -361,7 +361,7 @@ export const foo_bar_enum = { SUCCESS: 'Success', WARNING: 'Warning', ERROR: 'Error', - ØÆÅ字符串: 'ØÆÅ字符串' + 'ØÆÅ字符串': 'ØÆÅ字符串' } as const; /** diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-class/services.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-class/services.gen.ts.snap index 2b446f161..e157d6b3d 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-class/services.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-class/services.gen.ts.snap @@ -165,7 +165,8 @@ export class FormDataService { ...options, ...formDataBodySerializer, headers: { - 'Content-Type': null + 'Content-Type': null, + ...options?.headers }, url: '/api/v{api-version}/formData/' }); @@ -346,7 +347,8 @@ export class UploadService { ...options, ...urlSearchParamsBodySerializer, headers: { - 'Content-Type': 'application/x-www-form-urlencoded' + 'Content-Type': 'application/x-www-form-urlencoded', + ...options?.headers }, url: '/api/v{api-version}/upload' }); @@ -387,7 +389,8 @@ export class MultipartService { ...options, ...formDataBodySerializer, headers: { - 'Content-Type': null + 'Content-Type': null, + ...options?.headers }, url: '/api/v{api-version}/multipart' }); @@ -438,7 +441,8 @@ export class NonAsciiÆøåÆøÅöôêÊService { ...options, ...urlSearchParamsBodySerializer, headers: { - 'Content-Type': 'application/x-www-form-urlencoded' + 'Content-Type': 'application/x-www-form-urlencoded', + ...options?.headers }, url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串' }); diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-class/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-class/types.gen.ts.snap index 93de0e1be..212fea1e3 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-class/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-class/types.gen.ts.snap @@ -100,7 +100,7 @@ export const EnumWithStrings = { ERROR: 'Error', _SINGLE_QUOTE_: "'Single Quote'", _DOUBLE_QUOTES_: '"Double Quotes"', - NON_ASCII__ØÆÅÔÖ_ØÆÅÔÖ字符串: 'Non-ascii: øæåôöØÆÅÔÖ字符串' + 'NON_ASCII__ØÆÅÔÖ_ØÆÅÔÖ字符串': 'Non-ascii: øæåôöØÆÅÔÖ字符串' } as const; export type EnumWithReplacedCharacters = "'Single Quote'" | '"Double Quotes"' | 'øæåôöØÆÅÔÖ字符串' | 3.1 | ''; @@ -108,7 +108,7 @@ export type EnumWithReplacedCharacters = "'Single Quote'" | '"Double Quotes"' | export const EnumWithReplacedCharacters = { _SINGLE_QUOTE_: "'Single Quote'", _DOUBLE_QUOTES_: '"Double Quotes"', - ØÆÅÔÖ_ØÆÅÔÖ字符串: 'øæåôöØÆÅÔÖ字符串', + 'ØÆÅÔÖ_ØÆÅÔÖ字符串': 'øæåôöØÆÅÔÖ字符串', '_3.1': 3.1, EMPTY_STRING: '' } as const; @@ -361,7 +361,7 @@ export const foo_bar_enum = { SUCCESS: 'Success', WARNING: 'Warning', ERROR: 'Error', - ØÆÅ字符串: 'ØÆÅ字符串' + 'ØÆÅ字符串': 'ØÆÅ字符串' } as const; /** diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-react-query/services.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-react-query/services.gen.ts.snap index a9d7b030a..db10bc325 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-react-query/services.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-react-query/services.gen.ts.snap @@ -107,7 +107,8 @@ export const postApiVbyApiVersionFormData = (options: Option ...options, ...urlSearchParamsBodySerializer, headers: { - 'Content-Type': 'application/x-www-form-urlencoded' + 'Content-Type': 'application/x-www-form-urlencoded', + ...options?.headers }, url: '/api/v{api-version}/upload' }); }; @@ -215,7 +217,8 @@ export const multipartRequest = (options?: ...options, ...formDataBodySerializer, headers: { - 'Content-Type': null + 'Content-Type': null, + ...options?.headers }, url: '/api/v{api-version}/multipart' }); }; @@ -252,7 +255,8 @@ export const putWithFormUrlEncoded = (opti ...options, ...urlSearchParamsBodySerializer, headers: { - 'Content-Type': 'application/x-www-form-urlencoded' + 'Content-Type': 'application/x-www-form-urlencoded', + ...options?.headers }, url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串' }); }; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-react-query/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-react-query/types.gen.ts.snap index a854a09d1..751050669 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-react-query/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-react-query/types.gen.ts.snap @@ -100,7 +100,7 @@ export const EnumWithStrings = { ERROR: 'Error', _SINGLE_QUOTE_: "'Single Quote'", _DOUBLE_QUOTES_: '"Double Quotes"', - NON_ASCII__ØÆÅÔÖ_ØÆÅÔÖ字符串: 'Non-ascii: øæåôöØÆÅÔÖ字符串' + 'NON_ASCII__ØÆÅÔÖ_ØÆÅÔÖ字符串': 'Non-ascii: øæåôöØÆÅÔÖ字符串' } as const; export type EnumWithReplacedCharacters = "'Single Quote'" | '"Double Quotes"' | 'øæåôöØÆÅÔÖ字符串' | 3.1 | ''; @@ -108,7 +108,7 @@ export type EnumWithReplacedCharacters = "'Single Quote'" | '"Double Quotes"' | export const EnumWithReplacedCharacters = { _SINGLE_QUOTE_: "'Single Quote'", _DOUBLE_QUOTES_: '"Double Quotes"', - ØÆÅÔÖ_ØÆÅÔÖ字符串: 'øæåôöØÆÅÔÖ字符串', + 'ØÆÅÔÖ_ØÆÅÔÖ字符串': 'øæåôöØÆÅÔÖ字符串', '_3.1': 3.1, EMPTY_STRING: '' } as const; @@ -361,7 +361,7 @@ export const foo_bar_enum = { SUCCESS: 'Success', WARNING: 'Warning', ERROR: 'Error', - ØÆÅ字符串: 'ØÆÅ字符串' + 'ØÆÅ字符串': 'ØÆÅ字符串' } as const; /** diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-solid-query/services.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-solid-query/services.gen.ts.snap index a9d7b030a..db10bc325 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-solid-query/services.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-solid-query/services.gen.ts.snap @@ -107,7 +107,8 @@ export const postApiVbyApiVersionFormData = (options: Option ...options, ...urlSearchParamsBodySerializer, headers: { - 'Content-Type': 'application/x-www-form-urlencoded' + 'Content-Type': 'application/x-www-form-urlencoded', + ...options?.headers }, url: '/api/v{api-version}/upload' }); }; @@ -215,7 +217,8 @@ export const multipartRequest = (options?: ...options, ...formDataBodySerializer, headers: { - 'Content-Type': null + 'Content-Type': null, + ...options?.headers }, url: '/api/v{api-version}/multipart' }); }; @@ -252,7 +255,8 @@ export const putWithFormUrlEncoded = (opti ...options, ...urlSearchParamsBodySerializer, headers: { - 'Content-Type': 'application/x-www-form-urlencoded' + 'Content-Type': 'application/x-www-form-urlencoded', + ...options?.headers }, url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串' }); }; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-solid-query/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-solid-query/types.gen.ts.snap index a854a09d1..751050669 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-solid-query/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-solid-query/types.gen.ts.snap @@ -100,7 +100,7 @@ export const EnumWithStrings = { ERROR: 'Error', _SINGLE_QUOTE_: "'Single Quote'", _DOUBLE_QUOTES_: '"Double Quotes"', - NON_ASCII__ØÆÅÔÖ_ØÆÅÔÖ字符串: 'Non-ascii: øæåôöØÆÅÔÖ字符串' + 'NON_ASCII__ØÆÅÔÖ_ØÆÅÔÖ字符串': 'Non-ascii: øæåôöØÆÅÔÖ字符串' } as const; export type EnumWithReplacedCharacters = "'Single Quote'" | '"Double Quotes"' | 'øæåôöØÆÅÔÖ字符串' | 3.1 | ''; @@ -108,7 +108,7 @@ export type EnumWithReplacedCharacters = "'Single Quote'" | '"Double Quotes"' | export const EnumWithReplacedCharacters = { _SINGLE_QUOTE_: "'Single Quote'", _DOUBLE_QUOTES_: '"Double Quotes"', - ØÆÅÔÖ_ØÆÅÔÖ字符串: 'øæåôöØÆÅÔÖ字符串', + 'ØÆÅÔÖ_ØÆÅÔÖ字符串': 'øæåôöØÆÅÔÖ字符串', '_3.1': 3.1, EMPTY_STRING: '' } as const; @@ -361,7 +361,7 @@ export const foo_bar_enum = { SUCCESS: 'Success', WARNING: 'Warning', ERROR: 'Error', - ØÆÅ字符串: 'ØÆÅ字符串' + 'ØÆÅ字符串': 'ØÆÅ字符串' } as const; /** diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-svelte-query/services.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-svelte-query/services.gen.ts.snap index a9d7b030a..db10bc325 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-svelte-query/services.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-svelte-query/services.gen.ts.snap @@ -107,7 +107,8 @@ export const postApiVbyApiVersionFormData = (options: Option ...options, ...urlSearchParamsBodySerializer, headers: { - 'Content-Type': 'application/x-www-form-urlencoded' + 'Content-Type': 'application/x-www-form-urlencoded', + ...options?.headers }, url: '/api/v{api-version}/upload' }); }; @@ -215,7 +217,8 @@ export const multipartRequest = (options?: ...options, ...formDataBodySerializer, headers: { - 'Content-Type': null + 'Content-Type': null, + ...options?.headers }, url: '/api/v{api-version}/multipart' }); }; @@ -252,7 +255,8 @@ export const putWithFormUrlEncoded = (opti ...options, ...urlSearchParamsBodySerializer, headers: { - 'Content-Type': 'application/x-www-form-urlencoded' + 'Content-Type': 'application/x-www-form-urlencoded', + ...options?.headers }, url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串' }); }; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-svelte-query/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-svelte-query/types.gen.ts.snap index a854a09d1..751050669 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-svelte-query/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-svelte-query/types.gen.ts.snap @@ -100,7 +100,7 @@ export const EnumWithStrings = { ERROR: 'Error', _SINGLE_QUOTE_: "'Single Quote'", _DOUBLE_QUOTES_: '"Double Quotes"', - NON_ASCII__ØÆÅÔÖ_ØÆÅÔÖ字符串: 'Non-ascii: øæåôöØÆÅÔÖ字符串' + 'NON_ASCII__ØÆÅÔÖ_ØÆÅÔÖ字符串': 'Non-ascii: øæåôöØÆÅÔÖ字符串' } as const; export type EnumWithReplacedCharacters = "'Single Quote'" | '"Double Quotes"' | 'øæåôöØÆÅÔÖ字符串' | 3.1 | ''; @@ -108,7 +108,7 @@ export type EnumWithReplacedCharacters = "'Single Quote'" | '"Double Quotes"' | export const EnumWithReplacedCharacters = { _SINGLE_QUOTE_: "'Single Quote'", _DOUBLE_QUOTES_: '"Double Quotes"', - ØÆÅÔÖ_ØÆÅÔÖ字符串: 'øæåôöØÆÅÔÖ字符串', + 'ØÆÅÔÖ_ØÆÅÔÖ字符串': 'øæåôöØÆÅÔÖ字符串', '_3.1': 3.1, EMPTY_STRING: '' } as const; @@ -361,7 +361,7 @@ export const foo_bar_enum = { SUCCESS: 'Success', WARNING: 'Warning', ERROR: 'Error', - ØÆÅ字符串: 'ØÆÅ字符串' + 'ØÆÅ字符串': 'ØÆÅ字符串' } as const; /** diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-vue-query/services.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-vue-query/services.gen.ts.snap index a9d7b030a..db10bc325 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-vue-query/services.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-vue-query/services.gen.ts.snap @@ -107,7 +107,8 @@ export const postApiVbyApiVersionFormData = (options: Option ...options, ...urlSearchParamsBodySerializer, headers: { - 'Content-Type': 'application/x-www-form-urlencoded' + 'Content-Type': 'application/x-www-form-urlencoded', + ...options?.headers }, url: '/api/v{api-version}/upload' }); }; @@ -215,7 +217,8 @@ export const multipartRequest = (options?: ...options, ...formDataBodySerializer, headers: { - 'Content-Type': null + 'Content-Type': null, + ...options?.headers }, url: '/api/v{api-version}/multipart' }); }; @@ -252,7 +255,8 @@ export const putWithFormUrlEncoded = (opti ...options, ...urlSearchParamsBodySerializer, headers: { - 'Content-Type': 'application/x-www-form-urlencoded' + 'Content-Type': 'application/x-www-form-urlencoded', + ...options?.headers }, url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串' }); }; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-vue-query/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-vue-query/types.gen.ts.snap index a854a09d1..751050669 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-vue-query/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-vue-query/types.gen.ts.snap @@ -100,7 +100,7 @@ export const EnumWithStrings = { ERROR: 'Error', _SINGLE_QUOTE_: "'Single Quote'", _DOUBLE_QUOTES_: '"Double Quotes"', - NON_ASCII__ØÆÅÔÖ_ØÆÅÔÖ字符串: 'Non-ascii: øæåôöØÆÅÔÖ字符串' + 'NON_ASCII__ØÆÅÔÖ_ØÆÅÔÖ字符串': 'Non-ascii: øæåôöØÆÅÔÖ字符串' } as const; export type EnumWithReplacedCharacters = "'Single Quote'" | '"Double Quotes"' | 'øæåôöØÆÅÔÖ字符串' | 3.1 | ''; @@ -108,7 +108,7 @@ export type EnumWithReplacedCharacters = "'Single Quote'" | '"Double Quotes"' | export const EnumWithReplacedCharacters = { _SINGLE_QUOTE_: "'Single Quote'", _DOUBLE_QUOTES_: '"Double Quotes"', - ØÆÅÔÖ_ØÆÅÔÖ字符串: 'øæåôöØÆÅÔÖ字符串', + 'ØÆÅÔÖ_ØÆÅÔÖ字符串': 'øæåôöØÆÅÔÖ字符串', '_3.1': 3.1, EMPTY_STRING: '' } as const; @@ -361,7 +361,7 @@ export const foo_bar_enum = { SUCCESS: 'Success', WARNING: 'Warning', ERROR: 'Error', - ØÆÅ字符串: 'ØÆÅ字符串' + 'ØÆÅ字符串': 'ØÆÅ字符串' } as const; /** diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios/services.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios/services.gen.ts.snap index a9d7b030a..db10bc325 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios/services.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios/services.gen.ts.snap @@ -107,7 +107,8 @@ export const postApiVbyApiVersionFormData = (options: Option ...options, ...urlSearchParamsBodySerializer, headers: { - 'Content-Type': 'application/x-www-form-urlencoded' + 'Content-Type': 'application/x-www-form-urlencoded', + ...options?.headers }, url: '/api/v{api-version}/upload' }); }; @@ -215,7 +217,8 @@ export const multipartRequest = (options?: ...options, ...formDataBodySerializer, headers: { - 'Content-Type': null + 'Content-Type': null, + ...options?.headers }, url: '/api/v{api-version}/multipart' }); }; @@ -252,7 +255,8 @@ export const putWithFormUrlEncoded = (opti ...options, ...urlSearchParamsBodySerializer, headers: { - 'Content-Type': 'application/x-www-form-urlencoded' + 'Content-Type': 'application/x-www-form-urlencoded', + ...options?.headers }, url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串' }); }; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios/types.gen.ts.snap index a854a09d1..751050669 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios/types.gen.ts.snap @@ -100,7 +100,7 @@ export const EnumWithStrings = { ERROR: 'Error', _SINGLE_QUOTE_: "'Single Quote'", _DOUBLE_QUOTES_: '"Double Quotes"', - NON_ASCII__ØÆÅÔÖ_ØÆÅÔÖ字符串: 'Non-ascii: øæåôöØÆÅÔÖ字符串' + 'NON_ASCII__ØÆÅÔÖ_ØÆÅÔÖ字符串': 'Non-ascii: øæåôöØÆÅÔÖ字符串' } as const; export type EnumWithReplacedCharacters = "'Single Quote'" | '"Double Quotes"' | 'øæåôöØÆÅÔÖ字符串' | 3.1 | ''; @@ -108,7 +108,7 @@ export type EnumWithReplacedCharacters = "'Single Quote'" | '"Double Quotes"' | export const EnumWithReplacedCharacters = { _SINGLE_QUOTE_: "'Single Quote'", _DOUBLE_QUOTES_: '"Double Quotes"', - ØÆÅÔÖ_ØÆÅÔÖ字符串: 'øæåôöØÆÅÔÖ字符串', + 'ØÆÅÔÖ_ØÆÅÔÖ字符串': 'øæåôöØÆÅÔÖ字符串', '_3.1': 3.1, EMPTY_STRING: '' } as const; @@ -361,7 +361,7 @@ export const foo_bar_enum = { SUCCESS: 'Success', WARNING: 'Warning', ERROR: 'Error', - ØÆÅ字符串: 'ØÆÅ字符串' + 'ØÆÅ字符串': 'ØÆÅ字符串' } as const; /** diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle/services.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle/services.gen.ts.snap index a5bcc8f61..1f6e20391 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle/services.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle/services.gen.ts.snap @@ -107,7 +107,8 @@ export const postApiVbyApiVersionFormData = (options: Option ...options, ...urlSearchParamsBodySerializer, headers: { - 'Content-Type': 'application/x-www-form-urlencoded' + 'Content-Type': 'application/x-www-form-urlencoded', + ...options?.headers }, url: '/api/v{api-version}/upload' }); }; @@ -215,7 +217,8 @@ export const multipartRequest = (options?: ...options, ...formDataBodySerializer, headers: { - 'Content-Type': null + 'Content-Type': null, + ...options?.headers }, url: '/api/v{api-version}/multipart' }); }; @@ -252,7 +255,8 @@ export const putWithFormUrlEncoded = (opti ...options, ...urlSearchParamsBodySerializer, headers: { - 'Content-Type': 'application/x-www-form-urlencoded' + 'Content-Type': 'application/x-www-form-urlencoded', + ...options?.headers }, url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串' }); }; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle/types.gen.ts.snap index a854a09d1..751050669 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle/types.gen.ts.snap @@ -100,7 +100,7 @@ export const EnumWithStrings = { ERROR: 'Error', _SINGLE_QUOTE_: "'Single Quote'", _DOUBLE_QUOTES_: '"Double Quotes"', - NON_ASCII__ØÆÅÔÖ_ØÆÅÔÖ字符串: 'Non-ascii: øæåôöØÆÅÔÖ字符串' + 'NON_ASCII__ØÆÅÔÖ_ØÆÅÔÖ字符串': 'Non-ascii: øæåôöØÆÅÔÖ字符串' } as const; export type EnumWithReplacedCharacters = "'Single Quote'" | '"Double Quotes"' | 'øæåôöØÆÅÔÖ字符串' | 3.1 | ''; @@ -108,7 +108,7 @@ export type EnumWithReplacedCharacters = "'Single Quote'" | '"Double Quotes"' | export const EnumWithReplacedCharacters = { _SINGLE_QUOTE_: "'Single Quote'", _DOUBLE_QUOTES_: '"Double Quotes"', - ØÆÅÔÖ_ØÆÅÔÖ字符串: 'øæåôöØÆÅÔÖ字符串', + 'ØÆÅÔÖ_ØÆÅÔÖ字符串': 'øæåôöØÆÅÔÖ字符串', '_3.1': 3.1, EMPTY_STRING: '' } as const; @@ -361,7 +361,7 @@ export const foo_bar_enum = { SUCCESS: 'Success', WARNING: 'Warning', ERROR: 'Error', - ØÆÅ字符串: 'ØÆÅ字符串' + 'ØÆÅ字符串': 'ØÆÅ字符串' } as const; /** diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-class/services.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-class/services.gen.ts.snap index 45f6402b0..2b3087c92 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-class/services.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-class/services.gen.ts.snap @@ -165,7 +165,8 @@ export class FormDataService { ...options, ...formDataBodySerializer, headers: { - 'Content-Type': null + 'Content-Type': null, + ...options?.headers }, url: '/api/v{api-version}/formData/' }); @@ -346,7 +347,8 @@ export class UploadService { ...options, ...urlSearchParamsBodySerializer, headers: { - 'Content-Type': 'application/x-www-form-urlencoded' + 'Content-Type': 'application/x-www-form-urlencoded', + ...options?.headers }, url: '/api/v{api-version}/upload' }); @@ -387,7 +389,8 @@ export class MultipartService { ...options, ...formDataBodySerializer, headers: { - 'Content-Type': null + 'Content-Type': null, + ...options?.headers }, url: '/api/v{api-version}/multipart' }); @@ -438,7 +441,8 @@ export class NonAsciiÆøåÆøÅöôêÊService { ...options, ...urlSearchParamsBodySerializer, headers: { - 'Content-Type': 'application/x-www-form-urlencoded' + 'Content-Type': 'application/x-www-form-urlencoded', + ...options?.headers }, url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串' }); diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-class/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-class/types.gen.ts.snap index 93de0e1be..212fea1e3 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-class/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-class/types.gen.ts.snap @@ -100,7 +100,7 @@ export const EnumWithStrings = { ERROR: 'Error', _SINGLE_QUOTE_: "'Single Quote'", _DOUBLE_QUOTES_: '"Double Quotes"', - NON_ASCII__ØÆÅÔÖ_ØÆÅÔÖ字符串: 'Non-ascii: øæåôöØÆÅÔÖ字符串' + 'NON_ASCII__ØÆÅÔÖ_ØÆÅÔÖ字符串': 'Non-ascii: øæåôöØÆÅÔÖ字符串' } as const; export type EnumWithReplacedCharacters = "'Single Quote'" | '"Double Quotes"' | 'øæåôöØÆÅÔÖ字符串' | 3.1 | ''; @@ -108,7 +108,7 @@ export type EnumWithReplacedCharacters = "'Single Quote'" | '"Double Quotes"' | export const EnumWithReplacedCharacters = { _SINGLE_QUOTE_: "'Single Quote'", _DOUBLE_QUOTES_: '"Double Quotes"', - ØÆÅÔÖ_ØÆÅÔÖ字符串: 'øæåôöØÆÅÔÖ字符串', + 'ØÆÅÔÖ_ØÆÅÔÖ字符串': 'øæåôöØÆÅÔÖ字符串', '_3.1': 3.1, EMPTY_STRING: '' } as const; @@ -361,7 +361,7 @@ export const foo_bar_enum = { SUCCESS: 'Success', WARNING: 'Warning', ERROR: 'Error', - ØÆÅ字符串: 'ØÆÅ字符串' + 'ØÆÅ字符串': 'ØÆÅ字符串' } as const; /** diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-react-query/services.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-react-query/services.gen.ts.snap index 69c1d614d..b22ab5e38 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-react-query/services.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-react-query/services.gen.ts.snap @@ -107,7 +107,8 @@ export const postApiVbyApiVersionFormData = (options: Option ...options, ...urlSearchParamsBodySerializer, headers: { - 'Content-Type': 'application/x-www-form-urlencoded' + 'Content-Type': 'application/x-www-form-urlencoded', + ...options?.headers }, url: '/api/v{api-version}/upload' }); }; @@ -215,7 +217,8 @@ export const multipartRequest = (options?: ...options, ...formDataBodySerializer, headers: { - 'Content-Type': null + 'Content-Type': null, + ...options?.headers }, url: '/api/v{api-version}/multipart' }); }; @@ -252,7 +255,8 @@ export const putWithFormUrlEncoded = (opti ...options, ...urlSearchParamsBodySerializer, headers: { - 'Content-Type': 'application/x-www-form-urlencoded' + 'Content-Type': 'application/x-www-form-urlencoded', + ...options?.headers }, url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串' }); }; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-react-query/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-react-query/types.gen.ts.snap index a854a09d1..751050669 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-react-query/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-react-query/types.gen.ts.snap @@ -100,7 +100,7 @@ export const EnumWithStrings = { ERROR: 'Error', _SINGLE_QUOTE_: "'Single Quote'", _DOUBLE_QUOTES_: '"Double Quotes"', - NON_ASCII__ØÆÅÔÖ_ØÆÅÔÖ字符串: 'Non-ascii: øæåôöØÆÅÔÖ字符串' + 'NON_ASCII__ØÆÅÔÖ_ØÆÅÔÖ字符串': 'Non-ascii: øæåôöØÆÅÔÖ字符串' } as const; export type EnumWithReplacedCharacters = "'Single Quote'" | '"Double Quotes"' | 'øæåôöØÆÅÔÖ字符串' | 3.1 | ''; @@ -108,7 +108,7 @@ export type EnumWithReplacedCharacters = "'Single Quote'" | '"Double Quotes"' | export const EnumWithReplacedCharacters = { _SINGLE_QUOTE_: "'Single Quote'", _DOUBLE_QUOTES_: '"Double Quotes"', - ØÆÅÔÖ_ØÆÅÔÖ字符串: 'øæåôöØÆÅÔÖ字符串', + 'ØÆÅÔÖ_ØÆÅÔÖ字符串': 'øæåôöØÆÅÔÖ字符串', '_3.1': 3.1, EMPTY_STRING: '' } as const; @@ -361,7 +361,7 @@ export const foo_bar_enum = { SUCCESS: 'Success', WARNING: 'Warning', ERROR: 'Error', - ØÆÅ字符串: 'ØÆÅ字符串' + 'ØÆÅ字符串': 'ØÆÅ字符串' } as const; /** diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-solid-query/services.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-solid-query/services.gen.ts.snap index 69c1d614d..b22ab5e38 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-solid-query/services.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-solid-query/services.gen.ts.snap @@ -107,7 +107,8 @@ export const postApiVbyApiVersionFormData = (options: Option ...options, ...urlSearchParamsBodySerializer, headers: { - 'Content-Type': 'application/x-www-form-urlencoded' + 'Content-Type': 'application/x-www-form-urlencoded', + ...options?.headers }, url: '/api/v{api-version}/upload' }); }; @@ -215,7 +217,8 @@ export const multipartRequest = (options?: ...options, ...formDataBodySerializer, headers: { - 'Content-Type': null + 'Content-Type': null, + ...options?.headers }, url: '/api/v{api-version}/multipart' }); }; @@ -252,7 +255,8 @@ export const putWithFormUrlEncoded = (opti ...options, ...urlSearchParamsBodySerializer, headers: { - 'Content-Type': 'application/x-www-form-urlencoded' + 'Content-Type': 'application/x-www-form-urlencoded', + ...options?.headers }, url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串' }); }; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-solid-query/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-solid-query/types.gen.ts.snap index a854a09d1..751050669 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-solid-query/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-solid-query/types.gen.ts.snap @@ -100,7 +100,7 @@ export const EnumWithStrings = { ERROR: 'Error', _SINGLE_QUOTE_: "'Single Quote'", _DOUBLE_QUOTES_: '"Double Quotes"', - NON_ASCII__ØÆÅÔÖ_ØÆÅÔÖ字符串: 'Non-ascii: øæåôöØÆÅÔÖ字符串' + 'NON_ASCII__ØÆÅÔÖ_ØÆÅÔÖ字符串': 'Non-ascii: øæåôöØÆÅÔÖ字符串' } as const; export type EnumWithReplacedCharacters = "'Single Quote'" | '"Double Quotes"' | 'øæåôöØÆÅÔÖ字符串' | 3.1 | ''; @@ -108,7 +108,7 @@ export type EnumWithReplacedCharacters = "'Single Quote'" | '"Double Quotes"' | export const EnumWithReplacedCharacters = { _SINGLE_QUOTE_: "'Single Quote'", _DOUBLE_QUOTES_: '"Double Quotes"', - ØÆÅÔÖ_ØÆÅÔÖ字符串: 'øæåôöØÆÅÔÖ字符串', + 'ØÆÅÔÖ_ØÆÅÔÖ字符串': 'øæåôöØÆÅÔÖ字符串', '_3.1': 3.1, EMPTY_STRING: '' } as const; @@ -361,7 +361,7 @@ export const foo_bar_enum = { SUCCESS: 'Success', WARNING: 'Warning', ERROR: 'Error', - ØÆÅ字符串: 'ØÆÅ字符串' + 'ØÆÅ字符串': 'ØÆÅ字符串' } as const; /** diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-svelte-query/services.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-svelte-query/services.gen.ts.snap index 69c1d614d..b22ab5e38 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-svelte-query/services.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-svelte-query/services.gen.ts.snap @@ -107,7 +107,8 @@ export const postApiVbyApiVersionFormData = (options: Option ...options, ...urlSearchParamsBodySerializer, headers: { - 'Content-Type': 'application/x-www-form-urlencoded' + 'Content-Type': 'application/x-www-form-urlencoded', + ...options?.headers }, url: '/api/v{api-version}/upload' }); }; @@ -215,7 +217,8 @@ export const multipartRequest = (options?: ...options, ...formDataBodySerializer, headers: { - 'Content-Type': null + 'Content-Type': null, + ...options?.headers }, url: '/api/v{api-version}/multipart' }); }; @@ -252,7 +255,8 @@ export const putWithFormUrlEncoded = (opti ...options, ...urlSearchParamsBodySerializer, headers: { - 'Content-Type': 'application/x-www-form-urlencoded' + 'Content-Type': 'application/x-www-form-urlencoded', + ...options?.headers }, url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串' }); }; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-svelte-query/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-svelte-query/types.gen.ts.snap index a854a09d1..751050669 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-svelte-query/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-svelte-query/types.gen.ts.snap @@ -100,7 +100,7 @@ export const EnumWithStrings = { ERROR: 'Error', _SINGLE_QUOTE_: "'Single Quote'", _DOUBLE_QUOTES_: '"Double Quotes"', - NON_ASCII__ØÆÅÔÖ_ØÆÅÔÖ字符串: 'Non-ascii: øæåôöØÆÅÔÖ字符串' + 'NON_ASCII__ØÆÅÔÖ_ØÆÅÔÖ字符串': 'Non-ascii: øæåôöØÆÅÔÖ字符串' } as const; export type EnumWithReplacedCharacters = "'Single Quote'" | '"Double Quotes"' | 'øæåôöØÆÅÔÖ字符串' | 3.1 | ''; @@ -108,7 +108,7 @@ export type EnumWithReplacedCharacters = "'Single Quote'" | '"Double Quotes"' | export const EnumWithReplacedCharacters = { _SINGLE_QUOTE_: "'Single Quote'", _DOUBLE_QUOTES_: '"Double Quotes"', - ØÆÅÔÖ_ØÆÅÔÖ字符串: 'øæåôöØÆÅÔÖ字符串', + 'ØÆÅÔÖ_ØÆÅÔÖ字符串': 'øæåôöØÆÅÔÖ字符串', '_3.1': 3.1, EMPTY_STRING: '' } as const; @@ -361,7 +361,7 @@ export const foo_bar_enum = { SUCCESS: 'Success', WARNING: 'Warning', ERROR: 'Error', - ØÆÅ字符串: 'ØÆÅ字符串' + 'ØÆÅ字符串': 'ØÆÅ字符串' } as const; /** diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-vue-query/services.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-vue-query/services.gen.ts.snap index 69c1d614d..b22ab5e38 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-vue-query/services.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-vue-query/services.gen.ts.snap @@ -107,7 +107,8 @@ export const postApiVbyApiVersionFormData = (options: Option ...options, ...urlSearchParamsBodySerializer, headers: { - 'Content-Type': 'application/x-www-form-urlencoded' + 'Content-Type': 'application/x-www-form-urlencoded', + ...options?.headers }, url: '/api/v{api-version}/upload' }); }; @@ -215,7 +217,8 @@ export const multipartRequest = (options?: ...options, ...formDataBodySerializer, headers: { - 'Content-Type': null + 'Content-Type': null, + ...options?.headers }, url: '/api/v{api-version}/multipart' }); }; @@ -252,7 +255,8 @@ export const putWithFormUrlEncoded = (opti ...options, ...urlSearchParamsBodySerializer, headers: { - 'Content-Type': 'application/x-www-form-urlencoded' + 'Content-Type': 'application/x-www-form-urlencoded', + ...options?.headers }, url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串' }); }; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-vue-query/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-vue-query/types.gen.ts.snap index a854a09d1..751050669 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-vue-query/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-vue-query/types.gen.ts.snap @@ -100,7 +100,7 @@ export const EnumWithStrings = { ERROR: 'Error', _SINGLE_QUOTE_: "'Single Quote'", _DOUBLE_QUOTES_: '"Double Quotes"', - NON_ASCII__ØÆÅÔÖ_ØÆÅÔÖ字符串: 'Non-ascii: øæåôöØÆÅÔÖ字符串' + 'NON_ASCII__ØÆÅÔÖ_ØÆÅÔÖ字符串': 'Non-ascii: øæåôöØÆÅÔÖ字符串' } as const; export type EnumWithReplacedCharacters = "'Single Quote'" | '"Double Quotes"' | 'øæåôöØÆÅÔÖ字符串' | 3.1 | ''; @@ -108,7 +108,7 @@ export type EnumWithReplacedCharacters = "'Single Quote'" | '"Double Quotes"' | export const EnumWithReplacedCharacters = { _SINGLE_QUOTE_: "'Single Quote'", _DOUBLE_QUOTES_: '"Double Quotes"', - ØÆÅÔÖ_ØÆÅÔÖ字符串: 'øæåôöØÆÅÔÖ字符串', + 'ØÆÅÔÖ_ØÆÅÔÖ字符串': 'øæåôöØÆÅÔÖ字符串', '_3.1': 3.1, EMPTY_STRING: '' } as const; @@ -361,7 +361,7 @@ export const foo_bar_enum = { SUCCESS: 'Success', WARNING: 'Warning', ERROR: 'Error', - ØÆÅ字符串: 'ØÆÅ字符串' + 'ØÆÅ字符串': 'ØÆÅ字符串' } as const; /** diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch/services.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch/services.gen.ts.snap index 69c1d614d..b22ab5e38 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch/services.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch/services.gen.ts.snap @@ -107,7 +107,8 @@ export const postApiVbyApiVersionFormData = (options: Option ...options, ...urlSearchParamsBodySerializer, headers: { - 'Content-Type': 'application/x-www-form-urlencoded' + 'Content-Type': 'application/x-www-form-urlencoded', + ...options?.headers }, url: '/api/v{api-version}/upload' }); }; @@ -215,7 +217,8 @@ export const multipartRequest = (options?: ...options, ...formDataBodySerializer, headers: { - 'Content-Type': null + 'Content-Type': null, + ...options?.headers }, url: '/api/v{api-version}/multipart' }); }; @@ -252,7 +255,8 @@ export const putWithFormUrlEncoded = (opti ...options, ...urlSearchParamsBodySerializer, headers: { - 'Content-Type': 'application/x-www-form-urlencoded' + 'Content-Type': 'application/x-www-form-urlencoded', + ...options?.headers }, url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串' }); }; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch/types.gen.ts.snap index a854a09d1..751050669 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch/types.gen.ts.snap @@ -100,7 +100,7 @@ export const EnumWithStrings = { ERROR: 'Error', _SINGLE_QUOTE_: "'Single Quote'", _DOUBLE_QUOTES_: '"Double Quotes"', - NON_ASCII__ØÆÅÔÖ_ØÆÅÔÖ字符串: 'Non-ascii: øæåôöØÆÅÔÖ字符串' + 'NON_ASCII__ØÆÅÔÖ_ØÆÅÔÖ字符串': 'Non-ascii: øæåôöØÆÅÔÖ字符串' } as const; export type EnumWithReplacedCharacters = "'Single Quote'" | '"Double Quotes"' | 'øæåôöØÆÅÔÖ字符串' | 3.1 | ''; @@ -108,7 +108,7 @@ export type EnumWithReplacedCharacters = "'Single Quote'" | '"Double Quotes"' | export const EnumWithReplacedCharacters = { _SINGLE_QUOTE_: "'Single Quote'", _DOUBLE_QUOTES_: '"Double Quotes"', - ØÆÅÔÖ_ØÆÅÔÖ字符串: 'øæåôöØÆÅÔÖ字符串', + 'ØÆÅÔÖ_ØÆÅÔÖ字符串': 'øæåôöØÆÅÔÖ字符串', '_3.1': 3.1, EMPTY_STRING: '' } as const; @@ -361,7 +361,7 @@ export const foo_bar_enum = { SUCCESS: 'Success', WARNING: 'Warning', ERROR: 'Error', - ØÆÅ字符串: 'ØÆÅ字符串' + 'ØÆÅ字符串': 'ØÆÅ字符串' } as const; /** diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3/types.gen.ts.snap index e279b0733..db0347f69 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3/types.gen.ts.snap @@ -100,7 +100,7 @@ export const EnumWithStrings = { ERROR: 'Error', _SINGLE_QUOTE_: "'Single Quote'", _DOUBLE_QUOTES_: '"Double Quotes"', - NON_ASCII__ØÆÅÔÖ_ØÆÅÔÖ字符串: 'Non-ascii: øæåôöØÆÅÔÖ字符串' + 'NON_ASCII__ØÆÅÔÖ_ØÆÅÔÖ字符串': 'Non-ascii: øæåôöØÆÅÔÖ字符串' } as const; export type EnumWithReplacedCharacters = "'Single Quote'" | '"Double Quotes"' | 'øæåôöØÆÅÔÖ字符串' | 3.1 | ''; @@ -108,7 +108,7 @@ export type EnumWithReplacedCharacters = "'Single Quote'" | '"Double Quotes"' | export const EnumWithReplacedCharacters = { _SINGLE_QUOTE_: "'Single Quote'", _DOUBLE_QUOTES_: '"Double Quotes"', - ØÆÅÔÖ_ØÆÅÔÖ字符串: 'øæåôöØÆÅÔÖ字符串', + 'ØÆÅÔÖ_ØÆÅÔÖ字符串': 'øæåôöØÆÅÔÖ字符串', '_3.1': 3.1, EMPTY_STRING: '' } as const; @@ -361,7 +361,7 @@ export const foo_bar_enum = { SUCCESS: 'Success', WARNING: 'Warning', ERROR: 'Error', - ØÆÅ字符串: 'ØÆÅ字符串' + 'ØÆÅ字符串': 'ØÆÅ字符串' } as const; /** diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_axios/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3_axios/types.gen.ts.snap index e279b0733..db0347f69 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3_axios/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3_axios/types.gen.ts.snap @@ -100,7 +100,7 @@ export const EnumWithStrings = { ERROR: 'Error', _SINGLE_QUOTE_: "'Single Quote'", _DOUBLE_QUOTES_: '"Double Quotes"', - NON_ASCII__ØÆÅÔÖ_ØÆÅÔÖ字符串: 'Non-ascii: øæåôöØÆÅÔÖ字符串' + 'NON_ASCII__ØÆÅÔÖ_ØÆÅÔÖ字符串': 'Non-ascii: øæåôöØÆÅÔÖ字符串' } as const; export type EnumWithReplacedCharacters = "'Single Quote'" | '"Double Quotes"' | 'øæåôöØÆÅÔÖ字符串' | 3.1 | ''; @@ -108,7 +108,7 @@ export type EnumWithReplacedCharacters = "'Single Quote'" | '"Double Quotes"' | export const EnumWithReplacedCharacters = { _SINGLE_QUOTE_: "'Single Quote'", _DOUBLE_QUOTES_: '"Double Quotes"', - ØÆÅÔÖ_ØÆÅÔÖ字符串: 'øæåôöØÆÅÔÖ字符串', + 'ØÆÅÔÖ_ØÆÅÔÖ字符串': 'øæåôöØÆÅÔÖ字符串', '_3.1': 3.1, EMPTY_STRING: '' } as const; @@ -361,7 +361,7 @@ export const foo_bar_enum = { SUCCESS: 'Success', WARNING: 'Warning', ERROR: 'Error', - ØÆÅ字符串: 'ØÆÅ字符串' + 'ØÆÅ字符串': 'ØÆÅ字符串' } as const; /** diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_node/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3_node/types.gen.ts.snap index e279b0733..db0347f69 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3_node/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3_node/types.gen.ts.snap @@ -100,7 +100,7 @@ export const EnumWithStrings = { ERROR: 'Error', _SINGLE_QUOTE_: "'Single Quote'", _DOUBLE_QUOTES_: '"Double Quotes"', - NON_ASCII__ØÆÅÔÖ_ØÆÅÔÖ字符串: 'Non-ascii: øæåôöØÆÅÔÖ字符串' + 'NON_ASCII__ØÆÅÔÖ_ØÆÅÔÖ字符串': 'Non-ascii: øæåôöØÆÅÔÖ字符串' } as const; export type EnumWithReplacedCharacters = "'Single Quote'" | '"Double Quotes"' | 'øæåôöØÆÅÔÖ字符串' | 3.1 | ''; @@ -108,7 +108,7 @@ export type EnumWithReplacedCharacters = "'Single Quote'" | '"Double Quotes"' | export const EnumWithReplacedCharacters = { _SINGLE_QUOTE_: "'Single Quote'", _DOUBLE_QUOTES_: '"Double Quotes"', - ØÆÅÔÖ_ØÆÅÔÖ字符串: 'øæåôöØÆÅÔÖ字符串', + 'ØÆÅÔÖ_ØÆÅÔÖ字符串': 'øæåôöØÆÅÔÖ字符串', '_3.1': 3.1, EMPTY_STRING: '' } as const; @@ -361,7 +361,7 @@ export const foo_bar_enum = { SUCCESS: 'Success', WARNING: 'Warning', ERROR: 'Error', - ØÆÅ字符串: 'ØÆÅ字符串' + 'ØÆÅ字符串': 'ØÆÅ字符串' } as const; /** diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_services_filter/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3_services_filter/types.gen.ts.snap index 17df44f81..5d3809807 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3_services_filter/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3_services_filter/types.gen.ts.snap @@ -100,7 +100,7 @@ export const EnumWithStrings = { ERROR: 'Error', _SINGLE_QUOTE_: "'Single Quote'", _DOUBLE_QUOTES_: '"Double Quotes"', - NON_ASCII__ØÆÅÔÖ_ØÆÅÔÖ字符串: 'Non-ascii: øæåôöØÆÅÔÖ字符串' + 'NON_ASCII__ØÆÅÔÖ_ØÆÅÔÖ字符串': 'Non-ascii: øæåôöØÆÅÔÖ字符串' } as const; export type EnumWithReplacedCharacters = "'Single Quote'" | '"Double Quotes"' | 'øæåôöØÆÅÔÖ字符串' | 3.1 | ''; @@ -108,7 +108,7 @@ export type EnumWithReplacedCharacters = "'Single Quote'" | '"Double Quotes"' | export const EnumWithReplacedCharacters = { _SINGLE_QUOTE_: "'Single Quote'", _DOUBLE_QUOTES_: '"Double Quotes"', - ØÆÅÔÖ_ØÆÅÔÖ字符串: 'øæåôöØÆÅÔÖ字符串', + 'ØÆÅÔÖ_ØÆÅÔÖ字符串': 'øæåôöØÆÅÔÖ字符串', '_3.1': 3.1, EMPTY_STRING: '' } as const; @@ -361,7 +361,7 @@ export const foo_bar_enum = { SUCCESS: 'Success', WARNING: 'Warning', ERROR: 'Error', - ØÆÅ字符串: 'ØÆÅ字符串' + 'ØÆÅ字符串': 'ØÆÅ字符串' } as const; /** diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_services_name/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3_services_name/types.gen.ts.snap index 0972dacef..9ebbc4ff4 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3_services_name/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3_services_name/types.gen.ts.snap @@ -100,7 +100,7 @@ export const EnumWithStrings = { ERROR: 'Error', _SINGLE_QUOTE_: "'Single Quote'", _DOUBLE_QUOTES_: '"Double Quotes"', - NON_ASCII__ØÆÅÔÖ_ØÆÅÔÖ字符串: 'Non-ascii: øæåôöØÆÅÔÖ字符串' + 'NON_ASCII__ØÆÅÔÖ_ØÆÅÔÖ字符串': 'Non-ascii: øæåôöØÆÅÔÖ字符串' } as const; export type EnumWithReplacedCharacters = "'Single Quote'" | '"Double Quotes"' | 'øæåôöØÆÅÔÖ字符串' | 3.1 | ''; @@ -108,7 +108,7 @@ export type EnumWithReplacedCharacters = "'Single Quote'" | '"Double Quotes"' | export const EnumWithReplacedCharacters = { _SINGLE_QUOTE_: "'Single Quote'", _DOUBLE_QUOTES_: '"Double Quotes"', - ØÆÅÔÖ_ØÆÅÔÖ字符串: 'øæåôöØÆÅÔÖ字符串', + 'ØÆÅÔÖ_ØÆÅÔÖ字符串': 'øæåôöØÆÅÔÖ字符串', '_3.1': 3.1, EMPTY_STRING: '' } as const; @@ -361,7 +361,7 @@ export const foo_bar_enum = { SUCCESS: 'Success', WARNING: 'Warning', ERROR: 'Error', - ØÆÅ字符串: 'ØÆÅ字符串' + 'ØÆÅ字符串': 'ØÆÅ字符串' } as const; /** diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_tree_shakeable/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3_tree_shakeable/types.gen.ts.snap index dfc37aa6a..5cab937e5 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3_tree_shakeable/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3_tree_shakeable/types.gen.ts.snap @@ -100,7 +100,7 @@ export const EnumWithStrings = { ERROR: 'Error', _SINGLE_QUOTE_: "'Single Quote'", _DOUBLE_QUOTES_: '"Double Quotes"', - NON_ASCII__ØÆÅÔÖ_ØÆÅÔÖ字符串: 'Non-ascii: øæåôöØÆÅÔÖ字符串' + 'NON_ASCII__ØÆÅÔÖ_ØÆÅÔÖ字符串': 'Non-ascii: øæåôöØÆÅÔÖ字符串' } as const; export type EnumWithReplacedCharacters = "'Single Quote'" | '"Double Quotes"' | 'øæåôöØÆÅÔÖ字符串' | 3.1 | ''; @@ -108,7 +108,7 @@ export type EnumWithReplacedCharacters = "'Single Quote'" | '"Double Quotes"' | export const EnumWithReplacedCharacters = { _SINGLE_QUOTE_: "'Single Quote'", _DOUBLE_QUOTES_: '"Double Quotes"', - ØÆÅÔÖ_ØÆÅÔÖ字符串: 'øæåôöØÆÅÔÖ字符串', + 'ØÆÅÔÖ_ØÆÅÔÖ字符串': 'øæåôöØÆÅÔÖ字符串', '_3.1': 3.1, EMPTY_STRING: '' } as const; @@ -361,7 +361,7 @@ export const foo_bar_enum = { SUCCESS: 'Success', WARNING: 'Warning', ERROR: 'Error', - ØÆÅ字符串: 'ØÆÅ字符串' + 'ØÆÅ字符串': 'ØÆÅ字符串' } as const; /** diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_xhr/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3_xhr/types.gen.ts.snap index e279b0733..db0347f69 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3_xhr/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3_xhr/types.gen.ts.snap @@ -100,7 +100,7 @@ export const EnumWithStrings = { ERROR: 'Error', _SINGLE_QUOTE_: "'Single Quote'", _DOUBLE_QUOTES_: '"Double Quotes"', - NON_ASCII__ØÆÅÔÖ_ØÆÅÔÖ字符串: 'Non-ascii: øæåôöØÆÅÔÖ字符串' + 'NON_ASCII__ØÆÅÔÖ_ØÆÅÔÖ字符串': 'Non-ascii: øæåôöØÆÅÔÖ字符串' } as const; export type EnumWithReplacedCharacters = "'Single Quote'" | '"Double Quotes"' | 'øæåôöØÆÅÔÖ字符串' | 3.1 | ''; @@ -108,7 +108,7 @@ export type EnumWithReplacedCharacters = "'Single Quote'" | '"Double Quotes"' | export const EnumWithReplacedCharacters = { _SINGLE_QUOTE_: "'Single Quote'", _DOUBLE_QUOTES_: '"Double Quotes"', - ØÆÅÔÖ_ØÆÅÔÖ字符串: 'øæåôöØÆÅÔÖ字符串', + 'ØÆÅÔÖ_ØÆÅÔÖ字符串': 'øæåôöØÆÅÔÖ字符串', '_3.1': 3.1, EMPTY_STRING: '' } as const; @@ -361,7 +361,7 @@ export const foo_bar_enum = { SUCCESS: 'Success', WARNING: 'Warning', ERROR: 'Error', - ØÆÅ字符串: 'ØÆÅ字符串' + 'ØÆÅ字符串': 'ØÆÅ字符串' } as const; /** diff --git a/packages/openapi-ts/test/sample.cjs b/packages/openapi-ts/test/sample.cjs index 95b3b744f..b6e36cc6e 100644 --- a/packages/openapi-ts/test/sample.cjs +++ b/packages/openapi-ts/test/sample.cjs @@ -33,7 +33,7 @@ const main = async () => { services: { // export: false, // asClass: true, - filter: '^GET /api/v{api-version}/simple:operation$', + // filter: '^GET /api/v{api-version}/simple:operation$', // export: false, // name: '^Parameters', }, -- 2.51.2 From e8a38ae4e3f021a105d18764ef3252db7efa9aa0 Mon Sep 17 00:00:00 2001 From: Lubos Date: Thu, 19 Sep 2024 10:46:08 +0100 Subject: [PATCH 20/49] fix: transform any-of nullable dates --- .changeset/proud-rules-applaud.md | 5 ++ packages/openapi-ts/src/compiler/index.ts | 1 - packages/openapi-ts/src/compiler/module.ts | 6 +- packages/openapi-ts/src/compiler/transform.ts | 63 +++++++++---------- packages/openapi-ts/src/compiler/types.ts | 45 ++++++++++--- packages/openapi-ts/src/generate/services.ts | 2 +- .../openapi-ts/src/generate/transformers.ts | 20 ++++-- .../src/openApi/common/parser/sanitize.ts | 2 +- .../src/openApi/v2/parser/getModels.ts | 2 +- .../v3/parser/__tests__/getModel.spec.ts | 2 +- packages/openapi-ts/src/utils/escape.ts | 7 +-- packages/openapi-ts/src/utils/meta.ts | 2 +- .../src/utils/{reservedWords.ts => regexp.ts} | 7 +++ packages/openapi-ts/src/utils/transform.ts | 2 +- packages/openapi-ts/src/utils/type.ts | 10 +-- .../types.gen.ts.snap | 6 +- .../types.gen.ts.snap | 6 +- .../types.gen.ts.snap | 6 +- .../types.gen.ts.snap | 6 +- .../types.gen.ts.snap | 6 +- .../types.gen.ts.snap | 6 +- .../types.gen.ts.snap | 6 +- .../types.gen.ts.snap | 6 +- .../types.gen.ts.snap | 6 +- .../types.gen.ts.snap | 6 +- .../types.gen.ts.snap | 6 +- .../types.gen.ts.snap | 6 +- .../types.gen.ts.snap | 6 +- .../types.gen.ts.snap | 6 +- .../v3_angular_transform/types.gen.ts.snap | 6 +- .../types.gen.ts.snap | 6 +- .../v3_axios_transform/types.gen.ts.snap | 6 +- .../v3_client_transform/types.gen.ts.snap | 6 +- .../v3_node_transform/types.gen.ts.snap | 6 +- .../generated/v3_transform/types.gen.ts.snap | 6 +- .../v3_xhr_transform/types.gen.ts.snap | 6 +- packages/openapi-ts/test/sample.cjs | 2 +- .../openapi-ts/test/spec/v3-transforms.json | 9 +++ 38 files changed, 227 insertions(+), 86 deletions(-) create mode 100644 .changeset/proud-rules-applaud.md rename packages/openapi-ts/src/utils/{reservedWords.ts => regexp.ts} (67%) diff --git a/.changeset/proud-rules-applaud.md b/.changeset/proud-rules-applaud.md new file mode 100644 index 000000000..2af5a2895 --- /dev/null +++ b/.changeset/proud-rules-applaud.md @@ -0,0 +1,5 @@ +--- +'@hey-api/openapi-ts': patch +--- + +fix: transform any-of nullable dates diff --git a/packages/openapi-ts/src/compiler/index.ts b/packages/openapi-ts/src/compiler/index.ts index 66305890b..5b61fe262 100644 --- a/packages/openapi-ts/src/compiler/index.ts +++ b/packages/openapi-ts/src/compiler/index.ts @@ -178,7 +178,6 @@ export const compiler = { conditionalExpression: types.createConditionalExpression, constVariable: module.createConstVariable, constructorDeclaration: classes.createConstructorDeclaration, - elementAccessExpression: transform.createElementAccessExpression, enumDeclaration: types.createEnumDeclaration, exportAllDeclaration: module.createExportAllDeclaration, exportNamedDeclaration: module.createNamedExportDeclarations, diff --git a/packages/openapi-ts/src/compiler/module.ts b/packages/openapi-ts/src/compiler/module.ts index 4cf32b2bf..6df3a49e3 100644 --- a/packages/openapi-ts/src/compiler/module.ts +++ b/packages/openapi-ts/src/compiler/module.ts @@ -35,7 +35,11 @@ export const createCallExpression = ({ functionName, types, }: { - functionName: string | ts.PropertyAccessExpression; + functionName: + | string + | ts.PropertyAccessExpression + | ts.PropertyAccessChain + | ts.ElementAccessExpression; parameters?: Array; types?: ReadonlyArray; }) => { diff --git a/packages/openapi-ts/src/compiler/transform.ts b/packages/openapi-ts/src/compiler/transform.ts index ca5ced6b5..2d3271310 100644 --- a/packages/openapi-ts/src/compiler/transform.ts +++ b/packages/openapi-ts/src/compiler/transform.ts @@ -1,22 +1,34 @@ import ts from 'typescript'; +import { validTypescriptIdentifierRegExp } from '../utils/regexp'; import { expressionToStatement } from './convert'; import { createCallExpression } from './module'; -import { createArrowFunction, createPropertyAccessExpression } from './types'; -import { createIdentifier, ots } from './utils'; +import { + createArrowFunction, + createPropertyAccessChain, + createPropertyAccessExpression, +} from './types'; +import { createIdentifier } from './utils'; export const createSafeAccessExpression = (path: string[]) => - path - .slice(1) - .reduce( - (expression, element) => - ts.factory.createPropertyAccessChain( + path.slice(1).reduce( + (expression, element) => { + validTypescriptIdentifierRegExp.lastIndex = 0; + if (validTypescriptIdentifierRegExp.test(element)) { + return createPropertyAccessChain({ expression, - ts.factory.createToken(ts.SyntaxKind.QuestionDotToken), - createIdentifier({ text: element }), - ), - createIdentifier({ text: path[0] }), - ); + name: element, + }); + } + + return ts.factory.createElementAccessChain( + expression, + ts.factory.createToken(ts.SyntaxKind.QuestionDotToken), + createIdentifier({ text: element }), + ); + }, + createIdentifier({ text: path[0] }), + ); export const createAccessExpression = (path: string[]) => path.slice(1).reduce( @@ -47,20 +59,6 @@ export const createPropertyAccessExpressions = ({ return expression as ts.PropertyAccessExpression; }; -export const createElementAccessExpression = ({ - index, - name, -}: { - index: number; - name: string; -}) => { - const expression = ts.factory.createElementAccessExpression( - createIdentifier({ text: name }), - ots.number(index), - ); - return expression; -}; - export const createBinaryExpression = ({ left, operator = '=', @@ -198,12 +196,13 @@ export const createDateTransformerExpression = ({ parameterName, }: { parameterName: string; -}) => - ts.factory.createNewExpression( - createIdentifier({ text: 'Date' }), - undefined, - [createIdentifier({ text: parameterName })], - ); +}) => { + const expression = createIdentifier({ text: 'Date' }); + const newExpression = ts.factory.createNewExpression(expression, undefined, [ + createIdentifier({ text: parameterName }), + ]); + return newExpression; +}; export const createArrayMapTransform = ({ path, diff --git a/packages/openapi-ts/src/compiler/types.ts b/packages/openapi-ts/src/compiler/types.ts index 9f5156ec7..2637a24f3 100644 --- a/packages/openapi-ts/src/compiler/types.ts +++ b/packages/openapi-ts/src/compiler/types.ts @@ -1,5 +1,6 @@ import ts from 'typescript'; +import { validTypescriptIdentifierRegExp } from '../utils/regexp'; import { addLeadingComments, type Comments, @@ -48,6 +49,21 @@ export const createTypeNode = ( }); }; +export const createPropertyAccessChain = ({ + expression, + name, +}: { + expression: ts.Expression; + name: string | ts.MemberName; +}) => { + const node = ts.factory.createPropertyAccessChain( + expression, + ts.factory.createToken(ts.SyntaxKind.QuestionDotToken), + name, + ); + return node; +}; + export const createPropertyAccessExpression = ({ expression, isOptional, @@ -56,22 +72,35 @@ export const createPropertyAccessExpression = ({ expression: string | ts.Expression; isOptional?: boolean; name: string | ts.MemberName; -}) => { +}): + | ts.PropertyAccessChain + | ts.PropertyAccessExpression + | ts.ElementAccessExpression => { const nodeExpression = typeof expression === 'string' ? createIdentifier({ text: expression }) : expression; + if (isOptional) { + const node = createPropertyAccessChain({ + expression: nodeExpression, + name, + }); + return node; + } + const nodeName = typeof name === 'string' ? createIdentifier({ text: name }) : name; - if (isOptional) { - const node = ts.factory.createPropertyAccessChain( - nodeExpression, - ts.factory.createToken(ts.SyntaxKind.QuestionDotToken), - nodeName, - ); - return node; + if (typeof name === 'string') { + validTypescriptIdentifierRegExp.lastIndex = 0; + if (!validTypescriptIdentifierRegExp.test(name)) { + const node = ts.factory.createElementAccessExpression( + nodeExpression, + nodeName, + ); + return node; + } } const node = ts.factory.createPropertyAccessExpression( diff --git a/packages/openapi-ts/src/generate/services.ts b/packages/openapi-ts/src/generate/services.ts index bc5065a17..c1c7fa758 100644 --- a/packages/openapi-ts/src/generate/services.ts +++ b/packages/openapi-ts/src/generate/services.ts @@ -18,7 +18,7 @@ import type { Files } from '../types/utils'; import { camelCase } from '../utils/camelCase'; import { getConfig, isStandaloneClient } from '../utils/config'; import { escapeComment, escapeName } from '../utils/escape'; -import { reservedWordsRegExp } from '../utils/reservedWords'; +import { reservedWordsRegExp } from '../utils/regexp'; import { transformServiceName } from '../utils/transform'; import { setUniqueTypeName } from '../utils/type'; import { unique } from '../utils/unique'; diff --git a/packages/openapi-ts/src/generate/transformers.ts b/packages/openapi-ts/src/generate/transformers.ts index 1bff36fc3..b5ad144da 100644 --- a/packages/openapi-ts/src/generate/transformers.ts +++ b/packages/openapi-ts/src/generate/transformers.ts @@ -3,7 +3,7 @@ import ts from 'typescript'; import { compiler } from '../compiler'; import type { ModelMeta, OperationResponse } from '../types/client'; import { getConfig } from '../utils/config'; -import { unsetUniqueTypeName } from '../utils/type'; +import { isModelDate, unsetUniqueTypeName } from '../utils/type'; import { modelResponseTransformerTypeName, operationResponseTransformerTypeName, @@ -97,12 +97,22 @@ const processArray = (props: ModelProps) => { ]; } - if (model.format === 'date' || model.format === 'date-time') { + if ( + isModelDate(model) || + (model.link && + !Array.isArray(model.link) && + model.link.export === 'any-of' && + model.link.properties.find((property) => isModelDate(property))) + ) { return [ compiler.transformArrayMap({ path: props.path, - transformExpression: compiler.transformNewDate({ - parameterName: 'item', + transformExpression: compiler.conditionalExpression({ + condition: compiler.identifier({ text: 'item' }), + whenFalse: compiler.identifier({ text: 'item' }), + whenTrue: compiler.transformNewDate({ + parameterName: 'item', + }), }), }), ]; @@ -119,7 +129,7 @@ const processProperty = (props: ModelProps) => { if ( model.type === 'string' && model.export !== 'array' && - (model.format === 'date-time' || model.format === 'date') + isModelDate(model) ) { return [compiler.transformDateMutation({ path })]; } diff --git a/packages/openapi-ts/src/openApi/common/parser/sanitize.ts b/packages/openapi-ts/src/openApi/common/parser/sanitize.ts index 618266255..05271bbff 100644 --- a/packages/openapi-ts/src/openApi/common/parser/sanitize.ts +++ b/packages/openapi-ts/src/openApi/common/parser/sanitize.ts @@ -1,4 +1,4 @@ -import { illegalStartCharactersRegExp } from '../../../utils/reservedWords'; +import { illegalStartCharactersRegExp } from '../../../utils/regexp'; /** * Sanitizes names of types, so they are valid TypeScript identifiers of a certain form. diff --git a/packages/openapi-ts/src/openApi/v2/parser/getModels.ts b/packages/openapi-ts/src/openApi/v2/parser/getModels.ts index 6c406ef34..76eba07df 100644 --- a/packages/openapi-ts/src/openApi/v2/parser/getModels.ts +++ b/packages/openapi-ts/src/openApi/v2/parser/getModels.ts @@ -1,5 +1,5 @@ import type { Client } from '../../../types/client'; -import { reservedWordsRegExp } from '../../../utils/reservedWords'; +import { reservedWordsRegExp } from '../../../utils/regexp'; import { getType } from '../../common/parser/type'; import type { OpenApi } from '../interfaces/OpenApi'; import { getModel } from './getModel'; diff --git a/packages/openapi-ts/src/openApi/v3/parser/__tests__/getModel.spec.ts b/packages/openapi-ts/src/openApi/v3/parser/__tests__/getModel.spec.ts index de5c5a7f7..a0d205567 100644 --- a/packages/openapi-ts/src/openApi/v3/parser/__tests__/getModel.spec.ts +++ b/packages/openapi-ts/src/openApi/v3/parser/__tests__/getModel.spec.ts @@ -1,7 +1,7 @@ import { describe, expect, it, vi } from 'vitest'; import type { Config } from '../../../../types/config'; -import { reservedWordsRegExp } from '../../../../utils/reservedWords'; +import { reservedWordsRegExp } from '../../../../utils/regexp'; import { getType } from '../../../common/parser/type'; import { getModel } from '../getModel'; diff --git a/packages/openapi-ts/src/utils/escape.ts b/packages/openapi-ts/src/utils/escape.ts index 02b45f27c..35728b37c 100644 --- a/packages/openapi-ts/src/utils/escape.ts +++ b/packages/openapi-ts/src/utils/escape.ts @@ -1,11 +1,6 @@ import { EOL } from 'os'; -/** - * Javascript identifier regexp pattern retrieved from - * {@link} https://developer.mozilla.org/docs/Web/JavaScript/Reference/Lexical_grammar#identifiers - */ -const validTypescriptIdentifierRegExp = - /^[$_\p{ID_Start}][$\u200c\u200d\p{ID_Continue}]*$/u; +import { validTypescriptIdentifierRegExp } from './regexp'; export const escapeName = (value: string): string => { if (value || value === '') { diff --git a/packages/openapi-ts/src/utils/meta.ts b/packages/openapi-ts/src/utils/meta.ts index 2617a0490..a68f65eee 100644 --- a/packages/openapi-ts/src/utils/meta.ts +++ b/packages/openapi-ts/src/utils/meta.ts @@ -1,6 +1,6 @@ import { getType } from '../openApi'; import { refParametersPartial, refSchemasPartial } from './const'; -import { reservedWordsRegExp } from './reservedWords'; +import { reservedWordsRegExp } from './regexp'; import { cleanAndTransformTypeName } from './transform'; export const getParametersMeta = (definitionName: string) => { diff --git a/packages/openapi-ts/src/utils/reservedWords.ts b/packages/openapi-ts/src/utils/regexp.ts similarity index 67% rename from packages/openapi-ts/src/utils/reservedWords.ts rename to packages/openapi-ts/src/utils/regexp.ts index 567f6cfac..cac09eff9 100644 --- a/packages/openapi-ts/src/utils/reservedWords.ts +++ b/packages/openapi-ts/src/utils/regexp.ts @@ -8,3 +8,10 @@ export const illegalStartCharactersRegExp = /^[^$_\p{ID_Start}]+/u; */ export const reservedWordsRegExp = /^(arguments|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|eval|export|extends|false|finally|for|function|if|implements|import|in|instanceof|interface|let|new|null|package|private|protected|public|return|static|super|switch|this|throw|true|try|typeof|var|void|while|with|yield)$/g; + +/** + * Javascript identifier regexp pattern retrieved from + * {@link} https://developer.mozilla.org/docs/Web/JavaScript/Reference/Lexical_grammar#identifiers + */ +export const validTypescriptIdentifierRegExp = + /^[$_\p{ID_Start}][$\u200c\u200d\p{ID_Continue}]*$/u; diff --git a/packages/openapi-ts/src/utils/transform.ts b/packages/openapi-ts/src/utils/transform.ts index a1ddd35dd..bee18de83 100644 --- a/packages/openapi-ts/src/utils/transform.ts +++ b/packages/openapi-ts/src/utils/transform.ts @@ -1,7 +1,7 @@ import { ensureValidTypeScriptJavaScriptIdentifier } from '../openApi'; import { camelCase } from './camelCase'; import { getConfig } from './config'; -import { reservedWordsRegExp } from './reservedWords'; +import { reservedWordsRegExp } from './regexp'; export const transformServiceName = (name: string) => { const config = getConfig(); diff --git a/packages/openapi-ts/src/utils/type.ts b/packages/openapi-ts/src/utils/type.ts index 95e526260..fd4fc77f9 100644 --- a/packages/openapi-ts/src/utils/type.ts +++ b/packages/openapi-ts/src/utils/type.ts @@ -8,9 +8,12 @@ import { refSchemasPartial } from './const'; import { enumValue } from './enum'; import { escapeComment, escapeName, unescapeName } from './escape'; import { getSchemasMeta } from './meta'; -import { reservedWordsRegExp } from './reservedWords'; +import { reservedWordsRegExp } from './regexp'; import { unique } from './unique'; +export const isModelDate = (model: Model): boolean => + model.format === 'date' || model.format === 'date-time'; + const base = (model: Model) => { const config = getConfig(); @@ -20,10 +23,7 @@ const base = (model: Model) => { }); } - if ( - config.types.dates && - (model.format === 'date-time' || model.format === 'date') - ) { + if (config.types.dates && isModelDate(model)) { return compiler.typeNode('Date'); } diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle_transform/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle_transform/types.gen.ts.snap index 8873c2a29..4f5b1d77e 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle_transform/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle_transform/types.gen.ts.snap @@ -28,6 +28,7 @@ export type ParentModelWithDates = { readonly modified?: Date; items?: Array; item?: ModelWithDates; + 'nullable-date'?: Array<(Date | null)>; simpleItems?: Array; simpleItem?: SimpleModel; dates?: Array<(Date)>; @@ -84,8 +85,11 @@ export const ParentModelWithDatesModelResponseTransformer: ParentModelWithDatesM if (data?.item) { ModelWithDatesModelResponseTransformer(data.item); } + if (Array.isArray(data?.['nullable-date'])) { + data['nullable-date'] = data['nullable-date'].map(item => item ? new Date(item) : item); + } if (Array.isArray(data?.dates)) { - data.dates = data.dates.map(item => new Date(item)); + data.dates = data.dates.map(item => item ? new Date(item) : item); } return data; }; diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-class_transform/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-class_transform/types.gen.ts.snap index 8873c2a29..4f5b1d77e 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-class_transform/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-class_transform/types.gen.ts.snap @@ -28,6 +28,7 @@ export type ParentModelWithDates = { readonly modified?: Date; items?: Array; item?: ModelWithDates; + 'nullable-date'?: Array<(Date | null)>; simpleItems?: Array; simpleItem?: SimpleModel; dates?: Array<(Date)>; @@ -84,8 +85,11 @@ export const ParentModelWithDatesModelResponseTransformer: ParentModelWithDatesM if (data?.item) { ModelWithDatesModelResponseTransformer(data.item); } + if (Array.isArray(data?.['nullable-date'])) { + data['nullable-date'] = data['nullable-date'].map(item => item ? new Date(item) : item); + } if (Array.isArray(data?.dates)) { - data.dates = data.dates.map(item => new Date(item)); + data.dates = data.dates.map(item => item ? new Date(item) : item); } return data; }; diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-react-query_transform/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-react-query_transform/types.gen.ts.snap index 8873c2a29..4f5b1d77e 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-react-query_transform/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-react-query_transform/types.gen.ts.snap @@ -28,6 +28,7 @@ export type ParentModelWithDates = { readonly modified?: Date; items?: Array; item?: ModelWithDates; + 'nullable-date'?: Array<(Date | null)>; simpleItems?: Array; simpleItem?: SimpleModel; dates?: Array<(Date)>; @@ -84,8 +85,11 @@ export const ParentModelWithDatesModelResponseTransformer: ParentModelWithDatesM if (data?.item) { ModelWithDatesModelResponseTransformer(data.item); } + if (Array.isArray(data?.['nullable-date'])) { + data['nullable-date'] = data['nullable-date'].map(item => item ? new Date(item) : item); + } if (Array.isArray(data?.dates)) { - data.dates = data.dates.map(item => new Date(item)); + data.dates = data.dates.map(item => item ? new Date(item) : item); } return data; }; diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-solid-query_transform/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-solid-query_transform/types.gen.ts.snap index 8873c2a29..4f5b1d77e 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-solid-query_transform/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-solid-query_transform/types.gen.ts.snap @@ -28,6 +28,7 @@ export type ParentModelWithDates = { readonly modified?: Date; items?: Array; item?: ModelWithDates; + 'nullable-date'?: Array<(Date | null)>; simpleItems?: Array; simpleItem?: SimpleModel; dates?: Array<(Date)>; @@ -84,8 +85,11 @@ export const ParentModelWithDatesModelResponseTransformer: ParentModelWithDatesM if (data?.item) { ModelWithDatesModelResponseTransformer(data.item); } + if (Array.isArray(data?.['nullable-date'])) { + data['nullable-date'] = data['nullable-date'].map(item => item ? new Date(item) : item); + } if (Array.isArray(data?.dates)) { - data.dates = data.dates.map(item => new Date(item)); + data.dates = data.dates.map(item => item ? new Date(item) : item); } return data; }; diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-svelte-query_transform/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-svelte-query_transform/types.gen.ts.snap index 8873c2a29..4f5b1d77e 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-svelte-query_transform/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-svelte-query_transform/types.gen.ts.snap @@ -28,6 +28,7 @@ export type ParentModelWithDates = { readonly modified?: Date; items?: Array; item?: ModelWithDates; + 'nullable-date'?: Array<(Date | null)>; simpleItems?: Array; simpleItem?: SimpleModel; dates?: Array<(Date)>; @@ -84,8 +85,11 @@ export const ParentModelWithDatesModelResponseTransformer: ParentModelWithDatesM if (data?.item) { ModelWithDatesModelResponseTransformer(data.item); } + if (Array.isArray(data?.['nullable-date'])) { + data['nullable-date'] = data['nullable-date'].map(item => item ? new Date(item) : item); + } if (Array.isArray(data?.dates)) { - data.dates = data.dates.map(item => new Date(item)); + data.dates = data.dates.map(item => item ? new Date(item) : item); } return data; }; diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-vue-query_transform/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-vue-query_transform/types.gen.ts.snap index 8873c2a29..4f5b1d77e 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-vue-query_transform/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-vue-query_transform/types.gen.ts.snap @@ -28,6 +28,7 @@ export type ParentModelWithDates = { readonly modified?: Date; items?: Array; item?: ModelWithDates; + 'nullable-date'?: Array<(Date | null)>; simpleItems?: Array; simpleItem?: SimpleModel; dates?: Array<(Date)>; @@ -84,8 +85,11 @@ export const ParentModelWithDatesModelResponseTransformer: ParentModelWithDatesM if (data?.item) { ModelWithDatesModelResponseTransformer(data.item); } + if (Array.isArray(data?.['nullable-date'])) { + data['nullable-date'] = data['nullable-date'].map(item => item ? new Date(item) : item); + } if (Array.isArray(data?.dates)) { - data.dates = data.dates.map(item => new Date(item)); + data.dates = data.dates.map(item => item ? new Date(item) : item); } return data; }; diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios_transform/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios_transform/types.gen.ts.snap index 8873c2a29..4f5b1d77e 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios_transform/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios_transform/types.gen.ts.snap @@ -28,6 +28,7 @@ export type ParentModelWithDates = { readonly modified?: Date; items?: Array; item?: ModelWithDates; + 'nullable-date'?: Array<(Date | null)>; simpleItems?: Array; simpleItem?: SimpleModel; dates?: Array<(Date)>; @@ -84,8 +85,11 @@ export const ParentModelWithDatesModelResponseTransformer: ParentModelWithDatesM if (data?.item) { ModelWithDatesModelResponseTransformer(data.item); } + if (Array.isArray(data?.['nullable-date'])) { + data['nullable-date'] = data['nullable-date'].map(item => item ? new Date(item) : item); + } if (Array.isArray(data?.dates)) { - data.dates = data.dates.map(item => new Date(item)); + data.dates = data.dates.map(item => item ? new Date(item) : item); } return data; }; diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle_transform/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle_transform/types.gen.ts.snap index 8873c2a29..4f5b1d77e 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle_transform/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle_transform/types.gen.ts.snap @@ -28,6 +28,7 @@ export type ParentModelWithDates = { readonly modified?: Date; items?: Array; item?: ModelWithDates; + 'nullable-date'?: Array<(Date | null)>; simpleItems?: Array; simpleItem?: SimpleModel; dates?: Array<(Date)>; @@ -84,8 +85,11 @@ export const ParentModelWithDatesModelResponseTransformer: ParentModelWithDatesM if (data?.item) { ModelWithDatesModelResponseTransformer(data.item); } + if (Array.isArray(data?.['nullable-date'])) { + data['nullable-date'] = data['nullable-date'].map(item => item ? new Date(item) : item); + } if (Array.isArray(data?.dates)) { - data.dates = data.dates.map(item => new Date(item)); + data.dates = data.dates.map(item => item ? new Date(item) : item); } return data; }; diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-class_transform/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-class_transform/types.gen.ts.snap index 8873c2a29..4f5b1d77e 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-class_transform/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-class_transform/types.gen.ts.snap @@ -28,6 +28,7 @@ export type ParentModelWithDates = { readonly modified?: Date; items?: Array; item?: ModelWithDates; + 'nullable-date'?: Array<(Date | null)>; simpleItems?: Array; simpleItem?: SimpleModel; dates?: Array<(Date)>; @@ -84,8 +85,11 @@ export const ParentModelWithDatesModelResponseTransformer: ParentModelWithDatesM if (data?.item) { ModelWithDatesModelResponseTransformer(data.item); } + if (Array.isArray(data?.['nullable-date'])) { + data['nullable-date'] = data['nullable-date'].map(item => item ? new Date(item) : item); + } if (Array.isArray(data?.dates)) { - data.dates = data.dates.map(item => new Date(item)); + data.dates = data.dates.map(item => item ? new Date(item) : item); } return data; }; diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-react-query_transform/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-react-query_transform/types.gen.ts.snap index 8873c2a29..4f5b1d77e 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-react-query_transform/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-react-query_transform/types.gen.ts.snap @@ -28,6 +28,7 @@ export type ParentModelWithDates = { readonly modified?: Date; items?: Array; item?: ModelWithDates; + 'nullable-date'?: Array<(Date | null)>; simpleItems?: Array; simpleItem?: SimpleModel; dates?: Array<(Date)>; @@ -84,8 +85,11 @@ export const ParentModelWithDatesModelResponseTransformer: ParentModelWithDatesM if (data?.item) { ModelWithDatesModelResponseTransformer(data.item); } + if (Array.isArray(data?.['nullable-date'])) { + data['nullable-date'] = data['nullable-date'].map(item => item ? new Date(item) : item); + } if (Array.isArray(data?.dates)) { - data.dates = data.dates.map(item => new Date(item)); + data.dates = data.dates.map(item => item ? new Date(item) : item); } return data; }; diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-solid-query_transform/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-solid-query_transform/types.gen.ts.snap index 8873c2a29..4f5b1d77e 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-solid-query_transform/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-solid-query_transform/types.gen.ts.snap @@ -28,6 +28,7 @@ export type ParentModelWithDates = { readonly modified?: Date; items?: Array; item?: ModelWithDates; + 'nullable-date'?: Array<(Date | null)>; simpleItems?: Array; simpleItem?: SimpleModel; dates?: Array<(Date)>; @@ -84,8 +85,11 @@ export const ParentModelWithDatesModelResponseTransformer: ParentModelWithDatesM if (data?.item) { ModelWithDatesModelResponseTransformer(data.item); } + if (Array.isArray(data?.['nullable-date'])) { + data['nullable-date'] = data['nullable-date'].map(item => item ? new Date(item) : item); + } if (Array.isArray(data?.dates)) { - data.dates = data.dates.map(item => new Date(item)); + data.dates = data.dates.map(item => item ? new Date(item) : item); } return data; }; diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-svelte-query_transform/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-svelte-query_transform/types.gen.ts.snap index 8873c2a29..4f5b1d77e 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-svelte-query_transform/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-svelte-query_transform/types.gen.ts.snap @@ -28,6 +28,7 @@ export type ParentModelWithDates = { readonly modified?: Date; items?: Array; item?: ModelWithDates; + 'nullable-date'?: Array<(Date | null)>; simpleItems?: Array; simpleItem?: SimpleModel; dates?: Array<(Date)>; @@ -84,8 +85,11 @@ export const ParentModelWithDatesModelResponseTransformer: ParentModelWithDatesM if (data?.item) { ModelWithDatesModelResponseTransformer(data.item); } + if (Array.isArray(data?.['nullable-date'])) { + data['nullable-date'] = data['nullable-date'].map(item => item ? new Date(item) : item); + } if (Array.isArray(data?.dates)) { - data.dates = data.dates.map(item => new Date(item)); + data.dates = data.dates.map(item => item ? new Date(item) : item); } return data; }; diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-vue-query_transform/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-vue-query_transform/types.gen.ts.snap index 8873c2a29..4f5b1d77e 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-vue-query_transform/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-vue-query_transform/types.gen.ts.snap @@ -28,6 +28,7 @@ export type ParentModelWithDates = { readonly modified?: Date; items?: Array; item?: ModelWithDates; + 'nullable-date'?: Array<(Date | null)>; simpleItems?: Array; simpleItem?: SimpleModel; dates?: Array<(Date)>; @@ -84,8 +85,11 @@ export const ParentModelWithDatesModelResponseTransformer: ParentModelWithDatesM if (data?.item) { ModelWithDatesModelResponseTransformer(data.item); } + if (Array.isArray(data?.['nullable-date'])) { + data['nullable-date'] = data['nullable-date'].map(item => item ? new Date(item) : item); + } if (Array.isArray(data?.dates)) { - data.dates = data.dates.map(item => new Date(item)); + data.dates = data.dates.map(item => item ? new Date(item) : item); } return data; }; diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch_transform/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch_transform/types.gen.ts.snap index 8873c2a29..4f5b1d77e 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch_transform/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch_transform/types.gen.ts.snap @@ -28,6 +28,7 @@ export type ParentModelWithDates = { readonly modified?: Date; items?: Array; item?: ModelWithDates; + 'nullable-date'?: Array<(Date | null)>; simpleItems?: Array; simpleItem?: SimpleModel; dates?: Array<(Date)>; @@ -84,8 +85,11 @@ export const ParentModelWithDatesModelResponseTransformer: ParentModelWithDatesM if (data?.item) { ModelWithDatesModelResponseTransformer(data.item); } + if (Array.isArray(data?.['nullable-date'])) { + data['nullable-date'] = data['nullable-date'].map(item => item ? new Date(item) : item); + } if (Array.isArray(data?.dates)) { - data.dates = data.dates.map(item => new Date(item)); + data.dates = data.dates.map(item => item ? new Date(item) : item); } return data; }; diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_angular_transform/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3_angular_transform/types.gen.ts.snap index 1be361475..5ca7d6a30 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3_angular_transform/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3_angular_transform/types.gen.ts.snap @@ -28,6 +28,7 @@ export type ParentModelWithDates = { readonly modified?: Date; items?: Array; item?: ModelWithDates; + 'nullable-date'?: Array<(Date | null)>; simpleItems?: Array; simpleItem?: SimpleModel; dates?: Array<(Date)>; @@ -72,8 +73,11 @@ export const ParentModelWithDatesModelResponseTransformer: ParentModelWithDatesM if (data?.item) { ModelWithDatesModelResponseTransformer(data.item); } + if (Array.isArray(data?.['nullable-date'])) { + data['nullable-date'] = data['nullable-date'].map(item => item ? new Date(item) : item); + } if (Array.isArray(data?.dates)) { - data.dates = data.dates.map(item => new Date(item)); + data.dates = data.dates.map(item => item ? new Date(item) : item); } return data; }; diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_angular_tree_shakeable_transform/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3_angular_tree_shakeable_transform/types.gen.ts.snap index 1be361475..5ca7d6a30 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3_angular_tree_shakeable_transform/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3_angular_tree_shakeable_transform/types.gen.ts.snap @@ -28,6 +28,7 @@ export type ParentModelWithDates = { readonly modified?: Date; items?: Array; item?: ModelWithDates; + 'nullable-date'?: Array<(Date | null)>; simpleItems?: Array; simpleItem?: SimpleModel; dates?: Array<(Date)>; @@ -72,8 +73,11 @@ export const ParentModelWithDatesModelResponseTransformer: ParentModelWithDatesM if (data?.item) { ModelWithDatesModelResponseTransformer(data.item); } + if (Array.isArray(data?.['nullable-date'])) { + data['nullable-date'] = data['nullable-date'].map(item => item ? new Date(item) : item); + } if (Array.isArray(data?.dates)) { - data.dates = data.dates.map(item => new Date(item)); + data.dates = data.dates.map(item => item ? new Date(item) : item); } return data; }; diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_axios_transform/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3_axios_transform/types.gen.ts.snap index 1be361475..5ca7d6a30 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3_axios_transform/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3_axios_transform/types.gen.ts.snap @@ -28,6 +28,7 @@ export type ParentModelWithDates = { readonly modified?: Date; items?: Array; item?: ModelWithDates; + 'nullable-date'?: Array<(Date | null)>; simpleItems?: Array; simpleItem?: SimpleModel; dates?: Array<(Date)>; @@ -72,8 +73,11 @@ export const ParentModelWithDatesModelResponseTransformer: ParentModelWithDatesM if (data?.item) { ModelWithDatesModelResponseTransformer(data.item); } + if (Array.isArray(data?.['nullable-date'])) { + data['nullable-date'] = data['nullable-date'].map(item => item ? new Date(item) : item); + } if (Array.isArray(data?.dates)) { - data.dates = data.dates.map(item => new Date(item)); + data.dates = data.dates.map(item => item ? new Date(item) : item); } return data; }; diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_client_transform/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3_client_transform/types.gen.ts.snap index 1be361475..5ca7d6a30 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3_client_transform/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3_client_transform/types.gen.ts.snap @@ -28,6 +28,7 @@ export type ParentModelWithDates = { readonly modified?: Date; items?: Array; item?: ModelWithDates; + 'nullable-date'?: Array<(Date | null)>; simpleItems?: Array; simpleItem?: SimpleModel; dates?: Array<(Date)>; @@ -72,8 +73,11 @@ export const ParentModelWithDatesModelResponseTransformer: ParentModelWithDatesM if (data?.item) { ModelWithDatesModelResponseTransformer(data.item); } + if (Array.isArray(data?.['nullable-date'])) { + data['nullable-date'] = data['nullable-date'].map(item => item ? new Date(item) : item); + } if (Array.isArray(data?.dates)) { - data.dates = data.dates.map(item => new Date(item)); + data.dates = data.dates.map(item => item ? new Date(item) : item); } return data; }; diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_node_transform/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3_node_transform/types.gen.ts.snap index 1be361475..5ca7d6a30 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3_node_transform/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3_node_transform/types.gen.ts.snap @@ -28,6 +28,7 @@ export type ParentModelWithDates = { readonly modified?: Date; items?: Array; item?: ModelWithDates; + 'nullable-date'?: Array<(Date | null)>; simpleItems?: Array; simpleItem?: SimpleModel; dates?: Array<(Date)>; @@ -72,8 +73,11 @@ export const ParentModelWithDatesModelResponseTransformer: ParentModelWithDatesM if (data?.item) { ModelWithDatesModelResponseTransformer(data.item); } + if (Array.isArray(data?.['nullable-date'])) { + data['nullable-date'] = data['nullable-date'].map(item => item ? new Date(item) : item); + } if (Array.isArray(data?.dates)) { - data.dates = data.dates.map(item => new Date(item)); + data.dates = data.dates.map(item => item ? new Date(item) : item); } return data; }; diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_transform/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3_transform/types.gen.ts.snap index 1be361475..5ca7d6a30 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3_transform/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3_transform/types.gen.ts.snap @@ -28,6 +28,7 @@ export type ParentModelWithDates = { readonly modified?: Date; items?: Array; item?: ModelWithDates; + 'nullable-date'?: Array<(Date | null)>; simpleItems?: Array; simpleItem?: SimpleModel; dates?: Array<(Date)>; @@ -72,8 +73,11 @@ export const ParentModelWithDatesModelResponseTransformer: ParentModelWithDatesM if (data?.item) { ModelWithDatesModelResponseTransformer(data.item); } + if (Array.isArray(data?.['nullable-date'])) { + data['nullable-date'] = data['nullable-date'].map(item => item ? new Date(item) : item); + } if (Array.isArray(data?.dates)) { - data.dates = data.dates.map(item => new Date(item)); + data.dates = data.dates.map(item => item ? new Date(item) : item); } return data; }; diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_xhr_transform/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3_xhr_transform/types.gen.ts.snap index 1be361475..5ca7d6a30 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3_xhr_transform/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3_xhr_transform/types.gen.ts.snap @@ -28,6 +28,7 @@ export type ParentModelWithDates = { readonly modified?: Date; items?: Array; item?: ModelWithDates; + 'nullable-date'?: Array<(Date | null)>; simpleItems?: Array; simpleItem?: SimpleModel; dates?: Array<(Date)>; @@ -72,8 +73,11 @@ export const ParentModelWithDatesModelResponseTransformer: ParentModelWithDatesM if (data?.item) { ModelWithDatesModelResponseTransformer(data.item); } + if (Array.isArray(data?.['nullable-date'])) { + data['nullable-date'] = data['nullable-date'].map(item => item ? new Date(item) : item); + } if (Array.isArray(data?.dates)) { - data.dates = data.dates.map(item => new Date(item)); + data.dates = data.dates.map(item => item ? new Date(item) : item); } return data; }; diff --git a/packages/openapi-ts/test/sample.cjs b/packages/openapi-ts/test/sample.cjs index b6e36cc6e..5be6f2b4c 100644 --- a/packages/openapi-ts/test/sample.cjs +++ b/packages/openapi-ts/test/sample.cjs @@ -38,7 +38,7 @@ const main = async () => { // name: '^Parameters', }, types: { - // dates: 'types+transform', + dates: 'types+transform', // enums: 'javascript', // export: false, // include: diff --git a/packages/openapi-ts/test/spec/v3-transforms.json b/packages/openapi-ts/test/spec/v3-transforms.json index c42b55f7c..77c034b41 100644 --- a/packages/openapi-ts/test/spec/v3-transforms.json +++ b/packages/openapi-ts/test/spec/v3-transforms.json @@ -208,6 +208,15 @@ "item": { "$ref": "#/components/schemas/ModelWithDates" }, + "nullable-date": { + "type": "array", + "items": { + "anyOf": [ + { "type": "string", "format": "date-time" }, + { "type": "null" } + ] + } + }, "simpleItems": { "type": "array", "items": { -- 2.51.2 From 5a52da1425abef9f4fef58ef077dbd05545e25a2 Mon Sep 17 00:00:00 2001 From: Lubos Date: Thu, 19 Sep 2024 11:12:19 +0100 Subject: [PATCH 21/49] fix: handle named object property with no nested properties --- .changeset/grumpy-carrots-fix.md | 5 +++++ packages/openapi-ts/src/openApi/v3/parser/getModel.ts | 4 +++- .../v3-hey-api-client-axios-bundle/types.gen.ts.snap | 3 +++ .../v3-hey-api-client-axios-class/types.gen.ts.snap | 3 +++ .../types.gen.ts.snap | 3 +++ .../types.gen.ts.snap | 3 +++ .../types.gen.ts.snap | 3 +++ .../types.gen.ts.snap | 3 +++ .../test/generated/v3-hey-api-client-axios/types.gen.ts.snap | 3 +++ .../v3-hey-api-client-fetch-bundle/types.gen.ts.snap | 3 +++ .../v3-hey-api-client-fetch-class/types.gen.ts.snap | 3 +++ .../types.gen.ts.snap | 3 +++ .../types.gen.ts.snap | 3 +++ .../types.gen.ts.snap | 3 +++ .../types.gen.ts.snap | 3 +++ .../test/generated/v3-hey-api-client-fetch/types.gen.ts.snap | 3 +++ .../test/generated/v3-schemas-form/schemas.gen.ts.snap | 5 +++++ .../test/generated/v3-schemas-json/schemas.gen.ts.snap | 5 +++++ .../test/generated/v3-schemas-name/schemas.gen.ts.snap | 5 +++++ .../test/generated/v3-types-PascalCase/types.gen.ts.snap | 3 +++ .../test/__snapshots__/test/generated/v3/types.gen.ts.snap | 3 +++ .../test/generated/v3_angular/types.gen.ts.snap | 3 +++ .../generated/v3_angular_tree_shakeable/types.gen.ts.snap | 3 +++ .../__snapshots__/test/generated/v3_axios/types.gen.ts.snap | 3 +++ .../__snapshots__/test/generated/v3_client/types.gen.ts.snap | 3 +++ .../test/generated/v3_enums_typescript/types.gen.ts.snap | 3 +++ .../v3_enums_typescript_namespace/types.gen.ts.snap | 3 +++ .../__snapshots__/test/generated/v3_node/types.gen.ts.snap | 3 +++ .../test/generated/v3_services_filter/types.gen.ts.snap | 3 +++ .../test/generated/v3_services_name/types.gen.ts.snap | 3 +++ .../test/generated/v3_tree_shakeable/types.gen.ts.snap | 3 +++ .../__snapshots__/test/generated/v3_types/types.gen.ts.snap | 3 +++ .../test/generated/v3_types_no_tree/types.gen.ts.snap | 3 +++ .../__snapshots__/test/generated/v3_xhr/types.gen.ts.snap | 3 +++ packages/openapi-ts/test/spec/v3.json | 5 +++++ 35 files changed, 115 insertions(+), 1 deletion(-) create mode 100644 .changeset/grumpy-carrots-fix.md diff --git a/.changeset/grumpy-carrots-fix.md b/.changeset/grumpy-carrots-fix.md new file mode 100644 index 000000000..f9f38083a --- /dev/null +++ b/.changeset/grumpy-carrots-fix.md @@ -0,0 +1,5 @@ +--- +'@hey-api/openapi-ts': patch +--- + +fix: handle named object property with no nested properties diff --git a/packages/openapi-ts/src/openApi/v3/parser/getModel.ts b/packages/openapi-ts/src/openApi/v3/parser/getModel.ts index 6a0a13c2e..5689222e5 100644 --- a/packages/openapi-ts/src/openApi/v3/parser/getModel.ts +++ b/packages/openapi-ts/src/openApi/v3/parser/getModel.ts @@ -272,7 +272,9 @@ export const getModel = ({ model.type === 'unknown' ) { model.export = 'dictionary'; - model.name = '[key: string]'; + if (!model.name) { + model.name = '[key: string]'; + } } return model; diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle/types.gen.ts.snap index 751050669..c0c16d891 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle/types.gen.ts.snap @@ -1068,6 +1068,9 @@ export type Generic_Schema_Duplicate_Issue_1_System_Boolean_ = { item?: boolean; error?: (string) | null; readonly hasError?: boolean; + data?: { + [key: string]: unknown; + }; }; export type Generic_Schema_Duplicate_Issue_1_System_String_ = { diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-class/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-class/types.gen.ts.snap index 212fea1e3..54a74d0ff 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-class/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-class/types.gen.ts.snap @@ -1068,6 +1068,9 @@ export type Generic_Schema_Duplicate_Issue_1_System_Boolean_ = { item?: boolean; error?: (string) | null; readonly hasError?: boolean; + data?: { + [key: string]: unknown; + }; }; export type Generic_Schema_Duplicate_Issue_1_System_String_ = { diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-react-query/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-react-query/types.gen.ts.snap index 751050669..c0c16d891 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-react-query/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-react-query/types.gen.ts.snap @@ -1068,6 +1068,9 @@ export type Generic_Schema_Duplicate_Issue_1_System_Boolean_ = { item?: boolean; error?: (string) | null; readonly hasError?: boolean; + data?: { + [key: string]: unknown; + }; }; export type Generic_Schema_Duplicate_Issue_1_System_String_ = { diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-solid-query/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-solid-query/types.gen.ts.snap index 751050669..c0c16d891 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-solid-query/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-solid-query/types.gen.ts.snap @@ -1068,6 +1068,9 @@ export type Generic_Schema_Duplicate_Issue_1_System_Boolean_ = { item?: boolean; error?: (string) | null; readonly hasError?: boolean; + data?: { + [key: string]: unknown; + }; }; export type Generic_Schema_Duplicate_Issue_1_System_String_ = { diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-svelte-query/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-svelte-query/types.gen.ts.snap index 751050669..c0c16d891 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-svelte-query/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-svelte-query/types.gen.ts.snap @@ -1068,6 +1068,9 @@ export type Generic_Schema_Duplicate_Issue_1_System_Boolean_ = { item?: boolean; error?: (string) | null; readonly hasError?: boolean; + data?: { + [key: string]: unknown; + }; }; export type Generic_Schema_Duplicate_Issue_1_System_String_ = { diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-vue-query/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-vue-query/types.gen.ts.snap index 751050669..c0c16d891 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-vue-query/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-vue-query/types.gen.ts.snap @@ -1068,6 +1068,9 @@ export type Generic_Schema_Duplicate_Issue_1_System_Boolean_ = { item?: boolean; error?: (string) | null; readonly hasError?: boolean; + data?: { + [key: string]: unknown; + }; }; export type Generic_Schema_Duplicate_Issue_1_System_String_ = { diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios/types.gen.ts.snap index 751050669..c0c16d891 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios/types.gen.ts.snap @@ -1068,6 +1068,9 @@ export type Generic_Schema_Duplicate_Issue_1_System_Boolean_ = { item?: boolean; error?: (string) | null; readonly hasError?: boolean; + data?: { + [key: string]: unknown; + }; }; export type Generic_Schema_Duplicate_Issue_1_System_String_ = { diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle/types.gen.ts.snap index 751050669..c0c16d891 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle/types.gen.ts.snap @@ -1068,6 +1068,9 @@ export type Generic_Schema_Duplicate_Issue_1_System_Boolean_ = { item?: boolean; error?: (string) | null; readonly hasError?: boolean; + data?: { + [key: string]: unknown; + }; }; export type Generic_Schema_Duplicate_Issue_1_System_String_ = { diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-class/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-class/types.gen.ts.snap index 212fea1e3..54a74d0ff 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-class/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-class/types.gen.ts.snap @@ -1068,6 +1068,9 @@ export type Generic_Schema_Duplicate_Issue_1_System_Boolean_ = { item?: boolean; error?: (string) | null; readonly hasError?: boolean; + data?: { + [key: string]: unknown; + }; }; export type Generic_Schema_Duplicate_Issue_1_System_String_ = { diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-react-query/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-react-query/types.gen.ts.snap index 751050669..c0c16d891 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-react-query/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-react-query/types.gen.ts.snap @@ -1068,6 +1068,9 @@ export type Generic_Schema_Duplicate_Issue_1_System_Boolean_ = { item?: boolean; error?: (string) | null; readonly hasError?: boolean; + data?: { + [key: string]: unknown; + }; }; export type Generic_Schema_Duplicate_Issue_1_System_String_ = { diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-solid-query/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-solid-query/types.gen.ts.snap index 751050669..c0c16d891 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-solid-query/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-solid-query/types.gen.ts.snap @@ -1068,6 +1068,9 @@ export type Generic_Schema_Duplicate_Issue_1_System_Boolean_ = { item?: boolean; error?: (string) | null; readonly hasError?: boolean; + data?: { + [key: string]: unknown; + }; }; export type Generic_Schema_Duplicate_Issue_1_System_String_ = { diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-svelte-query/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-svelte-query/types.gen.ts.snap index 751050669..c0c16d891 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-svelte-query/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-svelte-query/types.gen.ts.snap @@ -1068,6 +1068,9 @@ export type Generic_Schema_Duplicate_Issue_1_System_Boolean_ = { item?: boolean; error?: (string) | null; readonly hasError?: boolean; + data?: { + [key: string]: unknown; + }; }; export type Generic_Schema_Duplicate_Issue_1_System_String_ = { diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-vue-query/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-vue-query/types.gen.ts.snap index 751050669..c0c16d891 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-vue-query/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-vue-query/types.gen.ts.snap @@ -1068,6 +1068,9 @@ export type Generic_Schema_Duplicate_Issue_1_System_Boolean_ = { item?: boolean; error?: (string) | null; readonly hasError?: boolean; + data?: { + [key: string]: unknown; + }; }; export type Generic_Schema_Duplicate_Issue_1_System_String_ = { diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch/types.gen.ts.snap index 751050669..c0c16d891 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch/types.gen.ts.snap @@ -1068,6 +1068,9 @@ export type Generic_Schema_Duplicate_Issue_1_System_Boolean_ = { item?: boolean; error?: (string) | null; readonly hasError?: boolean; + data?: { + [key: string]: unknown; + }; }; export type Generic_Schema_Duplicate_Issue_1_System_String_ = { diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-schemas-form/schemas.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-schemas-form/schemas.gen.ts.snap index d7d82cf40..e9610d75e 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-schemas-form/schemas.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-schemas-form/schemas.gen.ts.snap @@ -1805,6 +1805,11 @@ export const Generic_Schema_Duplicate_Issue_1_System_Boolean_Schema = { hasError: { type: 'boolean', readOnly: true + }, + data: { + type: 'object', + properties: {}, + additionalProperties: false } }, additionalProperties: false diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-schemas-json/schemas.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-schemas-json/schemas.gen.ts.snap index 206d85871..89c8c4582 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-schemas-json/schemas.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-schemas-json/schemas.gen.ts.snap @@ -1965,6 +1965,11 @@ export const Generic_Schema_Duplicate_Issue_1_System_Boolean_Schema = { hasError: { type: 'boolean', readOnly: true + }, + data: { + type: 'object', + properties: {}, + additionalProperties: false } }, additionalProperties: false diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-schemas-name/schemas.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-schemas-name/schemas.gen.ts.snap index d5f71370e..f485e9e8a 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-schemas-name/schemas.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-schemas-name/schemas.gen.ts.snap @@ -1965,6 +1965,11 @@ export const $Generic_Schema_Duplicate_Issue_1_System_Boolean_ = { hasError: { type: 'boolean', readOnly: true + }, + data: { + type: 'object', + properties: {}, + additionalProperties: false } }, additionalProperties: false diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-types-PascalCase/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-types-PascalCase/types.gen.ts.snap index 628d84898..1d2a9fd94 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-types-PascalCase/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-types-PascalCase/types.gen.ts.snap @@ -945,6 +945,9 @@ export type GenericSchemaDuplicateIssue_1_systemBoolean_ = { item?: boolean; error?: (string) | null; readonly hasError?: boolean; + data?: { + [key: string]: unknown; + }; }; export type GenericSchemaDuplicateIssue_1_systemString_ = { diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3/types.gen.ts.snap index db0347f69..3ee8b9c59 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3/types.gen.ts.snap @@ -1068,6 +1068,9 @@ export type Generic_Schema_Duplicate_Issue_1_System_Boolean_ = { item?: boolean; error?: (string) | null; readonly hasError?: boolean; + data?: { + [key: string]: unknown; + }; }; export type Generic_Schema_Duplicate_Issue_1_System_String_ = { diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_angular/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3_angular/types.gen.ts.snap index 5f3e1d0f2..a592de70c 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3_angular/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3_angular/types.gen.ts.snap @@ -945,6 +945,9 @@ export type Generic_Schema_Duplicate_Issue_1_System_Boolean_ = { item?: boolean; error?: (string) | null; readonly hasError?: boolean; + data?: { + [key: string]: unknown; + }; }; export type Generic_Schema_Duplicate_Issue_1_System_String_ = { diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_angular_tree_shakeable/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3_angular_tree_shakeable/types.gen.ts.snap index 8d30343ec..b0d083aa0 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3_angular_tree_shakeable/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3_angular_tree_shakeable/types.gen.ts.snap @@ -945,6 +945,9 @@ export type Generic_Schema_Duplicate_Issue_1_System_Boolean_ = { item?: boolean; error?: (string) | null; readonly hasError?: boolean; + data?: { + [key: string]: unknown; + }; }; export type Generic_Schema_Duplicate_Issue_1_System_String_ = { diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_axios/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3_axios/types.gen.ts.snap index db0347f69..3ee8b9c59 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3_axios/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3_axios/types.gen.ts.snap @@ -1068,6 +1068,9 @@ export type Generic_Schema_Duplicate_Issue_1_System_Boolean_ = { item?: boolean; error?: (string) | null; readonly hasError?: boolean; + data?: { + [key: string]: unknown; + }; }; export type Generic_Schema_Duplicate_Issue_1_System_String_ = { diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_client/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3_client/types.gen.ts.snap index 44a945db4..fb96a474e 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3_client/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3_client/types.gen.ts.snap @@ -945,6 +945,9 @@ export type Generic_Schema_Duplicate_Issue_1_System_Boolean_ = { item?: boolean; error?: (string) | null; readonly hasError?: boolean; + data?: { + [key: string]: unknown; + }; }; export type Generic_Schema_Duplicate_Issue_1_System_String_ = { diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_enums_typescript/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3_enums_typescript/types.gen.ts.snap index 796ce9beb..41444823e 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3_enums_typescript/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3_enums_typescript/types.gen.ts.snap @@ -1024,6 +1024,9 @@ export type Generic_Schema_Duplicate_Issue_1_System_Boolean_ = { item?: boolean; error?: (string) | null; readonly hasError?: boolean; + data?: { + [key: string]: unknown; + }; }; export type Generic_Schema_Duplicate_Issue_1_System_String_ = { diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_enums_typescript_namespace/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3_enums_typescript_namespace/types.gen.ts.snap index cfb3790dd..cdbdfd212 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3_enums_typescript_namespace/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3_enums_typescript_namespace/types.gen.ts.snap @@ -1055,6 +1055,9 @@ export type Generic_Schema_Duplicate_Issue_1_System_Boolean_ = { item?: boolean; error?: (string) | null; readonly hasError?: boolean; + data?: { + [key: string]: unknown; + }; }; export type Generic_Schema_Duplicate_Issue_1_System_String_ = { diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_node/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3_node/types.gen.ts.snap index db0347f69..3ee8b9c59 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3_node/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3_node/types.gen.ts.snap @@ -1068,6 +1068,9 @@ export type Generic_Schema_Duplicate_Issue_1_System_Boolean_ = { item?: boolean; error?: (string) | null; readonly hasError?: boolean; + data?: { + [key: string]: unknown; + }; }; export type Generic_Schema_Duplicate_Issue_1_System_String_ = { diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_services_filter/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3_services_filter/types.gen.ts.snap index 5d3809807..7a5218364 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3_services_filter/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3_services_filter/types.gen.ts.snap @@ -1068,6 +1068,9 @@ export type Generic_Schema_Duplicate_Issue_1_System_Boolean_ = { item?: boolean; error?: (string) | null; readonly hasError?: boolean; + data?: { + [key: string]: unknown; + }; }; export type Generic_Schema_Duplicate_Issue_1_System_String_ = { diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_services_name/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3_services_name/types.gen.ts.snap index 9ebbc4ff4..ee0b7d5a9 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3_services_name/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3_services_name/types.gen.ts.snap @@ -1068,6 +1068,9 @@ export type Generic_Schema_Duplicate_Issue_1_System_Boolean_ = { item?: boolean; error?: (string) | null; readonly hasError?: boolean; + data?: { + [key: string]: unknown; + }; }; export type Generic_Schema_Duplicate_Issue_1_System_String_ = { diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_tree_shakeable/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3_tree_shakeable/types.gen.ts.snap index 5cab937e5..e21543c65 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3_tree_shakeable/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3_tree_shakeable/types.gen.ts.snap @@ -1068,6 +1068,9 @@ export type Generic_Schema_Duplicate_Issue_1_System_Boolean_ = { item?: boolean; error?: (string) | null; readonly hasError?: boolean; + data?: { + [key: string]: unknown; + }; }; export type Generic_Schema_Duplicate_Issue_1_System_String_ = { diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_types/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3_types/types.gen.ts.snap index ff3345cd0..d81aff5bc 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3_types/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3_types/types.gen.ts.snap @@ -945,6 +945,9 @@ export type Generic_Schema_Duplicate_Issue_1_System_Boolean_ = { item?: boolean; error?: (string) | null; readonly hasError?: boolean; + data?: { + [key: string]: unknown; + }; }; export type Generic_Schema_Duplicate_Issue_1_System_String_ = { diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_types_no_tree/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3_types_no_tree/types.gen.ts.snap index e95ffd02a..a1687d672 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3_types_no_tree/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3_types_no_tree/types.gen.ts.snap @@ -945,6 +945,9 @@ export type Generic_Schema_Duplicate_Issue_1_System_Boolean_ = { item?: boolean; error?: (string) | null; readonly hasError?: boolean; + data?: { + [key: string]: unknown; + }; }; export type Generic_Schema_Duplicate_Issue_1_System_String_ = { diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_xhr/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3_xhr/types.gen.ts.snap index db0347f69..3ee8b9c59 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3_xhr/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3_xhr/types.gen.ts.snap @@ -1068,6 +1068,9 @@ export type Generic_Schema_Duplicate_Issue_1_System_Boolean_ = { item?: boolean; error?: (string) | null; readonly hasError?: boolean; + data?: { + [key: string]: unknown; + }; }; export type Generic_Schema_Duplicate_Issue_1_System_String_ = { diff --git a/packages/openapi-ts/test/spec/v3.json b/packages/openapi-ts/test/spec/v3.json index 85696a4cb..ec1b5c5be 100644 --- a/packages/openapi-ts/test/spec/v3.json +++ b/packages/openapi-ts/test/spec/v3.json @@ -3590,6 +3590,11 @@ "hasError": { "type": "boolean", "readOnly": true + }, + "data": { + "type": "object", + "properties": {}, + "additionalProperties": false } }, "additionalProperties": false -- 2.51.2 From a48be8660f6d1d84fdf25a3952587fb963482e8a Mon Sep 17 00:00:00 2001 From: Lubos Date: Thu, 19 Sep 2024 11:27:04 +0100 Subject: [PATCH 22/49] fix: export Operation interface --- .changeset/fast-cooks-buy.md | 5 +++++ packages/openapi-ts/src/node/index.ts | 2 ++ 2 files changed, 7 insertions(+) create mode 100644 .changeset/fast-cooks-buy.md diff --git a/.changeset/fast-cooks-buy.md b/.changeset/fast-cooks-buy.md new file mode 100644 index 000000000..81ee008b2 --- /dev/null +++ b/.changeset/fast-cooks-buy.md @@ -0,0 +1,5 @@ +--- +'@hey-api/openapi-ts': patch +--- + +fix: export Operation interface diff --git a/packages/openapi-ts/src/node/index.ts b/packages/openapi-ts/src/node/index.ts index b59ae1e31..dba118ff7 100644 --- a/packages/openapi-ts/src/node/index.ts +++ b/packages/openapi-ts/src/node/index.ts @@ -1,2 +1,4 @@ export { createClient, defineConfig } from '../'; +export type { Plugins } from '../plugins'; +export type { Operation } from '../types/client'; export type { UserConfig } from '../types/config'; -- 2.51.2 From 29dd672c4ecb3eb211d224391ee6449164007e3f Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 19 Sep 2024 10:37:06 +0000 Subject: [PATCH 23/49] Version Packages --- .changeset/chatty-deers-appear.md | 5 ----- .changeset/empty-cats-impress.md | 5 ----- .changeset/fast-cooks-buy.md | 5 ----- .changeset/fluffy-candles-perform.md | 6 ------ .changeset/good-clouds-guess.md | 6 ------ .changeset/grumpy-carrots-fix.md | 5 ----- .changeset/proud-rules-applaud.md | 5 ----- examples/openapi-ts-axios/CHANGELOG.md | 7 +++++++ examples/openapi-ts-axios/package.json | 2 +- examples/openapi-ts-fetch/CHANGELOG.md | 7 +++++++ examples/openapi-ts-fetch/package.json | 2 +- .../openapi-ts-tanstack-react-query/CHANGELOG.md | 7 +++++++ .../openapi-ts-tanstack-react-query/package.json | 2 +- .../openapi-ts-tanstack-svelte-query/CHANGELOG.md | 7 +++++++ .../openapi-ts-tanstack-svelte-query/package.json | 2 +- .../openapi-ts-tanstack-vue-query/CHANGELOG.md | 7 +++++++ .../openapi-ts-tanstack-vue-query/package.json | 2 +- packages/client-axios/CHANGELOG.md | 8 ++++++++ packages/client-axios/package.json | 2 +- packages/client-fetch/CHANGELOG.md | 8 ++++++++ packages/client-fetch/package.json | 2 +- packages/openapi-ts/CHANGELOG.md | 14 ++++++++++++++ packages/openapi-ts/package.json | 2 +- 23 files changed, 73 insertions(+), 45 deletions(-) delete mode 100644 .changeset/chatty-deers-appear.md delete mode 100644 .changeset/empty-cats-impress.md delete mode 100644 .changeset/fast-cooks-buy.md delete mode 100644 .changeset/fluffy-candles-perform.md delete mode 100644 .changeset/good-clouds-guess.md delete mode 100644 .changeset/grumpy-carrots-fix.md delete mode 100644 .changeset/proud-rules-applaud.md diff --git a/.changeset/chatty-deers-appear.md b/.changeset/chatty-deers-appear.md deleted file mode 100644 index fbfc5c64d..000000000 --- a/.changeset/chatty-deers-appear.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@hey-api/openapi-ts': patch ---- - -fix: handle colon in operation path diff --git a/.changeset/empty-cats-impress.md b/.changeset/empty-cats-impress.md deleted file mode 100644 index fe02e5045..000000000 --- a/.changeset/empty-cats-impress.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@hey-api/openapi-ts': patch ---- - -fix: allow overriding generated headers from options diff --git a/.changeset/fast-cooks-buy.md b/.changeset/fast-cooks-buy.md deleted file mode 100644 index 81ee008b2..000000000 --- a/.changeset/fast-cooks-buy.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@hey-api/openapi-ts': patch ---- - -fix: export Operation interface diff --git a/.changeset/fluffy-candles-perform.md b/.changeset/fluffy-candles-perform.md deleted file mode 100644 index f74b02d05..000000000 --- a/.changeset/fluffy-candles-perform.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -'@hey-api/client-axios': patch -'@hey-api/client-fetch': patch ---- - -fix: allow responseTransformer property with body and headers diff --git a/.changeset/good-clouds-guess.md b/.changeset/good-clouds-guess.md deleted file mode 100644 index 7818ab2ed..000000000 --- a/.changeset/good-clouds-guess.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -'@hey-api/client-axios': patch -'@hey-api/client-fetch': patch ---- - -fix: encode path params diff --git a/.changeset/grumpy-carrots-fix.md b/.changeset/grumpy-carrots-fix.md deleted file mode 100644 index f9f38083a..000000000 --- a/.changeset/grumpy-carrots-fix.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@hey-api/openapi-ts': patch ---- - -fix: handle named object property with no nested properties diff --git a/.changeset/proud-rules-applaud.md b/.changeset/proud-rules-applaud.md deleted file mode 100644 index 2af5a2895..000000000 --- a/.changeset/proud-rules-applaud.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@hey-api/openapi-ts': patch ---- - -fix: transform any-of nullable dates diff --git a/examples/openapi-ts-axios/CHANGELOG.md b/examples/openapi-ts-axios/CHANGELOG.md index f6795fa4b..3bd1d4135 100644 --- a/examples/openapi-ts-axios/CHANGELOG.md +++ b/examples/openapi-ts-axios/CHANGELOG.md @@ -1,5 +1,12 @@ # @example/openapi-ts-axios +## 0.0.8 + +### Patch Changes + +- Updated dependencies [[`7ae2b1d`](https://github.com/hey-api/openapi-ts/commit/7ae2b1db047f3b6efe917a8b43ac7c851fb86c8f), [`2079c6e`](https://github.com/hey-api/openapi-ts/commit/2079c6e83a6b71e157c8e7ea56260b4e9ff8411d)]: + - @hey-api/client-axios@0.2.4 + ## 0.0.7 ### Patch Changes diff --git a/examples/openapi-ts-axios/package.json b/examples/openapi-ts-axios/package.json index 8a80115df..f866d2db2 100644 --- a/examples/openapi-ts-axios/package.json +++ b/examples/openapi-ts-axios/package.json @@ -1,7 +1,7 @@ { "name": "@example/openapi-ts-axios", "private": true, - "version": "0.0.7", + "version": "0.0.8", "type": "module", "scripts": { "build": "tsc && vite build", diff --git a/examples/openapi-ts-fetch/CHANGELOG.md b/examples/openapi-ts-fetch/CHANGELOG.md index ff4bb90a5..6f7beb160 100644 --- a/examples/openapi-ts-fetch/CHANGELOG.md +++ b/examples/openapi-ts-fetch/CHANGELOG.md @@ -1,5 +1,12 @@ # @example/openapi-ts-fetch +## 0.0.23 + +### Patch Changes + +- Updated dependencies [[`7ae2b1d`](https://github.com/hey-api/openapi-ts/commit/7ae2b1db047f3b6efe917a8b43ac7c851fb86c8f), [`2079c6e`](https://github.com/hey-api/openapi-ts/commit/2079c6e83a6b71e157c8e7ea56260b4e9ff8411d)]: + - @hey-api/client-fetch@0.3.1 + ## 0.0.22 ### Patch Changes diff --git a/examples/openapi-ts-fetch/package.json b/examples/openapi-ts-fetch/package.json index 74f56525f..d629b4474 100644 --- a/examples/openapi-ts-fetch/package.json +++ b/examples/openapi-ts-fetch/package.json @@ -1,7 +1,7 @@ { "name": "@example/openapi-ts-fetch", "private": true, - "version": "0.0.22", + "version": "0.0.23", "type": "module", "scripts": { "build": "tsc && vite build", diff --git a/examples/openapi-ts-tanstack-react-query/CHANGELOG.md b/examples/openapi-ts-tanstack-react-query/CHANGELOG.md index e6747b20d..b92b74bff 100644 --- a/examples/openapi-ts-tanstack-react-query/CHANGELOG.md +++ b/examples/openapi-ts-tanstack-react-query/CHANGELOG.md @@ -1,5 +1,12 @@ # @example/openapi-ts-tanstack-react-query +## 0.0.5 + +### Patch Changes + +- Updated dependencies [[`7ae2b1d`](https://github.com/hey-api/openapi-ts/commit/7ae2b1db047f3b6efe917a8b43ac7c851fb86c8f), [`2079c6e`](https://github.com/hey-api/openapi-ts/commit/2079c6e83a6b71e157c8e7ea56260b4e9ff8411d)]: + - @hey-api/client-fetch@0.3.1 + ## 0.0.4 ### Patch Changes diff --git a/examples/openapi-ts-tanstack-react-query/package.json b/examples/openapi-ts-tanstack-react-query/package.json index 50ab6a1da..b5a66beeb 100644 --- a/examples/openapi-ts-tanstack-react-query/package.json +++ b/examples/openapi-ts-tanstack-react-query/package.json @@ -1,7 +1,7 @@ { "name": "@example/openapi-ts-tanstack-react-query", "private": true, - "version": "0.0.4", + "version": "0.0.5", "type": "module", "scripts": { "build": "tsc && vite build", diff --git a/examples/openapi-ts-tanstack-svelte-query/CHANGELOG.md b/examples/openapi-ts-tanstack-svelte-query/CHANGELOG.md index e96ff3fae..97c875c6f 100644 --- a/examples/openapi-ts-tanstack-svelte-query/CHANGELOG.md +++ b/examples/openapi-ts-tanstack-svelte-query/CHANGELOG.md @@ -1,5 +1,12 @@ # @example/openapi-ts-tanstack-svelte-query +## 0.0.5 + +### Patch Changes + +- Updated dependencies [[`7ae2b1d`](https://github.com/hey-api/openapi-ts/commit/7ae2b1db047f3b6efe917a8b43ac7c851fb86c8f), [`2079c6e`](https://github.com/hey-api/openapi-ts/commit/2079c6e83a6b71e157c8e7ea56260b4e9ff8411d)]: + - @hey-api/client-fetch@0.3.1 + ## 0.0.4 ### Patch Changes diff --git a/examples/openapi-ts-tanstack-svelte-query/package.json b/examples/openapi-ts-tanstack-svelte-query/package.json index 2a963b935..df5b25617 100644 --- a/examples/openapi-ts-tanstack-svelte-query/package.json +++ b/examples/openapi-ts-tanstack-svelte-query/package.json @@ -1,7 +1,7 @@ { "name": "@example/openapi-ts-tanstack-svelte-query", "private": true, - "version": "0.0.4", + "version": "0.0.5", "type": "module", "scripts": { "build": "vite build", diff --git a/examples/openapi-ts-tanstack-vue-query/CHANGELOG.md b/examples/openapi-ts-tanstack-vue-query/CHANGELOG.md index 285265765..7d64c3d6c 100644 --- a/examples/openapi-ts-tanstack-vue-query/CHANGELOG.md +++ b/examples/openapi-ts-tanstack-vue-query/CHANGELOG.md @@ -1,5 +1,12 @@ # @example/openapi-ts-tanstack-vue-query +## 0.0.5 + +### Patch Changes + +- Updated dependencies [[`7ae2b1d`](https://github.com/hey-api/openapi-ts/commit/7ae2b1db047f3b6efe917a8b43ac7c851fb86c8f), [`2079c6e`](https://github.com/hey-api/openapi-ts/commit/2079c6e83a6b71e157c8e7ea56260b4e9ff8411d)]: + - @hey-api/client-fetch@0.3.1 + ## 0.0.4 ### Patch Changes diff --git a/examples/openapi-ts-tanstack-vue-query/package.json b/examples/openapi-ts-tanstack-vue-query/package.json index e52cdd3b8..8e616b064 100644 --- a/examples/openapi-ts-tanstack-vue-query/package.json +++ b/examples/openapi-ts-tanstack-vue-query/package.json @@ -1,7 +1,7 @@ { "name": "@example/openapi-ts-tanstack-vue-query", "private": true, - "version": "0.0.4", + "version": "0.0.5", "type": "module", "scripts": { "build-only": "vite build", diff --git a/packages/client-axios/CHANGELOG.md b/packages/client-axios/CHANGELOG.md index 032e5a438..fa3f6a929 100644 --- a/packages/client-axios/CHANGELOG.md +++ b/packages/client-axios/CHANGELOG.md @@ -1,5 +1,13 @@ # @hey-api/client-axios +## 0.2.4 + +### Patch Changes + +- [#1057](https://github.com/hey-api/openapi-ts/pull/1057) [`7ae2b1d`](https://github.com/hey-api/openapi-ts/commit/7ae2b1db047f3b6efe917a8b43ac7c851fb86c8f) Thanks [@mrlubos](https://github.com/mrlubos)! - fix: allow responseTransformer property with body and headers + +- [#1064](https://github.com/hey-api/openapi-ts/pull/1064) [`2079c6e`](https://github.com/hey-api/openapi-ts/commit/2079c6e83a6b71e157c8e7ea56260b4e9ff8411d) Thanks [@mrlubos](https://github.com/mrlubos)! - fix: encode path params + ## 0.2.3 ### Patch Changes diff --git a/packages/client-axios/package.json b/packages/client-axios/package.json index d4b57284e..3d6202ed5 100644 --- a/packages/client-axios/package.json +++ b/packages/client-axios/package.json @@ -1,6 +1,6 @@ { "name": "@hey-api/client-axios", - "version": "0.2.3", + "version": "0.2.4", "type": "module", "description": "Type-safe Axios client for your @hey-api/openapi-ts types", "homepage": "https://heyapi.vercel.app/", diff --git a/packages/client-fetch/CHANGELOG.md b/packages/client-fetch/CHANGELOG.md index 08293ea7f..ddeb8be70 100644 --- a/packages/client-fetch/CHANGELOG.md +++ b/packages/client-fetch/CHANGELOG.md @@ -1,5 +1,13 @@ # @hey-api/client-fetch +## 0.3.1 + +### Patch Changes + +- [#1057](https://github.com/hey-api/openapi-ts/pull/1057) [`7ae2b1d`](https://github.com/hey-api/openapi-ts/commit/7ae2b1db047f3b6efe917a8b43ac7c851fb86c8f) Thanks [@mrlubos](https://github.com/mrlubos)! - fix: allow responseTransformer property with body and headers + +- [#1064](https://github.com/hey-api/openapi-ts/pull/1064) [`2079c6e`](https://github.com/hey-api/openapi-ts/commit/2079c6e83a6b71e157c8e7ea56260b4e9ff8411d) Thanks [@mrlubos](https://github.com/mrlubos)! - fix: encode path params + ## 0.3.0 ### Minor Changes diff --git a/packages/client-fetch/package.json b/packages/client-fetch/package.json index c63d0fe4d..fb90cde53 100644 --- a/packages/client-fetch/package.json +++ b/packages/client-fetch/package.json @@ -1,6 +1,6 @@ { "name": "@hey-api/client-fetch", - "version": "0.3.0", + "version": "0.3.1", "type": "module", "description": "Type-safe Fetch API client for your @hey-api/openapi-ts types", "homepage": "https://heyapi.vercel.app/", diff --git a/packages/openapi-ts/CHANGELOG.md b/packages/openapi-ts/CHANGELOG.md index db5569f0d..ae421accc 100644 --- a/packages/openapi-ts/CHANGELOG.md +++ b/packages/openapi-ts/CHANGELOG.md @@ -1,5 +1,19 @@ # @hey-api/openapi-ts +## 0.53.2 + +### Patch Changes + +- [#1060](https://github.com/hey-api/openapi-ts/pull/1060) [`8d66c08`](https://github.com/hey-api/openapi-ts/commit/8d66c085cf81e0e166c3e172ce319d5e2d4002bf) Thanks [@mrlubos](https://github.com/mrlubos)! - fix: handle colon in operation path + +- [#1065](https://github.com/hey-api/openapi-ts/pull/1065) [`a756987`](https://github.com/hey-api/openapi-ts/commit/a756987ad396fd7e68cc5eff63f6615bffef3782) Thanks [@mrlubos](https://github.com/mrlubos)! - fix: allow overriding generated headers from options + +- [#1068](https://github.com/hey-api/openapi-ts/pull/1068) [`a48be86`](https://github.com/hey-api/openapi-ts/commit/a48be8660f6d1d84fdf25a3952587fb963482e8a) Thanks [@mrlubos](https://github.com/mrlubos)! - fix: export Operation interface + +- [#1067](https://github.com/hey-api/openapi-ts/pull/1067) [`5a52da1`](https://github.com/hey-api/openapi-ts/commit/5a52da1425abef9f4fef58ef077dbd05545e25a2) Thanks [@mrlubos](https://github.com/mrlubos)! - fix: handle named object property with no nested properties + +- [#1066](https://github.com/hey-api/openapi-ts/pull/1066) [`e8a38ae`](https://github.com/hey-api/openapi-ts/commit/e8a38ae4e3f021a105d18764ef3252db7efa9aa0) Thanks [@mrlubos](https://github.com/mrlubos)! - fix: transform any-of nullable dates + ## 0.53.1 ### Patch Changes diff --git a/packages/openapi-ts/package.json b/packages/openapi-ts/package.json index b95b7ef48..2385cb152 100644 --- a/packages/openapi-ts/package.json +++ b/packages/openapi-ts/package.json @@ -1,6 +1,6 @@ { "name": "@hey-api/openapi-ts", - "version": "0.53.1", + "version": "0.53.2", "type": "module", "description": "Turn your OpenAPI specification into a beautiful TypeScript client", "homepage": "https://heyapi.vercel.app/", -- 2.51.2 From 11a276a1e35dde0735363e892d8142016fd87eec Mon Sep 17 00:00:00 2001 From: Lubos Date: Sun, 22 Sep 2024 01:07:07 +0100 Subject: [PATCH 24/49] fix: properly handle dual publishing and type generation --- .changeset/fifty-plums-battle.md | 5 + .changeset/giant-buckets-eat.md | 6 + .editorconfig | 11 +- eslint.config.js | 3 + package.json | 8 +- packages/client-axios/package.json | 27 +- packages/client-axios/rollup.config.ts | 67 -- packages/client-axios/rollup.dts.config.ts | 16 - packages/client-axios/src/index.ts | 8 + packages/client-axios/src/node/index.ts | 15 - packages/client-axios/src/node/tsconfig.json | 9 - packages/client-axios/tsconfig.check.json | 11 - packages/client-axios/tsconfig.json | 4 +- packages/client-axios/tsup.config.ts | 12 + packages/client-core/package.json | 8 - packages/client-core/rollup.config.ts | 67 -- packages/client-core/rollup.dts.config.ts | 16 - packages/client-core/tsconfig.check.json | 11 - packages/client-core/tsconfig.json | 2 +- packages/client-fetch/package.json | 27 +- packages/client-fetch/rollup.config.ts | 67 -- packages/client-fetch/rollup.dts.config.ts | 16 - packages/client-fetch/src/index.ts | 8 + packages/client-fetch/src/node/index.ts | 19 - packages/client-fetch/src/node/tsconfig.json | 9 - packages/client-fetch/tsconfig.check.json | 11 - packages/client-fetch/tsconfig.json | 4 +- packages/client-fetch/tsup.config.ts | 12 + packages/openapi-ts/.gitignore | 1 + packages/openapi-ts/bin/index.cjs | 4 +- packages/openapi-ts/package.json | 34 +- packages/openapi-ts/rollup.config.ts | 93 -- packages/openapi-ts/rollup.dts.config.ts | 16 - packages/openapi-ts/src/generate/client.ts | 39 +- packages/openapi-ts/src/generate/output.ts | 4 + packages/openapi-ts/src/index.ts | 52 +- .../src/legacy/handlebars/compiled/client.js | 457 +++++++ .../handlebars/compiled/core/ApiError.js | 7 + .../compiled/core/ApiRequestOptions.js | 7 + .../handlebars/compiled/core/ApiResult.js | 7 + .../compiled/core/BaseHttpRequest.js | 109 ++ .../compiled/core/CancelablePromise.js | 7 + .../handlebars/compiled/core/HttpRequest.js | 147 +++ .../handlebars/compiled/core/OpenAPI.js | 275 +++++ .../compiled/core/angular/getHeaders.js | 7 + .../compiled/core/angular/getRequestBody.js | 7 + .../compiled/core/angular/getResponseBody.js | 7 + .../core/angular/getResponseHeader.js | 7 + .../compiled/core/angular/request.js | 230 ++++ .../compiled/core/angular/sendRequest.js | 7 + .../compiled/core/axios/getHeaders.js | 7 + .../compiled/core/axios/getRequestBody.js | 7 + .../compiled/core/axios/getResponseBody.js | 7 + .../compiled/core/axios/getResponseHeader.js | 7 + .../handlebars/compiled/core/axios/request.js | 332 ++++++ .../compiled/core/axios/sendRequest.js | 7 + .../compiled/core/fetch/getHeaders.js | 7 + .../compiled/core/fetch/getRequestBody.js | 7 + .../compiled/core/fetch/getResponseBody.js | 7 + .../compiled/core/fetch/getResponseHeader.js | 7 + .../handlebars/compiled/core/fetch/request.js | 342 ++++++ .../compiled/core/fetch/sendRequest.js | 47 + .../compiled/core/functions/base64.js | 7 + .../core/functions/catchErrorCodes.js | 7 + .../compiled/core/functions/getFormData.js | 7 + .../compiled/core/functions/getQueryString.js | 7 + .../compiled/core/functions/getUrl.js | 7 + .../compiled/core/functions/isBlob.js | 7 + .../compiled/core/functions/isFormData.js | 7 + .../compiled/core/functions/isString.js | 7 + .../core/functions/isStringWithValue.js | 7 + .../compiled/core/functions/isSuccess.js | 7 + .../compiled/core/functions/resolve.js | 7 + .../handlebars/compiled/core/request.js | 225 ++++ .../compiled/core/xhr/getHeaders.js | 7 + .../compiled/core/xhr/getRequestBody.js | 7 + .../compiled/core/xhr/getResponseBody.js | 7 + .../compiled/core/xhr/getResponseHeader.js | 7 + .../handlebars/compiled/core/xhr/request.js | 332 ++++++ .../compiled/core/xhr/sendRequest.js | 7 + .../src/legacy/handlebars/handlebars.cjs | 79 ++ .../handlebars}/templates/client.hbs | 0 .../handlebars}/templates/core/ApiError.hbs | 0 .../templates/core/ApiRequestOptions.hbs | 0 .../handlebars}/templates/core/ApiResult.hbs | 0 .../templates/core/BaseHttpRequest.hbs | 0 .../templates/core/CancelablePromise.hbs | 0 .../templates/core/HttpRequest.hbs | 0 .../handlebars}/templates/core/OpenAPI.hbs | 0 .../templates/core/angular/getHeaders.hbs | 0 .../templates/core/angular/getRequestBody.hbs | 0 .../core/angular/getResponseBody.hbs | 0 .../core/angular/getResponseHeader.hbs | 0 .../templates/core/angular/request.hbs | 0 .../templates/core/angular/sendRequest.hbs | 0 .../templates/core/axios/getHeaders.hbs | 0 .../templates/core/axios/getRequestBody.hbs | 0 .../templates/core/axios/getResponseBody.hbs | 0 .../core/axios/getResponseHeader.hbs | 0 .../templates/core/axios/request.hbs | 0 .../templates/core/axios/sendRequest.hbs | 0 .../templates/core/fetch/getHeaders.hbs | 0 .../templates/core/fetch/getRequestBody.hbs | 0 .../templates/core/fetch/getResponseBody.hbs | 0 .../core/fetch/getResponseHeader.hbs | 0 .../templates/core/fetch/request.hbs | 0 .../templates/core/fetch/sendRequest.hbs | 0 .../templates/core/functions/base64.hbs | 0 .../core/functions/catchErrorCodes.hbs | 0 .../templates/core/functions/getFormData.hbs | 0 .../core/functions/getQueryString.hbs | 0 .../templates/core/functions/getUrl.hbs | 0 .../templates/core/functions/isBlob.hbs | 0 .../templates/core/functions/isFormData.hbs | 0 .../templates/core/functions/isString.hbs | 0 .../core/functions/isStringWithValue.hbs | 0 .../templates/core/functions/isSuccess.hbs | 0 .../templates/core/functions/resolve.hbs | 0 .../handlebars}/templates/core/request.hbs | 0 .../templates/core/xhr/getHeaders.hbs | 0 .../templates/core/xhr/getRequestBody.hbs | 0 .../templates/core/xhr/getResponseBody.hbs | 0 .../templates/core/xhr/getResponseHeader.hbs | 0 .../templates/core/xhr/request.hbs | 0 .../templates/core/xhr/sendRequest.hbs | 0 packages/openapi-ts/src/node/index.ts | 4 - packages/openapi-ts/src/node/tsconfig.json | 9 - packages/openapi-ts/src/types/config.ts | 1 + packages/openapi-ts/src/types/hbs.d.ts | 16 - packages/openapi-ts/src/utils/handlebars.ts | 134 ++- packages/openapi-ts/src/utils/performance.ts | 46 +- .../client.ts.snap | 15 - .../{core => client}/index.ts.snap | 8 + .../{core => client}/types.ts.snap | 0 .../{core => client}/utils.ts.snap | 0 .../client.ts.snap | 15 - .../{core => client}/index.ts.snap | 8 + .../{core => client}/types.ts.snap | 0 .../{core => client}/utils.ts.snap | 0 .../client.ts.snap | 19 - .../client}/index.ts.snap | 8 + .../{core => client}/types.ts.snap | 0 .../{core => client}/utils.ts.snap | 0 .../client.ts.snap | 19 - .../client}/index.ts.snap | 8 + .../{core => client}/types.ts.snap | 0 .../{core => client}/utils.ts.snap | 0 packages/openapi-ts/test/bin.spec.ts | 8 +- .../test/e2e/scripts/generateClient.ts | 2 +- packages/openapi-ts/test/index.spec.ts | 3 + packages/openapi-ts/test/sample.cjs | 6 +- packages/openapi-ts/tsconfig.check.json | 11 - packages/openapi-ts/tsconfig.json | 4 +- packages/openapi-ts/tsup.config.ts | 12 + packages/openapi-ts/vitest.config.e2e.ts | 4 +- packages/openapi-ts/vitest.config.unit.ts | 4 +- pnpm-lock.yaml | 1049 +++++++++++++---- 157 files changed, 4026 insertions(+), 922 deletions(-) create mode 100644 .changeset/fifty-plums-battle.md create mode 100644 .changeset/giant-buckets-eat.md delete mode 100644 packages/client-axios/rollup.config.ts delete mode 100644 packages/client-axios/rollup.dts.config.ts delete mode 100644 packages/client-axios/src/node/index.ts delete mode 100644 packages/client-axios/src/node/tsconfig.json delete mode 100644 packages/client-axios/tsconfig.check.json create mode 100644 packages/client-axios/tsup.config.ts delete mode 100644 packages/client-core/rollup.config.ts delete mode 100644 packages/client-core/rollup.dts.config.ts delete mode 100644 packages/client-core/tsconfig.check.json delete mode 100644 packages/client-fetch/rollup.config.ts delete mode 100644 packages/client-fetch/rollup.dts.config.ts delete mode 100644 packages/client-fetch/src/node/index.ts delete mode 100644 packages/client-fetch/src/node/tsconfig.json delete mode 100644 packages/client-fetch/tsconfig.check.json create mode 100644 packages/client-fetch/tsup.config.ts delete mode 100644 packages/openapi-ts/rollup.config.ts delete mode 100644 packages/openapi-ts/rollup.dts.config.ts create mode 100644 packages/openapi-ts/src/legacy/handlebars/compiled/client.js create mode 100644 packages/openapi-ts/src/legacy/handlebars/compiled/core/ApiError.js create mode 100644 packages/openapi-ts/src/legacy/handlebars/compiled/core/ApiRequestOptions.js create mode 100644 packages/openapi-ts/src/legacy/handlebars/compiled/core/ApiResult.js create mode 100644 packages/openapi-ts/src/legacy/handlebars/compiled/core/BaseHttpRequest.js create mode 100644 packages/openapi-ts/src/legacy/handlebars/compiled/core/CancelablePromise.js create mode 100644 packages/openapi-ts/src/legacy/handlebars/compiled/core/HttpRequest.js create mode 100644 packages/openapi-ts/src/legacy/handlebars/compiled/core/OpenAPI.js create mode 100644 packages/openapi-ts/src/legacy/handlebars/compiled/core/angular/getHeaders.js create mode 100644 packages/openapi-ts/src/legacy/handlebars/compiled/core/angular/getRequestBody.js create mode 100644 packages/openapi-ts/src/legacy/handlebars/compiled/core/angular/getResponseBody.js create mode 100644 packages/openapi-ts/src/legacy/handlebars/compiled/core/angular/getResponseHeader.js create mode 100644 packages/openapi-ts/src/legacy/handlebars/compiled/core/angular/request.js create mode 100644 packages/openapi-ts/src/legacy/handlebars/compiled/core/angular/sendRequest.js create mode 100644 packages/openapi-ts/src/legacy/handlebars/compiled/core/axios/getHeaders.js create mode 100644 packages/openapi-ts/src/legacy/handlebars/compiled/core/axios/getRequestBody.js create mode 100644 packages/openapi-ts/src/legacy/handlebars/compiled/core/axios/getResponseBody.js create mode 100644 packages/openapi-ts/src/legacy/handlebars/compiled/core/axios/getResponseHeader.js create mode 100644 packages/openapi-ts/src/legacy/handlebars/compiled/core/axios/request.js create mode 100644 packages/openapi-ts/src/legacy/handlebars/compiled/core/axios/sendRequest.js create mode 100644 packages/openapi-ts/src/legacy/handlebars/compiled/core/fetch/getHeaders.js create mode 100644 packages/openapi-ts/src/legacy/handlebars/compiled/core/fetch/getRequestBody.js create mode 100644 packages/openapi-ts/src/legacy/handlebars/compiled/core/fetch/getResponseBody.js create mode 100644 packages/openapi-ts/src/legacy/handlebars/compiled/core/fetch/getResponseHeader.js create mode 100644 packages/openapi-ts/src/legacy/handlebars/compiled/core/fetch/request.js create mode 100644 packages/openapi-ts/src/legacy/handlebars/compiled/core/fetch/sendRequest.js create mode 100644 packages/openapi-ts/src/legacy/handlebars/compiled/core/functions/base64.js create mode 100644 packages/openapi-ts/src/legacy/handlebars/compiled/core/functions/catchErrorCodes.js create mode 100644 packages/openapi-ts/src/legacy/handlebars/compiled/core/functions/getFormData.js create mode 100644 packages/openapi-ts/src/legacy/handlebars/compiled/core/functions/getQueryString.js create mode 100644 packages/openapi-ts/src/legacy/handlebars/compiled/core/functions/getUrl.js create mode 100644 packages/openapi-ts/src/legacy/handlebars/compiled/core/functions/isBlob.js create mode 100644 packages/openapi-ts/src/legacy/handlebars/compiled/core/functions/isFormData.js create mode 100644 packages/openapi-ts/src/legacy/handlebars/compiled/core/functions/isString.js create mode 100644 packages/openapi-ts/src/legacy/handlebars/compiled/core/functions/isStringWithValue.js create mode 100644 packages/openapi-ts/src/legacy/handlebars/compiled/core/functions/isSuccess.js create mode 100644 packages/openapi-ts/src/legacy/handlebars/compiled/core/functions/resolve.js create mode 100644 packages/openapi-ts/src/legacy/handlebars/compiled/core/request.js create mode 100644 packages/openapi-ts/src/legacy/handlebars/compiled/core/xhr/getHeaders.js create mode 100644 packages/openapi-ts/src/legacy/handlebars/compiled/core/xhr/getRequestBody.js create mode 100644 packages/openapi-ts/src/legacy/handlebars/compiled/core/xhr/getResponseBody.js create mode 100644 packages/openapi-ts/src/legacy/handlebars/compiled/core/xhr/getResponseHeader.js create mode 100644 packages/openapi-ts/src/legacy/handlebars/compiled/core/xhr/request.js create mode 100644 packages/openapi-ts/src/legacy/handlebars/compiled/core/xhr/sendRequest.js create mode 100644 packages/openapi-ts/src/legacy/handlebars/handlebars.cjs rename packages/openapi-ts/src/{ => legacy/handlebars}/templates/client.hbs (100%) rename packages/openapi-ts/src/{ => legacy/handlebars}/templates/core/ApiError.hbs (100%) rename packages/openapi-ts/src/{ => legacy/handlebars}/templates/core/ApiRequestOptions.hbs (100%) rename packages/openapi-ts/src/{ => legacy/handlebars}/templates/core/ApiResult.hbs (100%) rename packages/openapi-ts/src/{ => legacy/handlebars}/templates/core/BaseHttpRequest.hbs (100%) rename packages/openapi-ts/src/{ => legacy/handlebars}/templates/core/CancelablePromise.hbs (100%) rename packages/openapi-ts/src/{ => legacy/handlebars}/templates/core/HttpRequest.hbs (100%) rename packages/openapi-ts/src/{ => legacy/handlebars}/templates/core/OpenAPI.hbs (100%) rename packages/openapi-ts/src/{ => legacy/handlebars}/templates/core/angular/getHeaders.hbs (100%) rename packages/openapi-ts/src/{ => legacy/handlebars}/templates/core/angular/getRequestBody.hbs (100%) rename packages/openapi-ts/src/{ => legacy/handlebars}/templates/core/angular/getResponseBody.hbs (100%) rename packages/openapi-ts/src/{ => legacy/handlebars}/templates/core/angular/getResponseHeader.hbs (100%) rename packages/openapi-ts/src/{ => legacy/handlebars}/templates/core/angular/request.hbs (100%) rename packages/openapi-ts/src/{ => legacy/handlebars}/templates/core/angular/sendRequest.hbs (100%) rename packages/openapi-ts/src/{ => legacy/handlebars}/templates/core/axios/getHeaders.hbs (100%) rename packages/openapi-ts/src/{ => legacy/handlebars}/templates/core/axios/getRequestBody.hbs (100%) rename packages/openapi-ts/src/{ => legacy/handlebars}/templates/core/axios/getResponseBody.hbs (100%) rename packages/openapi-ts/src/{ => legacy/handlebars}/templates/core/axios/getResponseHeader.hbs (100%) rename packages/openapi-ts/src/{ => legacy/handlebars}/templates/core/axios/request.hbs (100%) rename packages/openapi-ts/src/{ => legacy/handlebars}/templates/core/axios/sendRequest.hbs (100%) rename packages/openapi-ts/src/{ => legacy/handlebars}/templates/core/fetch/getHeaders.hbs (100%) rename packages/openapi-ts/src/{ => legacy/handlebars}/templates/core/fetch/getRequestBody.hbs (100%) rename packages/openapi-ts/src/{ => legacy/handlebars}/templates/core/fetch/getResponseBody.hbs (100%) rename packages/openapi-ts/src/{ => legacy/handlebars}/templates/core/fetch/getResponseHeader.hbs (100%) rename packages/openapi-ts/src/{ => legacy/handlebars}/templates/core/fetch/request.hbs (100%) rename packages/openapi-ts/src/{ => legacy/handlebars}/templates/core/fetch/sendRequest.hbs (100%) rename packages/openapi-ts/src/{ => legacy/handlebars}/templates/core/functions/base64.hbs (100%) rename packages/openapi-ts/src/{ => legacy/handlebars}/templates/core/functions/catchErrorCodes.hbs (100%) rename packages/openapi-ts/src/{ => legacy/handlebars}/templates/core/functions/getFormData.hbs (100%) rename packages/openapi-ts/src/{ => legacy/handlebars}/templates/core/functions/getQueryString.hbs (100%) rename packages/openapi-ts/src/{ => legacy/handlebars}/templates/core/functions/getUrl.hbs (100%) rename packages/openapi-ts/src/{ => legacy/handlebars}/templates/core/functions/isBlob.hbs (100%) rename packages/openapi-ts/src/{ => legacy/handlebars}/templates/core/functions/isFormData.hbs (100%) rename packages/openapi-ts/src/{ => legacy/handlebars}/templates/core/functions/isString.hbs (100%) rename packages/openapi-ts/src/{ => legacy/handlebars}/templates/core/functions/isStringWithValue.hbs (100%) rename packages/openapi-ts/src/{ => legacy/handlebars}/templates/core/functions/isSuccess.hbs (100%) rename packages/openapi-ts/src/{ => legacy/handlebars}/templates/core/functions/resolve.hbs (100%) rename packages/openapi-ts/src/{ => legacy/handlebars}/templates/core/request.hbs (100%) rename packages/openapi-ts/src/{ => legacy/handlebars}/templates/core/xhr/getHeaders.hbs (100%) rename packages/openapi-ts/src/{ => legacy/handlebars}/templates/core/xhr/getRequestBody.hbs (100%) rename packages/openapi-ts/src/{ => legacy/handlebars}/templates/core/xhr/getResponseBody.hbs (100%) rename packages/openapi-ts/src/{ => legacy/handlebars}/templates/core/xhr/getResponseHeader.hbs (100%) rename packages/openapi-ts/src/{ => legacy/handlebars}/templates/core/xhr/request.hbs (100%) rename packages/openapi-ts/src/{ => legacy/handlebars}/templates/core/xhr/sendRequest.hbs (100%) delete mode 100644 packages/openapi-ts/src/node/index.ts delete mode 100644 packages/openapi-ts/src/node/tsconfig.json delete mode 100644 packages/openapi-ts/src/types/hbs.d.ts delete mode 100644 packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle/client.ts.snap rename packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle/{core => client}/index.ts.snap (93%) rename packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle/{core => client}/types.ts.snap (100%) rename packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle/{core => client}/utils.ts.snap (100%) delete mode 100644 packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle_transform/client.ts.snap rename packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle_transform/{core => client}/index.ts.snap (93%) rename packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle_transform/{core => client}/types.ts.snap (100%) rename packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle_transform/{core => client}/utils.ts.snap (100%) delete mode 100644 packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle/client.ts.snap rename packages/openapi-ts/test/__snapshots__/test/generated/{v3-hey-api-client-fetch-bundle_transform/core => v3-hey-api-client-fetch-bundle/client}/index.ts.snap (95%) rename packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle/{core => client}/types.ts.snap (100%) rename packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle/{core => client}/utils.ts.snap (100%) delete mode 100644 packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle_transform/client.ts.snap rename packages/openapi-ts/test/__snapshots__/test/generated/{v3-hey-api-client-fetch-bundle/core => v3-hey-api-client-fetch-bundle_transform/client}/index.ts.snap (95%) rename packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle_transform/{core => client}/types.ts.snap (100%) rename packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle_transform/{core => client}/utils.ts.snap (100%) delete mode 100644 packages/openapi-ts/tsconfig.check.json create mode 100644 packages/openapi-ts/tsup.config.ts diff --git a/.changeset/fifty-plums-battle.md b/.changeset/fifty-plums-battle.md new file mode 100644 index 000000000..04999ef23 --- /dev/null +++ b/.changeset/fifty-plums-battle.md @@ -0,0 +1,5 @@ +--- +'@hey-api/openapi-ts': patch +--- + +fix: properly handle dual publishing and type generation diff --git a/.changeset/giant-buckets-eat.md b/.changeset/giant-buckets-eat.md new file mode 100644 index 000000000..9aa705c24 --- /dev/null +++ b/.changeset/giant-buckets-eat.md @@ -0,0 +1,6 @@ +--- +'@hey-api/client-axios': patch +'@hey-api/client-fetch': patch +--- + +fix: properly handle dual publishing and type generation diff --git a/.editorconfig b/.editorconfig index 72f4cd61d..903a3b5f0 100755 --- a/.editorconfig +++ b/.editorconfig @@ -1,12 +1,13 @@ root = true [*] -end_of_line = lf charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true -indent_style = space +end_of_line = lf indent_size = 2 +indent_style = space +insert_final_newline = true +trim_trailing_whitespace = true [*.hbs] -indent_style = tab +indent_size = 2 +indent_style = space diff --git a/eslint.config.js b/eslint.config.js index e36c19669..2e8115f33 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -53,9 +53,12 @@ export default tseslint.config( configPrettier, { ignores: [ + '**/.tsup/', '**/dist/', '**/node_modules/', 'temp/', + 'packages/openapi-ts/src/legacy/handlebars/compiled/**/*.js', + 'packages/openapi-ts/src/legacy/handlebars/templates/**/*.hbs', '**/test/e2e/generated/', '**/test/generated/', '**/.svelte-kit/', diff --git a/package.json b/package.json index ea01e1ae5..fbfa582af 100644 --- a/package.json +++ b/package.json @@ -34,11 +34,9 @@ "node": "^18.0.0 || >=20.0.0" }, "devDependencies": { + "@arethetypeswrong/cli": "0.16.4", "@changesets/changelog-github": "0.5.0", "@changesets/cli": "2.27.7", - "@rollup/plugin-commonjs": "26.0.1", - "@rollup/plugin-terser": "0.4.4", - "@rollup/plugin-typescript": "11.1.6", "@types/node": "20.14.10", "@typescript-eslint/eslint-plugin": "7.15.0", "@vitest/coverage-v8": "1.6.0", @@ -52,9 +50,7 @@ "husky": "9.0.11", "lint-staged": "15.2.7", "prettier": "3.3.2", - "rimraf": "5.0.8", - "rollup": "4.18.0", - "rollup-plugin-dts": "6.1.1", + "tsup": "8.3.0", "typescript": "5.5.3", "typescript-eslint": "7.15.0", "vitest": "1.6.0" diff --git a/packages/client-axios/package.json b/packages/client-axios/package.json index 3d6202ed5..50ba3d1e2 100644 --- a/packages/client-axios/package.json +++ b/packages/client-axios/package.json @@ -1,7 +1,6 @@ { "name": "@hey-api/client-axios", "version": "0.2.4", - "type": "module", "description": "Type-safe Axios client for your @hey-api/openapi-ts types", "homepage": "https://heyapi.vercel.app/", "repository": { @@ -25,18 +24,19 @@ "typescript", "vue" ], - "types": "dist/node/index.d.ts", - "main": "dist/node/index.cjs", - "module": "dist/node/index.mjs", + "type": "module", + "main": "./dist/index.cjs", + "module": "./dist/index.js", + "types": "./dist/index.d.ts", "exports": { ".": { "import": { - "types": "./dist/node/index.d.ts", - "default": "./dist/node/index.mjs" + "types": "./dist/index.d.ts", + "default": "./dist/index.js" }, "require": { - "types": "./dist/node/index.d.ts", - "default": "./dist/node/index.cjs" + "types": "./dist/index.d.cts", + "default": "./dist/index.cjs" } }, "./package.json": "./package.json" @@ -48,14 +48,9 @@ "src" ], "scripts": { - "build-bundle": "rollup --config rollup.config.ts --configPlugin typescript", - "build-types-check": "tsc --project tsconfig.check.json", - "build-types-roll": "rollup --config rollup.dts.config.ts --configPlugin typescript && rimraf temp", - "build-types-temp": "tsc --emitDeclarationOnly --outDir temp -p src/node", - "build-types": "pnpm build-types-temp && pnpm build-types-roll && pnpm build-types-check", - "build": "pnpm clean && pnpm build-bundle && pnpm build-types", - "clean": "rimraf dist coverage node_modules/.cache", - "dev": "rimraf dist && pnpm build-bundle --watch", + "build": "tsup && pnpm check-exports", + "check-exports": "attw --pack .", + "dev": "tsup --watch", "prepublishOnly": "pnpm build", "test:coverage": "vitest run --coverage", "test:update": "vitest watch --update", diff --git a/packages/client-axios/rollup.config.ts b/packages/client-axios/rollup.config.ts deleted file mode 100644 index 579f86706..000000000 --- a/packages/client-axios/rollup.config.ts +++ /dev/null @@ -1,67 +0,0 @@ -import { readFileSync } from 'node:fs'; -import path from 'node:path'; -import { fileURLToPath } from 'node:url'; - -import commonjs from '@rollup/plugin-commonjs'; -import terser from '@rollup/plugin-terser'; -import typescript from '@rollup/plugin-typescript'; -import type { RollupOptions } from 'rollup'; -import { defineConfig } from 'rollup'; - -const __dirname = fileURLToPath(new URL('.', import.meta.url)); - -const pkg = JSON.parse( - readFileSync(new URL('./package.json', import.meta.url)).toString(), -); - -export const externalDependencies = [ - ...Object.keys(pkg.dependencies ?? {}), - ...Object.keys(pkg.peerDependencies ?? {}), -]; - -function createConfig(isProduction: boolean) { - return [ - defineConfig({ - external: externalDependencies, - input: path.resolve(__dirname, 'src/node/index.ts'), - output: { - file: path.resolve(__dirname, 'dist/node/index.cjs'), - format: 'cjs', - }, - plugins: [ - typescript({ - declaration: false, - tsconfig: path.resolve(__dirname, 'src/node/tsconfig.json'), - }), - commonjs({ - sourceMap: false, - }), - isProduction && terser(), - ], - }), - defineConfig({ - external: externalDependencies, - input: path.resolve(__dirname, 'src/node/index.ts'), - output: { - file: path.resolve(__dirname, 'dist/node/index.mjs'), - format: 'esm', - }, - plugins: [ - typescript({ - declaration: false, - tsconfig: path.resolve(__dirname, 'src/node/tsconfig.json'), - }), - commonjs({ - sourceMap: false, - }), - isProduction && terser(), - ], - }), - ]; -} - -export default (commandLineArgs: any): RollupOptions[] => { - const isDev = commandLineArgs.watch; - const isProduction = !isDev; - return defineConfig(createConfig(isProduction)); -}; diff --git a/packages/client-axios/rollup.dts.config.ts b/packages/client-axios/rollup.dts.config.ts deleted file mode 100644 index ebb285d54..000000000 --- a/packages/client-axios/rollup.dts.config.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { defineConfig } from 'rollup'; -import dts from 'rollup-plugin-dts'; - -import { externalDependencies } from './rollup.config'; - -export default defineConfig({ - external: externalDependencies, - input: { - index: './temp/node/index.d.ts', - }, - output: { - dir: './dist/node', - format: 'cjs', - }, - plugins: [dts({ respectExternal: true })], -}); diff --git a/packages/client-axios/src/index.ts b/packages/client-axios/src/index.ts index afe16e6a1..d0890ea39 100644 --- a/packages/client-axios/src/index.ts +++ b/packages/client-axios/src/index.ts @@ -84,3 +84,11 @@ export const createClient = (config: Config): Client => { setConfig, } as Client; }; + +export type { Config, Options } from './types'; +export { + createConfig, + formDataBodySerializer, + jsonBodySerializer, + urlSearchParamsBodySerializer, +} from './utils'; diff --git a/packages/client-axios/src/node/index.ts b/packages/client-axios/src/node/index.ts deleted file mode 100644 index f94d3c1d7..000000000 --- a/packages/client-axios/src/node/index.ts +++ /dev/null @@ -1,15 +0,0 @@ -export { createClient } from '../'; -export type { - Client, - Config, - Options, - RequestOptions, - RequestOptionsBase, - RequestResult, -} from '../types'; -export { - createConfig, - formDataBodySerializer, - jsonBodySerializer, - urlSearchParamsBodySerializer, -} from '../utils'; diff --git a/packages/client-axios/src/node/tsconfig.json b/packages/client-axios/src/node/tsconfig.json deleted file mode 100644 index 873575990..000000000 --- a/packages/client-axios/src/node/tsconfig.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "compilerOptions": { - "lib": ["ES2020", "DOM", "DOM.Iterable"], - "stripInternal": true - }, - "exclude": ["../**/__tests__"], - "extends": "../../tsconfig.base.json", - "include": ["../"] -} diff --git a/packages/client-axios/tsconfig.check.json b/packages/client-axios/tsconfig.check.json deleted file mode 100644 index 74f64f72a..000000000 --- a/packages/client-axios/tsconfig.check.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "compilerOptions": { - "exactOptionalPropertyTypes": true, - "module": "NodeNext", - "moduleResolution": "NodeNext", - "noEmit": true, - "strict": true, - "target": "ES2020" - }, - "include": ["dist/**/*"] -} diff --git a/packages/client-axios/tsconfig.json b/packages/client-axios/tsconfig.json index 2d6d90ad8..faaf0992f 100644 --- a/packages/client-axios/tsconfig.json +++ b/packages/client-axios/tsconfig.json @@ -3,7 +3,5 @@ "compilerOptions": { "declaration": false, "esModuleInterop": true - }, - "exclude": ["node_modules", "**/__mocks__"], - "include": ["./src/**/*.ts", "rollup.config.ts", "rollup.dts.config.ts"] + } } diff --git a/packages/client-axios/tsup.config.ts b/packages/client-axios/tsup.config.ts new file mode 100644 index 000000000..77dfaf864 --- /dev/null +++ b/packages/client-axios/tsup.config.ts @@ -0,0 +1,12 @@ +import { defineConfig } from 'tsup'; + +export default defineConfig((options) => ({ + clean: true, + dts: true, + entry: ['src/index.ts'], + format: ['cjs', 'esm'], + minify: !options.watch, + shims: false, + sourcemap: true, + treeshake: true, +})); diff --git a/packages/client-core/package.json b/packages/client-core/package.json index a205af833..d4840e9b5 100644 --- a/packages/client-core/package.json +++ b/packages/client-core/package.json @@ -19,14 +19,6 @@ "types": "./dist/node/index.d.ts" }, "scripts": { - "build-bundle": "rollup --config rollup.config.ts --configPlugin typescript", - "build-types-check": "tsc --project tsconfig.check.json", - "build-types-roll": "rollup --config rollup.dts.config.ts --configPlugin typescript && rimraf temp", - "build-types-temp": "tsc --emitDeclarationOnly --outDir temp -p src/node", - "build-types": "pnpm build-types-temp && pnpm build-types-roll && pnpm build-types-check", - "build": "pnpm clean && pnpm build-bundle && pnpm build-types", - "clean": "rimraf dist coverage node_modules/.cache", - "dev": "rimraf dist && pnpm build-bundle --watch", "prepublishOnly": "pnpm build", "test:coverage": "vitest run --coverage", "test:update": "vitest watch --update", diff --git a/packages/client-core/rollup.config.ts b/packages/client-core/rollup.config.ts deleted file mode 100644 index 579f86706..000000000 --- a/packages/client-core/rollup.config.ts +++ /dev/null @@ -1,67 +0,0 @@ -import { readFileSync } from 'node:fs'; -import path from 'node:path'; -import { fileURLToPath } from 'node:url'; - -import commonjs from '@rollup/plugin-commonjs'; -import terser from '@rollup/plugin-terser'; -import typescript from '@rollup/plugin-typescript'; -import type { RollupOptions } from 'rollup'; -import { defineConfig } from 'rollup'; - -const __dirname = fileURLToPath(new URL('.', import.meta.url)); - -const pkg = JSON.parse( - readFileSync(new URL('./package.json', import.meta.url)).toString(), -); - -export const externalDependencies = [ - ...Object.keys(pkg.dependencies ?? {}), - ...Object.keys(pkg.peerDependencies ?? {}), -]; - -function createConfig(isProduction: boolean) { - return [ - defineConfig({ - external: externalDependencies, - input: path.resolve(__dirname, 'src/node/index.ts'), - output: { - file: path.resolve(__dirname, 'dist/node/index.cjs'), - format: 'cjs', - }, - plugins: [ - typescript({ - declaration: false, - tsconfig: path.resolve(__dirname, 'src/node/tsconfig.json'), - }), - commonjs({ - sourceMap: false, - }), - isProduction && terser(), - ], - }), - defineConfig({ - external: externalDependencies, - input: path.resolve(__dirname, 'src/node/index.ts'), - output: { - file: path.resolve(__dirname, 'dist/node/index.mjs'), - format: 'esm', - }, - plugins: [ - typescript({ - declaration: false, - tsconfig: path.resolve(__dirname, 'src/node/tsconfig.json'), - }), - commonjs({ - sourceMap: false, - }), - isProduction && terser(), - ], - }), - ]; -} - -export default (commandLineArgs: any): RollupOptions[] => { - const isDev = commandLineArgs.watch; - const isProduction = !isDev; - return defineConfig(createConfig(isProduction)); -}; diff --git a/packages/client-core/rollup.dts.config.ts b/packages/client-core/rollup.dts.config.ts deleted file mode 100644 index ebb285d54..000000000 --- a/packages/client-core/rollup.dts.config.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { defineConfig } from 'rollup'; -import dts from 'rollup-plugin-dts'; - -import { externalDependencies } from './rollup.config'; - -export default defineConfig({ - external: externalDependencies, - input: { - index: './temp/node/index.d.ts', - }, - output: { - dir: './dist/node', - format: 'cjs', - }, - plugins: [dts({ respectExternal: true })], -}); diff --git a/packages/client-core/tsconfig.check.json b/packages/client-core/tsconfig.check.json deleted file mode 100644 index 74f64f72a..000000000 --- a/packages/client-core/tsconfig.check.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "compilerOptions": { - "exactOptionalPropertyTypes": true, - "module": "NodeNext", - "moduleResolution": "NodeNext", - "noEmit": true, - "strict": true, - "target": "ES2020" - }, - "include": ["dist/**/*"] -} diff --git a/packages/client-core/tsconfig.json b/packages/client-core/tsconfig.json index 2d6d90ad8..c2a684570 100644 --- a/packages/client-core/tsconfig.json +++ b/packages/client-core/tsconfig.json @@ -5,5 +5,5 @@ "esModuleInterop": true }, "exclude": ["node_modules", "**/__mocks__"], - "include": ["./src/**/*.ts", "rollup.config.ts", "rollup.dts.config.ts"] + "include": ["./src/**/*.ts"] } diff --git a/packages/client-fetch/package.json b/packages/client-fetch/package.json index fb90cde53..17634844c 100644 --- a/packages/client-fetch/package.json +++ b/packages/client-fetch/package.json @@ -1,7 +1,6 @@ { "name": "@hey-api/client-fetch", "version": "0.3.1", - "type": "module", "description": "Type-safe Fetch API client for your @hey-api/openapi-ts types", "homepage": "https://heyapi.vercel.app/", "repository": { @@ -25,18 +24,19 @@ "typescript", "vue" ], - "types": "dist/node/index.d.ts", - "main": "dist/node/index.cjs", - "module": "dist/node/index.mjs", + "type": "module", + "main": "./dist/index.cjs", + "module": "./dist/index.js", + "types": "./dist/index.d.ts", "exports": { ".": { "import": { - "types": "./dist/node/index.d.ts", - "default": "./dist/node/index.mjs" + "types": "./dist/index.d.ts", + "default": "./dist/index.js" }, "require": { - "types": "./dist/node/index.d.ts", - "default": "./dist/node/index.cjs" + "types": "./dist/index.d.cts", + "default": "./dist/index.cjs" } }, "./package.json": "./package.json" @@ -48,14 +48,9 @@ "src" ], "scripts": { - "build-bundle": "rollup --config rollup.config.ts --configPlugin typescript", - "build-types-check": "tsc --project tsconfig.check.json", - "build-types-roll": "rollup --config rollup.dts.config.ts --configPlugin typescript && rimraf temp", - "build-types-temp": "tsc --emitDeclarationOnly --outDir temp -p src/node", - "build-types": "pnpm build-types-temp && pnpm build-types-roll && pnpm build-types-check", - "build": "pnpm clean && pnpm build-bundle && pnpm build-types", - "clean": "rimraf dist coverage node_modules/.cache", - "dev": "rimraf dist && pnpm build-bundle --watch", + "build": "tsup && pnpm check-exports", + "check-exports": "attw --pack .", + "dev": "tsup --watch", "prepublishOnly": "pnpm build", "test:coverage": "vitest run --coverage", "test:update": "vitest watch --update", diff --git a/packages/client-fetch/rollup.config.ts b/packages/client-fetch/rollup.config.ts deleted file mode 100644 index 579f86706..000000000 --- a/packages/client-fetch/rollup.config.ts +++ /dev/null @@ -1,67 +0,0 @@ -import { readFileSync } from 'node:fs'; -import path from 'node:path'; -import { fileURLToPath } from 'node:url'; - -import commonjs from '@rollup/plugin-commonjs'; -import terser from '@rollup/plugin-terser'; -import typescript from '@rollup/plugin-typescript'; -import type { RollupOptions } from 'rollup'; -import { defineConfig } from 'rollup'; - -const __dirname = fileURLToPath(new URL('.', import.meta.url)); - -const pkg = JSON.parse( - readFileSync(new URL('./package.json', import.meta.url)).toString(), -); - -export const externalDependencies = [ - ...Object.keys(pkg.dependencies ?? {}), - ...Object.keys(pkg.peerDependencies ?? {}), -]; - -function createConfig(isProduction: boolean) { - return [ - defineConfig({ - external: externalDependencies, - input: path.resolve(__dirname, 'src/node/index.ts'), - output: { - file: path.resolve(__dirname, 'dist/node/index.cjs'), - format: 'cjs', - }, - plugins: [ - typescript({ - declaration: false, - tsconfig: path.resolve(__dirname, 'src/node/tsconfig.json'), - }), - commonjs({ - sourceMap: false, - }), - isProduction && terser(), - ], - }), - defineConfig({ - external: externalDependencies, - input: path.resolve(__dirname, 'src/node/index.ts'), - output: { - file: path.resolve(__dirname, 'dist/node/index.mjs'), - format: 'esm', - }, - plugins: [ - typescript({ - declaration: false, - tsconfig: path.resolve(__dirname, 'src/node/tsconfig.json'), - }), - commonjs({ - sourceMap: false, - }), - isProduction && terser(), - ], - }), - ]; -} - -export default (commandLineArgs: any): RollupOptions[] => { - const isDev = commandLineArgs.watch; - const isProduction = !isDev; - return defineConfig(createConfig(isProduction)); -}; diff --git a/packages/client-fetch/rollup.dts.config.ts b/packages/client-fetch/rollup.dts.config.ts deleted file mode 100644 index ebb285d54..000000000 --- a/packages/client-fetch/rollup.dts.config.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { defineConfig } from 'rollup'; -import dts from 'rollup-plugin-dts'; - -import { externalDependencies } from './rollup.config'; - -export default defineConfig({ - external: externalDependencies, - input: { - index: './temp/node/index.d.ts', - }, - output: { - dir: './dist/node', - format: 'cjs', - }, - plugins: [dts({ respectExternal: true })], -}); diff --git a/packages/client-fetch/src/index.ts b/packages/client-fetch/src/index.ts index ab5cd4a1f..46a8d73ad 100644 --- a/packages/client-fetch/src/index.ts +++ b/packages/client-fetch/src/index.ts @@ -144,3 +144,11 @@ export const createClient = (config: Config = {}): Client => { trace: (options) => request({ ...options, method: 'TRACE' }), }; }; + +export type { Config, Options } from './types'; +export { + createConfig, + formDataBodySerializer, + jsonBodySerializer, + urlSearchParamsBodySerializer, +} from './utils'; diff --git a/packages/client-fetch/src/node/index.ts b/packages/client-fetch/src/node/index.ts deleted file mode 100644 index a2b79943b..000000000 --- a/packages/client-fetch/src/node/index.ts +++ /dev/null @@ -1,19 +0,0 @@ -export { createClient } from '../'; -export type { - Client, - Config, - Options, - RequestOptions, - RequestOptionsBase, - RequestResult, -} from '../types'; -export { - type BodySerializer, - createConfig, - formDataBodySerializer, - jsonBodySerializer, - type Middleware, - type QuerySerializer, - type QuerySerializerOptions, - urlSearchParamsBodySerializer, -} from '../utils'; diff --git a/packages/client-fetch/src/node/tsconfig.json b/packages/client-fetch/src/node/tsconfig.json deleted file mode 100644 index 873575990..000000000 --- a/packages/client-fetch/src/node/tsconfig.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "compilerOptions": { - "lib": ["ES2020", "DOM", "DOM.Iterable"], - "stripInternal": true - }, - "exclude": ["../**/__tests__"], - "extends": "../../tsconfig.base.json", - "include": ["../"] -} diff --git a/packages/client-fetch/tsconfig.check.json b/packages/client-fetch/tsconfig.check.json deleted file mode 100644 index 74f64f72a..000000000 --- a/packages/client-fetch/tsconfig.check.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "compilerOptions": { - "exactOptionalPropertyTypes": true, - "module": "NodeNext", - "moduleResolution": "NodeNext", - "noEmit": true, - "strict": true, - "target": "ES2020" - }, - "include": ["dist/**/*"] -} diff --git a/packages/client-fetch/tsconfig.json b/packages/client-fetch/tsconfig.json index 2d6d90ad8..faaf0992f 100644 --- a/packages/client-fetch/tsconfig.json +++ b/packages/client-fetch/tsconfig.json @@ -3,7 +3,5 @@ "compilerOptions": { "declaration": false, "esModuleInterop": true - }, - "exclude": ["node_modules", "**/__mocks__"], - "include": ["./src/**/*.ts", "rollup.config.ts", "rollup.dts.config.ts"] + } } diff --git a/packages/client-fetch/tsup.config.ts b/packages/client-fetch/tsup.config.ts new file mode 100644 index 000000000..77dfaf864 --- /dev/null +++ b/packages/client-fetch/tsup.config.ts @@ -0,0 +1,12 @@ +import { defineConfig } from 'tsup'; + +export default defineConfig((options) => ({ + clean: true, + dts: true, + entry: ['src/index.ts'], + format: ['cjs', 'esm'], + minify: !options.watch, + shims: false, + sourcemap: true, + treeshake: true, +})); diff --git a/packages/openapi-ts/.gitignore b/packages/openapi-ts/.gitignore index 4bde635cb..3d31689e4 100644 --- a/packages/openapi-ts/.gitignore +++ b/packages/openapi-ts/.gitignore @@ -1,5 +1,6 @@ .DS_Store .idea +.tsup .tmp junit.xml node_modules diff --git a/packages/openapi-ts/bin/index.cjs b/packages/openapi-ts/bin/index.cjs index b4aa49be8..4df67d2cb 100755 --- a/packages/openapi-ts/bin/index.cjs +++ b/packages/openapi-ts/bin/index.cjs @@ -66,9 +66,7 @@ const processParams = (obj, booleanKeys) => { async function start() { let userConfig; try { - const { createClient } = require( - resolve(__dirname, '../dist/node/index.cjs'), - ); + const { createClient } = require(resolve(__dirname, '../dist/index.cjs')); userConfig = processParams(params, [ 'dryRun', 'exportCore', diff --git a/packages/openapi-ts/package.json b/packages/openapi-ts/package.json index 2385cb152..280205549 100644 --- a/packages/openapi-ts/package.json +++ b/packages/openapi-ts/package.json @@ -1,7 +1,6 @@ { "name": "@hey-api/openapi-ts", "version": "0.53.2", - "type": "module", "description": "Turn your OpenAPI specification into a beautiful TypeScript client", "homepage": "https://heyapi.vercel.app/", "repository": { @@ -29,8 +28,23 @@ "xhr", "yaml" ], - "main": "./dist/node/index.cjs", - "types": "./dist/node/index.d.ts", + "type": "module", + "main": "./dist/index.cjs", + "module": "./dist/index.js", + "types": "./dist/index.d.ts", + "exports": { + ".": { + "import": { + "types": "./dist/index.d.ts", + "default": "./dist/index.js" + }, + "require": { + "types": "./dist/index.d.cts", + "default": "./dist/index.cjs" + } + }, + "./package.json": "./package.json" + }, "bin": { "openapi-ts": "bin/index.cjs" }, @@ -40,14 +54,10 @@ "LICENSE.md" ], "scripts": { - "build-bundle": "rollup --config rollup.config.ts --configPlugin typescript", - "build-types-check": "tsc --project tsconfig.check.json", - "build-types-roll": "rollup --config rollup.dts.config.ts --configPlugin typescript && rimraf temp", - "build-types-temp": "tsc --emitDeclarationOnly --outDir temp -p src/node", - "build-types": "pnpm build-types-temp && pnpm build-types-roll && pnpm build-types-check", - "build": "pnpm clean && pnpm build-bundle && pnpm build-types", - "clean": "rimraf dist test/generated test/e2e/generated coverage node_modules/.cache", - "dev": "rimraf dist && pnpm build-bundle --watch", + "build": "tsup && pnpm check-exports", + "check-exports": "attw --pack .", + "dev": "tsup --watch", + "handlebars": "node src/legacy/handlebars/handlebars.cjs", "prepublishOnly": "pnpm build", "test:coverage": "vitest run --config vitest.config.unit.ts --coverage", "test:e2e": "vitest run --config vitest.config.e2e.ts", @@ -83,8 +93,6 @@ "@angular/router": "17.3.9", "@hey-api/client-axios": "workspace:*", "@hey-api/client-fetch": "workspace:*", - "@rollup/plugin-json": "6.1.0", - "@rollup/plugin-node-resolve": "15.2.3", "@tanstack/react-query": "5.56.2", "@tanstack/solid-query": "5.51.21", "@tanstack/svelte-query": "5.56.2", diff --git a/packages/openapi-ts/rollup.config.ts b/packages/openapi-ts/rollup.config.ts deleted file mode 100644 index 5989e110c..000000000 --- a/packages/openapi-ts/rollup.config.ts +++ /dev/null @@ -1,93 +0,0 @@ -import { readFileSync } from 'node:fs'; -import path from 'node:path'; -import { fileURLToPath } from 'node:url'; - -import commonjs from '@rollup/plugin-commonjs'; -import json from '@rollup/plugin-json'; -import { nodeResolve } from '@rollup/plugin-node-resolve'; -import terser from '@rollup/plugin-terser'; -import typescript from '@rollup/plugin-typescript'; -import handlebars from 'handlebars'; -import type { Plugin, RollupOptions } from 'rollup'; -import { defineConfig } from 'rollup'; - -/** - * Custom plugin to parse handlebar imports and precompile - * the template on the fly. This reduces runtime by about - * half on large projects. - */ -export function handlebarsPlugin(): Plugin { - return { - load: (file: any) => { - if (path.extname(file) === '.hbs') { - const template = readFileSync(file, 'utf8').toString().trim(); - const templateSpec = handlebars.precompile(template, { - knownHelpers: { - camelCase: true, - equals: true, - ifdef: true, - notEquals: true, - transformServiceName: true, - }, - knownHelpersOnly: true, - noEscape: true, - preventIndent: true, - strict: true, - }); - return `export default ${templateSpec};`; - } - return null; - }, - name: 'handlebars', - resolveId: (file: any, importer: any) => { - if (path.extname(file) === '.hbs') { - return path.resolve(path.dirname(importer), file); - } - return null; - }, - }; -} - -const __dirname = fileURLToPath(new URL('.', import.meta.url)); - -const pkg = JSON.parse( - readFileSync(new URL('./package.json', import.meta.url)).toString(), -); - -// ESM only dependencies are not treated as external so that we can fully support CommonJS and ESM -const esmDependencies = ['camelcase']; - -export const externalDependencies = [ - ...Object.keys(pkg.dependencies ?? {}), - ...Object.keys(pkg.peerDependencies ?? {}), -].filter((dependency) => !esmDependencies.includes(dependency)); - -function createConfig(isProduction: boolean) { - return defineConfig({ - external: externalDependencies, - input: path.resolve(__dirname, 'src/node/index.ts'), - output: { - file: path.resolve(__dirname, 'dist/node/index.cjs'), - format: 'cjs', - }, - plugins: [ - nodeResolve({ preferBuiltins: true }), - typescript({ - declaration: false, - tsconfig: path.resolve(__dirname, 'src/node/tsconfig.json'), - }), - commonjs({ - sourceMap: false, - }), - json(), - handlebarsPlugin(), - isProduction && terser(), - ], - }); -} - -export default (commandLineArgs: any): RollupOptions[] => { - const isDev = commandLineArgs.watch; - const isProduction = !isDev; - return defineConfig([createConfig(isProduction)]); -}; diff --git a/packages/openapi-ts/rollup.dts.config.ts b/packages/openapi-ts/rollup.dts.config.ts deleted file mode 100644 index ebb285d54..000000000 --- a/packages/openapi-ts/rollup.dts.config.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { defineConfig } from 'rollup'; -import dts from 'rollup-plugin-dts'; - -import { externalDependencies } from './rollup.config'; - -export default defineConfig({ - external: externalDependencies, - input: { - index: './temp/node/index.d.ts', - }, - output: { - dir: './dist/node', - format: 'cjs', - }, - plugins: [dts({ respectExternal: true })], -}); diff --git a/packages/openapi-ts/src/generate/client.ts b/packages/openapi-ts/src/generate/client.ts index 720d8b4f5..a818ad7f7 100644 --- a/packages/openapi-ts/src/generate/client.ts +++ b/packages/openapi-ts/src/generate/client.ts @@ -1,11 +1,31 @@ -import { copyFileSync, readFileSync, writeFileSync } from 'node:fs'; -import { createRequire } from 'node:module'; +import { copyFileSync } from 'node:fs'; import path from 'node:path'; import { getConfig, isStandaloneClient } from '../utils/config'; import { ensureDirSync } from './utils'; -const require = createRequire(import.meta.url); +const isESM = () => { + try { + return typeof import.meta.url === 'string'; + } catch (error) { + return false; + } +}; + +const getRequire = async (): Promise => { + try { + if (isESM()) { + const module: any = await import('node:module'); + const createRequire: (path: string | URL) => NodeRequire = + module.createRequire; + return createRequire(import.meta.url); + } + + return module.require; + } catch (error) { + return module.require; + } +}; export const clientModulePath = () => { const config = getConfig(); @@ -16,7 +36,7 @@ export const clientOptionsTypeName = () => 'Options'; /** * (optional) Creates a `client.ts` file containing the same exports as a - * standalone client package. Creates a `core` directory containing the modules + * standalone client package. Creates a `client` directory containing the modules * from standalone client. These files are generated only when `client.bundle` * is set to true. */ @@ -31,9 +51,10 @@ export const generateClient = async ( } // create directory for client modules - const dirPath = path.resolve(outputPath, 'core'); + const dirPath = path.resolve(outputPath, 'client'); ensureDirSync(dirPath); + const require = await getRequire(); const clientModulePath = path.normalize(require.resolve(moduleName)); const clientModulePathComponents = clientModulePath.split(path.sep); const clientSrcPath = [ @@ -52,12 +73,4 @@ export const generateClient = async ( path.resolve(dirPath, file), ); }); - - // copy index file with cherry-picked exports - const nodeIndexFile = readFileSync( - path.resolve(clientSrcPath, 'node', 'index.ts'), - 'utf-8', - ); - const indexFile = nodeIndexFile.replaceAll('../', './core/'); - writeFileSync(path.resolve(outputPath, 'client.ts'), indexFile, 'utf-8'); }; diff --git a/packages/openapi-ts/src/generate/output.ts b/packages/openapi-ts/src/generate/output.ts index ea08d814d..aa34b8534 100644 --- a/packages/openapi-ts/src/generate/output.ts +++ b/packages/openapi-ts/src/generate/output.ts @@ -88,6 +88,10 @@ export const generateOutput = async ( await generatePlugins({ client, files }); Object.entries(files).forEach(([name, file]) => { + if (config.dryRun) { + return; + } + if (name === 'index') { file.write(); } else { diff --git a/packages/openapi-ts/src/index.ts b/packages/openapi-ts/src/index.ts index 23ee28dd1..85a8c7334 100644 --- a/packages/openapi-ts/src/index.ts +++ b/packages/openapi-ts/src/index.ts @@ -18,7 +18,7 @@ import { operationParameterFilterFn, operationParameterNameFn, } from './utils/parse'; -import { Performance } from './utils/performance'; +import { Performance, PerformanceReport } from './utils/performance'; import { postProcessClient } from './utils/postprocess'; type OutputProcessor = { @@ -112,7 +112,7 @@ const getClient = (userConfig: ClientConfig): Config['client'] => { }; if (typeof userConfig.client === 'string') { client.name = userConfig.client; - } else { + } else if (userConfig.client) { client = { ...client, ...userConfig.client, @@ -269,7 +269,7 @@ const initConfigs = async (userConfig: UserConfig): Promise => { const client = getClient(userConfig); - if (!CLIENTS.includes(client.name)) { + if (client.name && !CLIENTS.includes(client.name)) { throw new Error('🚫 invalid client - select a valid client value'); } @@ -286,7 +286,7 @@ const initConfigs = async (userConfig: UserConfig): Promise => { output.path = path.resolve(process.cwd(), output.path); - return setConfig({ + const config = setConfig({ base, client, configFile, @@ -305,6 +305,12 @@ const initConfigs = async (userConfig: UserConfig): Promise => { types, useOptions, }); + + if (debug) { + console.warn('config:', config); + } + + return config; }); }; @@ -319,17 +325,23 @@ export async function createClient( ): Promise> { Performance.start('createClient'); + Performance.start('config'); const configs = await initConfigs(userConfig); + Performance.end('config'); + Performance.start('handlebars'); const templates = registerHandlebarTemplates(); + Performance.end('handlebars'); const pCreateClient = (config: Config) => async () => { + Performance.start('openapi'); const openApi = typeof config.input === 'string' ? await getOpenApiSpec(config.input) : (config.input as unknown as Awaited< ReturnType >); + Performance.end('openapi'); if (config.experimental_parser) { Performance.start('experimental_parser'); @@ -355,13 +367,19 @@ export async function createClient( const client = postProcessClient(parsed); Performance.end('parser'); + logClientMessage(); + + Performance.start('generator'); + await generateOutput(openApi, client, templates); + Performance.end('generator'); + + Performance.start('postprocess'); if (!config.dryRun) { - logClientMessage(); - await generateOutput(openApi, client, templates); processOutput(); - } - console.log('✨ Done! Your client is located in:', config.output.path); + console.log('✨ Done! Your client is located in:', config.output.path); + } + Performance.end('postprocess'); return client; } @@ -379,6 +397,22 @@ export async function createClient( Performance.end('createClient'); + if (userConfig.debug) { + const perfReport = new PerformanceReport({ + totalMark: 'createClient', + }); + perfReport.report({ + marks: [ + 'config', + 'openapi', + 'handlebars', + 'parser', + 'generator', + 'postprocess', + ], + }); + } + return clients; } @@ -391,3 +425,5 @@ export default { createClient, defineConfig, }; + +export type { UserConfig } from './types/config'; diff --git a/packages/openapi-ts/src/legacy/handlebars/compiled/client.js b/packages/openapi-ts/src/legacy/handlebars/compiled/client.js new file mode 100644 index 000000000..edf1d2dc0 --- /dev/null +++ b/packages/openapi-ts/src/legacy/handlebars/compiled/client.js @@ -0,0 +1,457 @@ +export default { + 1: function (container, depth0, helpers, partials, data) { + return "import { NgModule} from '@angular/core';\nimport { HttpClientModule } from '@angular/common/http';\n\nimport { AngularHttpRequest } from './core/AngularHttpRequest';\nimport { BaseHttpRequest } from './core/BaseHttpRequest';\nimport type { OpenAPIConfig } from './core/OpenAPI';\nimport { OpenAPI } from './core/OpenAPI';\nimport { Interceptors } from './core/OpenAPI';\n"; + }, + 3: function (container, depth0, helpers, partials, data) { + var stack1, + alias1 = container.strict, + alias2 = container.lambda; + + return ( + "import type { BaseHttpRequest } from './core/BaseHttpRequest';\nimport type { OpenAPIConfig } from './core/OpenAPI';\nimport { Interceptors } from './core/OpenAPI';\nimport { " + + ((stack1 = alias2( + alias1(depth0, 'httpRequest', { + start: { line: 14, column: 12 }, + end: { line: 14, column: 23 }, + }), + depth0, + )) != null + ? stack1 + : '') + + " } from './core/" + + ((stack1 = alias2( + alias1(depth0, 'httpRequest', { + start: { line: 14, column: 45 }, + end: { line: 14, column: 56 }, + }), + depth0, + )) != null + ? stack1 + : '') + + "';\n" + ); + }, + 5: function (container, depth0, helpers, partials, data) { + var stack1, + lookupProperty = + container.lookupProperty || + function (parent, propertyName) { + if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { + return parent[propertyName]; + } + return undefined; + }; + + return (stack1 = lookupProperty(helpers, 'each').call( + depth0 != null ? depth0 : container.nullContext || {}, + lookupProperty(depth0, 'services'), + { + name: 'each', + hash: {}, + fn: container.program(6, data, 0), + inverse: container.noop, + data: data, + loc: { start: { line: 18, column: 0 }, end: { line: 20, column: 9 } }, + }, + )) != null + ? stack1 + : ''; + }, + 6: function (container, depth0, helpers, partials, data) { + var stack1, + lookupProperty = + container.lookupProperty || + function (parent, propertyName) { + if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { + return parent[propertyName]; + } + return undefined; + }; + + return ( + 'import { ' + + ((stack1 = lookupProperty(helpers, 'transformServiceName').call( + depth0 != null ? depth0 : container.nullContext || {}, + lookupProperty(depth0, 'name'), + { + name: 'transformServiceName', + hash: {}, + data: data, + loc: { + start: { line: 19, column: 9 }, + end: { line: 19, column: 40 }, + }, + }, + )) != null + ? stack1 + : '') + + " } from './services.gen';\n" + ); + }, + 8: function (container, depth0, helpers, partials, data) { + var stack1, + alias1 = container.strict, + alias2 = container.lambda, + lookupProperty = + container.lookupProperty || + function (parent, propertyName) { + if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { + return parent[propertyName]; + } + return undefined; + }; + + return ( + "@NgModule({\n imports: [HttpClientModule],\n providers: [\n {\n provide: OpenAPI,\n useValue: {\n BASE: OpenAPI?.BASE ?? '" + + ((stack1 = alias2( + alias1(depth0, 'server', { + start: { line: 30, column: 31 }, + end: { line: 30, column: 37 }, + }), + depth0, + )) != null + ? stack1 + : '') + + "',\n VERSION: OpenAPI?.VERSION ?? '" + + ((stack1 = alias2( + alias1(depth0, 'version', { + start: { line: 31, column: 37 }, + end: { line: 31, column: 44 }, + }), + depth0, + )) != null + ? stack1 + : '') + + "',\n WITH_CREDENTIALS: OpenAPI?.WITH_CREDENTIALS ?? false,\n CREDENTIALS: OpenAPI?.CREDENTIALS ?? 'include',\n TOKEN: OpenAPI?.TOKEN,\n USERNAME: OpenAPI?.USERNAME,\n PASSWORD: OpenAPI?.PASSWORD,\n HEADERS: OpenAPI?.HEADERS,\n ENCODE_PATH: OpenAPI?.ENCODE_PATH,\n interceptors: {\n response: OpenAPI?.interceptors?.response ?? new Interceptors(),\n },\n } as OpenAPIConfig,\n },\n {\n provide: BaseHttpRequest,\n useClass: AngularHttpRequest,\n },\n" + + ((stack1 = lookupProperty(helpers, 'each').call( + depth0 != null ? depth0 : container.nullContext || {}, + lookupProperty(depth0, 'services'), + { + name: 'each', + hash: {}, + fn: container.program(9, data, 0), + inverse: container.noop, + data: data, + loc: { + start: { line: 48, column: 2 }, + end: { line: 50, column: 11 }, + }, + }, + )) != null + ? stack1 + : '') + + ' ]\n})\nexport class ' + + ((stack1 = alias2( + alias1( + lookupProperty(lookupProperty(data, 'root'), '$config'), + 'name', + { start: { line: 53, column: 16 }, end: { line: 53, column: 34 } }, + ), + depth0, + )) != null + ? stack1 + : '') + + ' {}\n' + ); + }, + 9: function (container, depth0, helpers, partials, data) { + var stack1, + lookupProperty = + container.lookupProperty || + function (parent, propertyName) { + if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { + return parent[propertyName]; + } + return undefined; + }; + + return ( + ' ' + + ((stack1 = lookupProperty(helpers, 'transformServiceName').call( + depth0 != null ? depth0 : container.nullContext || {}, + lookupProperty(depth0, 'name'), + { + name: 'transformServiceName', + hash: {}, + data: data, + loc: { + start: { line: 49, column: 2 }, + end: { line: 49, column: 33 }, + }, + }, + )) != null + ? stack1 + : '') + + ',\n' + ); + }, + 11: function (container, depth0, helpers, partials, data) { + var stack1, + alias1 = container.strict, + alias2 = container.lambda, + alias3 = depth0 != null ? depth0 : container.nullContext || {}, + lookupProperty = + container.lookupProperty || + function (parent, propertyName) { + if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { + return parent[propertyName]; + } + return undefined; + }; + + return ( + 'type HttpRequestConstructor = new (config: OpenAPIConfig) => BaseHttpRequest;\n\nexport class ' + + ((stack1 = alias2( + alias1( + lookupProperty(lookupProperty(data, 'root'), '$config'), + 'name', + { start: { line: 57, column: 16 }, end: { line: 57, column: 34 } }, + ), + depth0, + )) != null + ? stack1 + : '') + + ' {\n\n' + + ((stack1 = lookupProperty(helpers, 'each').call( + alias3, + lookupProperty(depth0, 'services'), + { + name: 'each', + hash: {}, + fn: container.program(12, data, 0), + inverse: container.noop, + data: data, + loc: { + start: { line: 59, column: 1 }, + end: { line: 61, column: 10 }, + }, + }, + )) != null + ? stack1 + : '') + + '\n public readonly request: BaseHttpRequest;\n\n constructor(config?: Partial, HttpRequest: HttpRequestConstructor = ' + + ((stack1 = alias2( + alias1(depth0, 'httpRequest', { + start: { line: 65, column: 87 }, + end: { line: 65, column: 98 }, + }), + depth0, + )) != null + ? stack1 + : '') + + ") {\n this.request = new HttpRequest({\n BASE: config?.BASE ?? '" + + ((stack1 = alias2( + alias1(depth0, 'server', { + start: { line: 67, column: 29 }, + end: { line: 67, column: 35 }, + }), + depth0, + )) != null + ? stack1 + : '') + + "',\n VERSION: config?.VERSION ?? '" + + ((stack1 = alias2( + alias1(depth0, 'version', { + start: { line: 68, column: 35 }, + end: { line: 68, column: 42 }, + }), + depth0, + )) != null + ? stack1 + : '') + + "',\n WITH_CREDENTIALS: config?.WITH_CREDENTIALS ?? false,\n CREDENTIALS: config?.CREDENTIALS ?? 'include',\n TOKEN: config?.TOKEN,\n USERNAME: config?.USERNAME,\n PASSWORD: config?.PASSWORD,\n HEADERS: config?.HEADERS,\n ENCODE_PATH: config?.ENCODE_PATH,\n interceptors: {\n request: config?.interceptors?.request ?? new Interceptors(),\n response: config?.interceptors?.response ?? new Interceptors(),\n },\n });\n\n" + + ((stack1 = lookupProperty(helpers, 'each').call( + alias3, + lookupProperty(depth0, 'services'), + { + name: 'each', + hash: {}, + fn: container.program(14, data, 0), + inverse: container.noop, + data: data, + loc: { + start: { line: 82, column: 2 }, + end: { line: 84, column: 11 }, + }, + }, + )) != null + ? stack1 + : '') + + ' }\n}\n' + ); + }, + 12: function (container, depth0, helpers, partials, data) { + var stack1, + alias1 = depth0 != null ? depth0 : container.nullContext || {}, + lookupProperty = + container.lookupProperty || + function (parent, propertyName) { + if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { + return parent[propertyName]; + } + return undefined; + }; + + return ( + ' public readonly ' + + ((stack1 = lookupProperty(helpers, 'camelCase').call( + alias1, + lookupProperty(depth0, 'name'), + { + name: 'camelCase', + hash: {}, + data: data, + loc: { + start: { line: 60, column: 17 }, + end: { line: 60, column: 37 }, + }, + }, + )) != null + ? stack1 + : '') + + ': ' + + ((stack1 = lookupProperty(helpers, 'transformServiceName').call( + alias1, + lookupProperty(depth0, 'name'), + { + name: 'transformServiceName', + hash: {}, + data: data, + loc: { + start: { line: 60, column: 39 }, + end: { line: 60, column: 70 }, + }, + }, + )) != null + ? stack1 + : '') + + ';\n' + ); + }, + 14: function (container, depth0, helpers, partials, data) { + var stack1, + alias1 = depth0 != null ? depth0 : container.nullContext || {}, + lookupProperty = + container.lookupProperty || + function (parent, propertyName) { + if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { + return parent[propertyName]; + } + return undefined; + }; + + return ( + ' this.' + + ((stack1 = lookupProperty(helpers, 'camelCase').call( + alias1, + lookupProperty(depth0, 'name'), + { + name: 'camelCase', + hash: {}, + data: data, + loc: { + start: { line: 83, column: 7 }, + end: { line: 83, column: 27 }, + }, + }, + )) != null + ? stack1 + : '') + + ' = new ' + + ((stack1 = lookupProperty(helpers, 'transformServiceName').call( + alias1, + lookupProperty(depth0, 'name'), + { + name: 'transformServiceName', + hash: {}, + data: data, + loc: { + start: { line: 83, column: 34 }, + end: { line: 83, column: 65 }, + }, + }, + )) != null + ? stack1 + : '') + + '(this.request);\n' + ); + }, + compiler: [8, '>= 4.3.0'], + main: function (container, depth0, helpers, partials, data) { + var stack1, + alias1 = depth0 != null ? depth0 : container.nullContext || {}, + lookupProperty = + container.lookupProperty || + function (parent, propertyName) { + if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { + return parent[propertyName]; + } + return undefined; + }; + + return ( + ((stack1 = lookupProperty(helpers, 'equals').call( + alias1, + lookupProperty( + lookupProperty( + lookupProperty(lookupProperty(data, 'root'), '$config'), + 'client', + ), + 'name', + ), + 'legacy/angular', + { + name: 'equals', + hash: {}, + fn: container.program(1, data, 0), + inverse: container.program(3, data, 0), + data: data, + loc: { start: { line: 1, column: 0 }, end: { line: 15, column: 11 } }, + }, + )) != null + ? stack1 + : '') + + '\n' + + ((stack1 = lookupProperty(helpers, 'if').call( + alias1, + lookupProperty(depth0, 'services'), + { + name: 'if', + hash: {}, + fn: container.program(5, data, 0), + inverse: container.noop, + data: data, + loc: { start: { line: 17, column: 0 }, end: { line: 21, column: 7 } }, + }, + )) != null + ? stack1 + : '') + + '\n' + + ((stack1 = lookupProperty(helpers, 'equals').call( + alias1, + lookupProperty( + lookupProperty( + lookupProperty(lookupProperty(data, 'root'), '$config'), + 'client', + ), + 'name', + ), + 'legacy/angular', + { + name: 'equals', + hash: {}, + fn: container.program(8, data, 0), + inverse: container.program(11, data, 0), + data: data, + loc: { + start: { line: 23, column: 0 }, + end: { line: 87, column: 11 }, + }, + }, + )) != null + ? stack1 + : '') + ); + }, + useData: true, +}; diff --git a/packages/openapi-ts/src/legacy/handlebars/compiled/core/ApiError.js b/packages/openapi-ts/src/legacy/handlebars/compiled/core/ApiError.js new file mode 100644 index 000000000..4cb06ccc6 --- /dev/null +++ b/packages/openapi-ts/src/legacy/handlebars/compiled/core/ApiError.js @@ -0,0 +1,7 @@ +export default { + compiler: [8, '>= 4.3.0'], + main: function (container, depth0, helpers, partials, data) { + return "import type { ApiRequestOptions } from './ApiRequestOptions';\nimport type { ApiResult } from './ApiResult';\n\nexport class ApiError extends Error {\n public readonly url: string;\n public readonly status: number;\n public readonly statusText: string;\n public readonly body: unknown;\n public readonly request: ApiRequestOptions;\n\n constructor(request: ApiRequestOptions, response: ApiResult, message: string) {\n super(message);\n\n this.name = 'ApiError';\n this.url = response.url;\n this.status = response.status;\n this.statusText = response.statusText;\n this.body = response.body;\n this.request = request;\n }\n}"; + }, + useData: true, +}; diff --git a/packages/openapi-ts/src/legacy/handlebars/compiled/core/ApiRequestOptions.js b/packages/openapi-ts/src/legacy/handlebars/compiled/core/ApiRequestOptions.js new file mode 100644 index 000000000..b63eb8a02 --- /dev/null +++ b/packages/openapi-ts/src/legacy/handlebars/compiled/core/ApiRequestOptions.js @@ -0,0 +1,7 @@ +export default { + compiler: [8, '>= 4.3.0'], + main: function (container, depth0, helpers, partials, data) { + return "export type ApiRequestOptions = {\n readonly body?: any;\n readonly cookies?: Record;\n readonly errors?: Record;\n readonly formData?: Record | any[] | Blob | File;\n readonly headers?: Record;\n readonly mediaType?: string;\n readonly method:\n | 'DELETE'\n | 'GET'\n | 'HEAD'\n | 'OPTIONS'\n | 'PATCH'\n | 'POST'\n | 'PUT';\n readonly path?: Record;\n readonly query?: Record;\n readonly responseHeader?: string;\n readonly responseTransformer?: (data: unknown) => Promise;\n readonly url: string;\n};"; + }, + useData: true, +}; diff --git a/packages/openapi-ts/src/legacy/handlebars/compiled/core/ApiResult.js b/packages/openapi-ts/src/legacy/handlebars/compiled/core/ApiResult.js new file mode 100644 index 000000000..6d87d8336 --- /dev/null +++ b/packages/openapi-ts/src/legacy/handlebars/compiled/core/ApiResult.js @@ -0,0 +1,7 @@ +export default { + compiler: [8, '>= 4.3.0'], + main: function (container, depth0, helpers, partials, data) { + return 'export type ApiResult = {\n readonly body: TData;\n readonly ok: boolean;\n readonly status: number;\n readonly statusText: string;\n readonly url: string;\n};'; + }, + useData: true, +}; diff --git a/packages/openapi-ts/src/legacy/handlebars/compiled/core/BaseHttpRequest.js b/packages/openapi-ts/src/legacy/handlebars/compiled/core/BaseHttpRequest.js new file mode 100644 index 000000000..2d4bf78e2 --- /dev/null +++ b/packages/openapi-ts/src/legacy/handlebars/compiled/core/BaseHttpRequest.js @@ -0,0 +1,109 @@ +export default { + 1: function (container, depth0, helpers, partials, data) { + return "import type { HttpClient } from '@angular/common/http';\nimport type { Observable } from 'rxjs';\n\nimport type { ApiRequestOptions } from './ApiRequestOptions';\nimport type { OpenAPIConfig } from './OpenAPI';\n"; + }, + 3: function (container, depth0, helpers, partials, data) { + return "import type { ApiRequestOptions } from './ApiRequestOptions';\nimport type { CancelablePromise } from './CancelablePromise';\nimport type { OpenAPIConfig } from './OpenAPI';\n"; + }, + 5: function (container, depth0, helpers, partials, data) { + return ' constructor(\n public readonly config: OpenAPIConfig,\n public readonly http: HttpClient,\n ) {}\n'; + }, + 7: function (container, depth0, helpers, partials, data) { + return ' constructor(public readonly config: OpenAPIConfig) {}\n'; + }, + 9: function (container, depth0, helpers, partials, data) { + return ' public abstract request(options: ApiRequestOptions): Observable;\n'; + }, + 11: function (container, depth0, helpers, partials, data) { + return ' public abstract request(options: ApiRequestOptions): CancelablePromise;\n'; + }, + compiler: [8, '>= 4.3.0'], + main: function (container, depth0, helpers, partials, data) { + var stack1, + alias1 = depth0 != null ? depth0 : container.nullContext || {}, + lookupProperty = + container.lookupProperty || + function (parent, propertyName) { + if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { + return parent[propertyName]; + } + return undefined; + }; + + return ( + ((stack1 = lookupProperty(helpers, 'equals').call( + alias1, + lookupProperty( + lookupProperty( + lookupProperty(lookupProperty(data, 'root'), '$config'), + 'client', + ), + 'name', + ), + 'legacy/angular', + { + name: 'equals', + hash: {}, + fn: container.program(1, data, 0), + inverse: container.program(3, data, 0), + data: data, + loc: { start: { line: 1, column: 0 }, end: { line: 11, column: 11 } }, + }, + )) != null + ? stack1 + : '') + + '\nexport abstract class BaseHttpRequest {\n\n' + + ((stack1 = lookupProperty(helpers, 'equals').call( + alias1, + lookupProperty( + lookupProperty( + lookupProperty(lookupProperty(data, 'root'), '$config'), + 'client', + ), + 'name', + ), + 'legacy/angular', + { + name: 'equals', + hash: {}, + fn: container.program(5, data, 0), + inverse: container.program(7, data, 0), + data: data, + loc: { + start: { line: 15, column: 1 }, + end: { line: 22, column: 12 }, + }, + }, + )) != null + ? stack1 + : '') + + '\n' + + ((stack1 = lookupProperty(helpers, 'equals').call( + alias1, + lookupProperty( + lookupProperty( + lookupProperty(lookupProperty(data, 'root'), '$config'), + 'client', + ), + 'name', + ), + 'legacy/angular', + { + name: 'equals', + hash: {}, + fn: container.program(9, data, 0), + inverse: container.program(11, data, 0), + data: data, + loc: { + start: { line: 24, column: 1 }, + end: { line: 28, column: 12 }, + }, + }, + )) != null + ? stack1 + : '') + + '}' + ); + }, + useData: true, +}; diff --git a/packages/openapi-ts/src/legacy/handlebars/compiled/core/CancelablePromise.js b/packages/openapi-ts/src/legacy/handlebars/compiled/core/CancelablePromise.js new file mode 100644 index 000000000..b2154cde4 --- /dev/null +++ b/packages/openapi-ts/src/legacy/handlebars/compiled/core/CancelablePromise.js @@ -0,0 +1,7 @@ +export default { + compiler: [8, '>= 4.3.0'], + main: function (container, depth0, helpers, partials, data) { + return "export class CancelError extends Error {\n constructor(message: string) {\n super(message);\n this.name = 'CancelError';\n }\n\n public get isCancelled(): boolean {\n return true;\n }\n}\n\nexport interface OnCancel {\n readonly isResolved: boolean;\n readonly isRejected: boolean;\n readonly isCancelled: boolean;\n\n (cancelHandler: () => void): void;\n}\n\nexport class CancelablePromise implements Promise {\n private _isResolved: boolean;\n private _isRejected: boolean;\n private _isCancelled: boolean;\n readonly cancelHandlers: (() => void)[];\n readonly promise: Promise;\n private _resolve?: (value: T | PromiseLike) => void;\n private _reject?: (reason?: unknown) => void;\n\n constructor(\n executor: (\n resolve: (value: T | PromiseLike) => void,\n reject: (reason?: unknown) => void,\n onCancel: OnCancel\n ) => void\n ) {\n this._isResolved = false;\n this._isRejected = false;\n this._isCancelled = false;\n this.cancelHandlers = [];\n this.promise = new Promise((resolve, reject) => {\n this._resolve = resolve;\n this._reject = reject;\n\n const onResolve = (value: T | PromiseLike): void => {\n if (this._isResolved || this._isRejected || this._isCancelled) {\n return;\n }\n this._isResolved = true;\n if (this._resolve) this._resolve(value);\n };\n\n const onReject = (reason?: unknown): void => {\n if (this._isResolved || this._isRejected || this._isCancelled) {\n return;\n }\n this._isRejected = true;\n if (this._reject) this._reject(reason);\n };\n\n const onCancel = (cancelHandler: () => void): void => {\n if (this._isResolved || this._isRejected || this._isCancelled) {\n return;\n }\n this.cancelHandlers.push(cancelHandler);\n };\n\n Object.defineProperty(onCancel, 'isResolved', {\n get: (): boolean => this._isResolved,\n });\n\n Object.defineProperty(onCancel, 'isRejected', {\n get: (): boolean => this._isRejected,\n });\n\n Object.defineProperty(onCancel, 'isCancelled', {\n get: (): boolean => this._isCancelled,\n });\n\n return executor(onResolve, onReject, onCancel as OnCancel);\n });\n }\n\n get [Symbol.toStringTag]() {\n return \"Cancellable Promise\";\n }\n\n public then(\n onFulfilled?: ((value: T) => TResult1 | PromiseLike) | null,\n onRejected?: ((reason: unknown) => TResult2 | PromiseLike) | null\n ): Promise {\n return this.promise.then(onFulfilled, onRejected);\n }\n\n public catch(\n onRejected?: ((reason: unknown) => TResult | PromiseLike) | null\n ): Promise {\n return this.promise.catch(onRejected);\n }\n\n public finally(onFinally?: (() => void) | null): Promise {\n return this.promise.finally(onFinally);\n }\n\n public cancel(): void {\n if (this._isResolved || this._isRejected || this._isCancelled) {\n return;\n }\n this._isCancelled = true;\n if (this.cancelHandlers.length) {\n try {\n for (const cancelHandler of this.cancelHandlers) {\n cancelHandler();\n }\n } catch (error) {\n console.warn('Cancellation threw an error', error);\n return;\n }\n }\n this.cancelHandlers.length = 0;\n if (this._reject) this._reject(new CancelError('Request aborted'));\n }\n\n public get isCancelled(): boolean {\n return this._isCancelled;\n }\n}"; + }, + useData: true, +}; diff --git a/packages/openapi-ts/src/legacy/handlebars/compiled/core/HttpRequest.js b/packages/openapi-ts/src/legacy/handlebars/compiled/core/HttpRequest.js new file mode 100644 index 000000000..de89e82e7 --- /dev/null +++ b/packages/openapi-ts/src/legacy/handlebars/compiled/core/HttpRequest.js @@ -0,0 +1,147 @@ +export default { + 1: function (container, depth0, helpers, partials, data) { + return "import { Inject, Injectable } from '@angular/core';\nimport { HttpClient } from '@angular/common/http';\nimport type { Observable } from 'rxjs';\n\nimport type { ApiRequestOptions } from './ApiRequestOptions';\nimport { BaseHttpRequest } from './BaseHttpRequest';\nimport type { OpenAPIConfig } from './OpenAPI';\nimport { OpenAPI } from './OpenAPI';\nimport { request as __request } from './request';\n"; + }, + 3: function (container, depth0, helpers, partials, data) { + return "import type { ApiRequestOptions } from './ApiRequestOptions';\nimport { BaseHttpRequest } from './BaseHttpRequest';\nimport type { CancelablePromise } from './CancelablePromise';\nimport type { OpenAPIConfig } from './OpenAPI';\nimport { request as __request } from './request';\n"; + }, + 5: function (container, depth0, helpers, partials, data) { + return '@Injectable()\n'; + }, + 7: function (container, depth0, helpers, partials, data) { + return ' constructor(\n @Inject(OpenAPI)\n config: OpenAPIConfig,\n http: HttpClient,\n ) {\n super(config, http);\n }\n'; + }, + 9: function (container, depth0, helpers, partials, data) { + return ' constructor(config: OpenAPIConfig) {\n super(config);\n }\n'; + }, + 11: function (container, depth0, helpers, partials, data) { + return ' /**\n * Request method\n * @param options The request options from the service\n * @returns Observable\n * @throws ApiError\n */\n public override request(options: ApiRequestOptions): Observable {\n return __request(this.config, this.http, options);\n }\n'; + }, + 13: function (container, depth0, helpers, partials, data) { + return ' /**\n * Request method\n * @param options The request options from the service\n * @returns CancelablePromise\n * @throws ApiError\n */\n public override request(options: ApiRequestOptions): CancelablePromise {\n return __request(this.config, options);\n }\n'; + }, + compiler: [8, '>= 4.3.0'], + main: function (container, depth0, helpers, partials, data) { + var stack1, + alias1 = depth0 != null ? depth0 : container.nullContext || {}, + lookupProperty = + container.lookupProperty || + function (parent, propertyName) { + if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { + return parent[propertyName]; + } + return undefined; + }; + + return ( + ((stack1 = lookupProperty(helpers, 'equals').call( + alias1, + lookupProperty( + lookupProperty( + lookupProperty(lookupProperty(data, 'root'), '$config'), + 'client', + ), + 'name', + ), + 'legacy/angular', + { + name: 'equals', + hash: {}, + fn: container.program(1, data, 0), + inverse: container.program(3, data, 0), + data: data, + loc: { start: { line: 1, column: 0 }, end: { line: 17, column: 11 } }, + }, + )) != null + ? stack1 + : '') + + '\n' + + ((stack1 = lookupProperty(helpers, 'equals').call( + alias1, + lookupProperty( + lookupProperty( + lookupProperty(lookupProperty(data, 'root'), '$config'), + 'client', + ), + 'name', + ), + 'legacy/angular', + { + name: 'equals', + hash: {}, + fn: container.program(5, data, 0), + inverse: container.noop, + data: data, + loc: { + start: { line: 19, column: 0 }, + end: { line: 21, column: 11 }, + }, + }, + )) != null + ? stack1 + : '') + + 'export class ' + + ((stack1 = container.lambda( + container.strict(depth0, 'httpRequest', { + start: { line: 22, column: 15 }, + end: { line: 22, column: 26 }, + }), + depth0, + )) != null + ? stack1 + : '') + + ' extends BaseHttpRequest {\n\n' + + ((stack1 = lookupProperty(helpers, 'equals').call( + alias1, + lookupProperty( + lookupProperty( + lookupProperty(lookupProperty(data, 'root'), '$config'), + 'client', + ), + 'name', + ), + 'legacy/angular', + { + name: 'equals', + hash: {}, + fn: container.program(7, data, 0), + inverse: container.program(9, data, 0), + data: data, + loc: { + start: { line: 24, column: 1 }, + end: { line: 36, column: 12 }, + }, + }, + )) != null + ? stack1 + : '') + + '\n' + + ((stack1 = lookupProperty(helpers, 'equals').call( + alias1, + lookupProperty( + lookupProperty( + lookupProperty(lookupProperty(data, 'root'), '$config'), + 'client', + ), + 'name', + ), + 'legacy/angular', + { + name: 'equals', + hash: {}, + fn: container.program(11, data, 0), + inverse: container.program(13, data, 0), + data: data, + loc: { + start: { line: 38, column: 1 }, + end: { line: 58, column: 12 }, + }, + }, + )) != null + ? stack1 + : '') + + '}' + ); + }, + useData: true, +}; diff --git a/packages/openapi-ts/src/legacy/handlebars/compiled/core/OpenAPI.js b/packages/openapi-ts/src/legacy/handlebars/compiled/core/OpenAPI.js new file mode 100644 index 000000000..6fef4a7c3 --- /dev/null +++ b/packages/openapi-ts/src/legacy/handlebars/compiled/core/OpenAPI.js @@ -0,0 +1,275 @@ +export default { + 1: function (container, depth0, helpers, partials, data) { + return "import type { HttpResponse } from '@angular/common/http';\n"; + }, + 3: function (container, depth0, helpers, partials, data) { + return "import type { AxiosRequestConfig, AxiosResponse } from 'axios';\n"; + }, + 5: function (container, depth0, helpers, partials, data) { + return "import type { RequestInit, Response } from 'node-fetch';\n"; + }, + 7: function (container, depth0, helpers, partials, data) { + return ' response: Interceptors>;\n'; + }, + 9: function (container, depth0, helpers, partials, data) { + return ' request: Interceptors;\n response: Interceptors;\n'; + }, + 11: function (container, depth0, helpers, partials, data) { + return ' request: Interceptors;\n response: Interceptors;\n'; + }, + 13: function (container, depth0, helpers, partials, data) { + return ' request: Interceptors;\n response: Interceptors;\n'; + }, + 15: function (container, depth0, helpers, partials, data) { + return ' request: new Interceptors(),\n'; + }, + compiler: [8, '>= 4.3.0'], + main: function (container, depth0, helpers, partials, data) { + var stack1, + alias1 = depth0 != null ? depth0 : container.nullContext || {}, + alias2 = container.strict, + alias3 = container.lambda, + lookupProperty = + container.lookupProperty || + function (parent, propertyName) { + if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { + return parent[propertyName]; + } + return undefined; + }; + + return ( + ((stack1 = lookupProperty(helpers, 'equals').call( + alias1, + lookupProperty( + lookupProperty( + lookupProperty(lookupProperty(data, 'root'), '$config'), + 'client', + ), + 'name', + ), + 'legacy/angular', + { + name: 'equals', + hash: {}, + fn: container.program(1, data, 0), + inverse: container.noop, + data: data, + loc: { start: { line: 1, column: 0 }, end: { line: 3, column: 11 } }, + }, + )) != null + ? stack1 + : '') + + ((stack1 = lookupProperty(helpers, 'equals').call( + alias1, + lookupProperty( + lookupProperty( + lookupProperty(lookupProperty(data, 'root'), '$config'), + 'client', + ), + 'name', + ), + 'legacy/axios', + { + name: 'equals', + hash: {}, + fn: container.program(3, data, 0), + inverse: container.noop, + data: data, + loc: { start: { line: 4, column: 0 }, end: { line: 6, column: 11 } }, + }, + )) != null + ? stack1 + : '') + + ((stack1 = lookupProperty(helpers, 'equals').call( + alias1, + lookupProperty( + lookupProperty( + lookupProperty(lookupProperty(data, 'root'), '$config'), + 'client', + ), + 'name', + ), + 'legacy/node', + { + name: 'equals', + hash: {}, + fn: container.program(5, data, 0), + inverse: container.noop, + data: data, + loc: { start: { line: 7, column: 0 }, end: { line: 9, column: 11 } }, + }, + )) != null + ? stack1 + : '') + + "import type { ApiRequestOptions } from './ApiRequestOptions';\n\ntype Headers = Record;\ntype Middleware = (value: T) => T | Promise;\ntype Resolver = (options: ApiRequestOptions) => Promise;\n\nexport class Interceptors {\n _fns: Middleware[];\n\n constructor() {\n this._fns = [];\n }\n\n eject(fn: Middleware): void {\n const index = this._fns.indexOf(fn);\n if (index !== -1) {\n this._fns = [...this._fns.slice(0, index), ...this._fns.slice(index + 1)];\n }\n }\n\n use(fn: Middleware): void {\n this._fns = [...this._fns, fn];\n }\n}\n\nexport type OpenAPIConfig = {\n BASE: string;\n CREDENTIALS: 'include' | 'omit' | 'same-origin';\n ENCODE_PATH?: ((path: string) => string) | undefined;\n HEADERS?: Headers | Resolver | undefined;\n PASSWORD?: string | Resolver | undefined;\n TOKEN?: string | Resolver | undefined;\n USERNAME?: string | Resolver | undefined;\n VERSION: string;\n WITH_CREDENTIALS: boolean;\n interceptors: {\n" + + ((stack1 = lookupProperty(helpers, 'equals').call( + alias1, + lookupProperty( + lookupProperty( + lookupProperty(lookupProperty(data, 'root'), '$config'), + 'client', + ), + 'name', + ), + 'legacy/angular', + { + name: 'equals', + hash: {}, + fn: container.program(7, data, 0), + inverse: container.noop, + data: data, + loc: { + start: { line: 46, column: 2 }, + end: { line: 48, column: 13 }, + }, + }, + )) != null + ? stack1 + : '') + + ((stack1 = lookupProperty(helpers, 'equals').call( + alias1, + lookupProperty( + lookupProperty( + lookupProperty(lookupProperty(data, 'root'), '$config'), + 'client', + ), + 'name', + ), + 'legacy/axios', + { + name: 'equals', + hash: {}, + fn: container.program(9, data, 0), + inverse: container.noop, + data: data, + loc: { + start: { line: 49, column: 2 }, + end: { line: 52, column: 13 }, + }, + }, + )) != null + ? stack1 + : '') + + ((stack1 = lookupProperty(helpers, 'equals').call( + alias1, + lookupProperty( + lookupProperty( + lookupProperty(lookupProperty(data, 'root'), '$config'), + 'client', + ), + 'name', + ), + 'legacy/fetch', + { + name: 'equals', + hash: {}, + fn: container.program(11, data, 0), + inverse: container.noop, + data: data, + loc: { + start: { line: 53, column: 2 }, + end: { line: 56, column: 13 }, + }, + }, + )) != null + ? stack1 + : '') + + ((stack1 = lookupProperty(helpers, 'equals').call( + alias1, + lookupProperty( + lookupProperty( + lookupProperty(lookupProperty(data, 'root'), '$config'), + 'client', + ), + 'name', + ), + 'legacy/node', + { + name: 'equals', + hash: {}, + fn: container.program(11, data, 0), + inverse: container.noop, + data: data, + loc: { + start: { line: 57, column: 2 }, + end: { line: 60, column: 13 }, + }, + }, + )) != null + ? stack1 + : '') + + ((stack1 = lookupProperty(helpers, 'equals').call( + alias1, + lookupProperty( + lookupProperty( + lookupProperty(lookupProperty(data, 'root'), '$config'), + 'client', + ), + 'name', + ), + 'legacy/xhr', + { + name: 'equals', + hash: {}, + fn: container.program(13, data, 0), + inverse: container.noop, + data: data, + loc: { + start: { line: 61, column: 2 }, + end: { line: 64, column: 13 }, + }, + }, + )) != null + ? stack1 + : '') + + " };\n};\n\nexport const OpenAPI: OpenAPIConfig = {\n BASE: '" + + ((stack1 = alias3( + alias2(depth0, 'server', { + start: { line: 69, column: 11 }, + end: { line: 69, column: 17 }, + }), + depth0, + )) != null + ? stack1 + : '') + + "',\n CREDENTIALS: 'include',\n ENCODE_PATH: undefined,\n HEADERS: undefined,\n PASSWORD: undefined,\n TOKEN: undefined,\n USERNAME: undefined,\n VERSION: '" + + ((stack1 = alias3( + alias2(depth0, 'version', { + start: { line: 76, column: 14 }, + end: { line: 76, column: 21 }, + }), + depth0, + )) != null + ? stack1 + : '') + + "',\n WITH_CREDENTIALS: false,\n interceptors: {\n" + + ((stack1 = lookupProperty(helpers, 'notEquals').call( + alias1, + lookupProperty( + lookupProperty( + lookupProperty(lookupProperty(data, 'root'), '$config'), + 'client', + ), + 'name', + ), + 'legacy/angular', + { + name: 'notEquals', + hash: {}, + fn: container.program(15, data, 0), + inverse: container.noop, + data: data, + loc: { + start: { line: 79, column: 2 }, + end: { line: 81, column: 16 }, + }, + }, + )) != null + ? stack1 + : '') + + ' response: new Interceptors(),\n },\n};' + ); + }, + useData: true, +}; diff --git a/packages/openapi-ts/src/legacy/handlebars/compiled/core/angular/getHeaders.js b/packages/openapi-ts/src/legacy/handlebars/compiled/core/angular/getHeaders.js new file mode 100644 index 000000000..107171f6b --- /dev/null +++ b/packages/openapi-ts/src/legacy/handlebars/compiled/core/angular/getHeaders.js @@ -0,0 +1,7 @@ +export default { + compiler: [8, '>= 4.3.0'], + main: function (container, depth0, helpers, partials, data) { + return "export const getHeaders = (config: OpenAPIConfig, options: ApiRequestOptions): Observable => {\n return forkJoin({\n // @ts-ignore\n token: resolve(options, config.TOKEN),\n // @ts-ignore\n username: resolve(options, config.USERNAME),\n // @ts-ignore\n password: resolve(options, config.PASSWORD),\n // @ts-ignore\n additionalHeaders: resolve(options, config.HEADERS),\n }).pipe(\n map(({ token, username, password, additionalHeaders }) => {\n const headers = Object.entries({\n Accept: 'application/json',\n ...additionalHeaders,\n ...options.headers,\n })\n .filter(([, value]) => value !== undefined && value !== null)\n .reduce((headers, [key, value]) => ({\n ...headers,\n [key]: String(value),\n }), {} as Record);\n\n if (isStringWithValue(token)) {\n headers['Authorization'] = `Bearer ${token}`;\n }\n\n if (isStringWithValue(username) && isStringWithValue(password)) {\n const credentials = base64(`${username}:${password}`);\n headers['Authorization'] = `Basic ${credentials}`;\n }\n\n if (options.body !== undefined) {\n if (options.mediaType) {\n headers['Content-Type'] = options.mediaType;\n } else if (isBlob(options.body)) {\n headers['Content-Type'] = options.body.type || 'application/octet-stream';\n } else if (isString(options.body)) {\n headers['Content-Type'] = 'text/plain';\n } else if (!isFormData(options.body)) {\n headers['Content-Type'] = 'application/json';\n }\n }\n\n return new HttpHeaders(headers);\n }),\n );\n};"; + }, + useData: true, +}; diff --git a/packages/openapi-ts/src/legacy/handlebars/compiled/core/angular/getRequestBody.js b/packages/openapi-ts/src/legacy/handlebars/compiled/core/angular/getRequestBody.js new file mode 100644 index 000000000..180b22abe --- /dev/null +++ b/packages/openapi-ts/src/legacy/handlebars/compiled/core/angular/getRequestBody.js @@ -0,0 +1,7 @@ +export default { + compiler: [8, '>= 4.3.0'], + main: function (container, depth0, helpers, partials, data) { + return "export const getRequestBody = (options: ApiRequestOptions): unknown => {\n if (options.body) {\n if (options.mediaType?.includes('application/json') || options.mediaType?.includes('+json')) {\n return JSON.stringify(options.body);\n } else if (isString(options.body) || isBlob(options.body) || isFormData(options.body)) {\n return options.body;\n } else {\n return JSON.stringify(options.body);\n }\n }\n return undefined;\n};"; + }, + useData: true, +}; diff --git a/packages/openapi-ts/src/legacy/handlebars/compiled/core/angular/getResponseBody.js b/packages/openapi-ts/src/legacy/handlebars/compiled/core/angular/getResponseBody.js new file mode 100644 index 000000000..42fe81e07 --- /dev/null +++ b/packages/openapi-ts/src/legacy/handlebars/compiled/core/angular/getResponseBody.js @@ -0,0 +1,7 @@ +export default { + compiler: [8, '>= 4.3.0'], + main: function (container, depth0, helpers, partials, data) { + return 'export const getResponseBody = (response: HttpResponse): T | undefined => {\n if (response.status !== 204 && response.body !== null) {\n return response.body;\n }\n return undefined;\n};'; + }, + useData: true, +}; diff --git a/packages/openapi-ts/src/legacy/handlebars/compiled/core/angular/getResponseHeader.js b/packages/openapi-ts/src/legacy/handlebars/compiled/core/angular/getResponseHeader.js new file mode 100644 index 000000000..6fdbaff37 --- /dev/null +++ b/packages/openapi-ts/src/legacy/handlebars/compiled/core/angular/getResponseHeader.js @@ -0,0 +1,7 @@ +export default { + compiler: [8, '>= 4.3.0'], + main: function (container, depth0, helpers, partials, data) { + return 'export const getResponseHeader = (response: HttpResponse, responseHeader?: string): string | undefined => {\n if (responseHeader) {\n const value = response.headers.get(responseHeader);\n if (isString(value)) {\n return value;\n }\n }\n return undefined;\n};'; + }, + useData: true, +}; diff --git a/packages/openapi-ts/src/legacy/handlebars/compiled/core/angular/request.js b/packages/openapi-ts/src/legacy/handlebars/compiled/core/angular/request.js new file mode 100644 index 000000000..f9fe239aa --- /dev/null +++ b/packages/openapi-ts/src/legacy/handlebars/compiled/core/angular/request.js @@ -0,0 +1,230 @@ +export default { + compiler: [8, '>= 4.3.0'], + main: function (container, depth0, helpers, partials, data) { + var stack1, + lookupProperty = + container.lookupProperty || + function (parent, propertyName) { + if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { + return parent[propertyName]; + } + return undefined; + }; + + return ( + "import { HttpClient, HttpHeaders } from '@angular/common/http';\nimport type { HttpResponse, HttpErrorResponse } from '@angular/common/http';\nimport { forkJoin, of, throwError } from 'rxjs';\nimport { catchError, map, switchMap } from 'rxjs/operators';\nimport type { Observable } from 'rxjs';\n\nimport { ApiError } from './ApiError';\nimport type { ApiRequestOptions } from './ApiRequestOptions';\nimport type { ApiResult } from './ApiResult';\nimport type { OpenAPIConfig } from './OpenAPI';\n\n" + + ((stack1 = container.invokePartial( + lookupProperty(partials, 'functions/isString'), + depth0, + { + name: 'functions/isString', + data: data, + helpers: helpers, + partials: partials, + decorators: container.decorators, + }, + )) != null + ? stack1 + : '') + + '\n\n' + + ((stack1 = container.invokePartial( + lookupProperty(partials, 'functions/isStringWithValue'), + depth0, + { + name: 'functions/isStringWithValue', + data: data, + helpers: helpers, + partials: partials, + decorators: container.decorators, + }, + )) != null + ? stack1 + : '') + + '\n\n' + + ((stack1 = container.invokePartial( + lookupProperty(partials, 'functions/isBlob'), + depth0, + { + name: 'functions/isBlob', + data: data, + helpers: helpers, + partials: partials, + decorators: container.decorators, + }, + )) != null + ? stack1 + : '') + + '\n\n' + + ((stack1 = container.invokePartial( + lookupProperty(partials, 'functions/isFormData'), + depth0, + { + name: 'functions/isFormData', + data: data, + helpers: helpers, + partials: partials, + decorators: container.decorators, + }, + )) != null + ? stack1 + : '') + + '\n\n' + + ((stack1 = container.invokePartial( + lookupProperty(partials, 'functions/base64'), + depth0, + { + name: 'functions/base64', + data: data, + helpers: helpers, + partials: partials, + decorators: container.decorators, + }, + )) != null + ? stack1 + : '') + + '\n\n' + + ((stack1 = container.invokePartial( + lookupProperty(partials, 'functions/getQueryString'), + depth0, + { + name: 'functions/getQueryString', + data: data, + helpers: helpers, + partials: partials, + decorators: container.decorators, + }, + )) != null + ? stack1 + : '') + + '\n\n' + + ((stack1 = container.invokePartial( + lookupProperty(partials, 'functions/getUrl'), + depth0, + { + name: 'functions/getUrl', + data: data, + helpers: helpers, + partials: partials, + decorators: container.decorators, + }, + )) != null + ? stack1 + : '') + + '\n\n' + + ((stack1 = container.invokePartial( + lookupProperty(partials, 'functions/getFormData'), + depth0, + { + name: 'functions/getFormData', + data: data, + helpers: helpers, + partials: partials, + decorators: container.decorators, + }, + )) != null + ? stack1 + : '') + + '\n\n' + + ((stack1 = container.invokePartial( + lookupProperty(partials, 'functions/resolve'), + depth0, + { + name: 'functions/resolve', + data: data, + helpers: helpers, + partials: partials, + decorators: container.decorators, + }, + )) != null + ? stack1 + : '') + + '\n\n' + + ((stack1 = container.invokePartial( + lookupProperty(partials, 'angular/getHeaders'), + depth0, + { + name: 'angular/getHeaders', + data: data, + helpers: helpers, + partials: partials, + decorators: container.decorators, + }, + )) != null + ? stack1 + : '') + + '\n\n' + + ((stack1 = container.invokePartial( + lookupProperty(partials, 'angular/getRequestBody'), + depth0, + { + name: 'angular/getRequestBody', + data: data, + helpers: helpers, + partials: partials, + decorators: container.decorators, + }, + )) != null + ? stack1 + : '') + + '\n\n' + + ((stack1 = container.invokePartial( + lookupProperty(partials, 'angular/sendRequest'), + depth0, + { + name: 'angular/sendRequest', + data: data, + helpers: helpers, + partials: partials, + decorators: container.decorators, + }, + )) != null + ? stack1 + : '') + + '\n\n' + + ((stack1 = container.invokePartial( + lookupProperty(partials, 'angular/getResponseHeader'), + depth0, + { + name: 'angular/getResponseHeader', + data: data, + helpers: helpers, + partials: partials, + decorators: container.decorators, + }, + )) != null + ? stack1 + : '') + + '\n\n' + + ((stack1 = container.invokePartial( + lookupProperty(partials, 'angular/getResponseBody'), + depth0, + { + name: 'angular/getResponseBody', + data: data, + helpers: helpers, + partials: partials, + decorators: container.decorators, + }, + )) != null + ? stack1 + : '') + + '\n\n' + + ((stack1 = container.invokePartial( + lookupProperty(partials, 'functions/catchErrorCodes'), + depth0, + { + name: 'functions/catchErrorCodes', + data: data, + helpers: helpers, + partials: partials, + decorators: container.decorators, + }, + )) != null + ? stack1 + : '') + + '\n\n/**\n * Request method\n * @param config The OpenAPI configuration object\n * @param http The Angular HTTP client\n * @param options The request options from the service\n * @returns Observable\n * @throws ApiError\n */\nexport const request = (config: OpenAPIConfig, http: HttpClient, options: ApiRequestOptions): Observable => {\n const url = getUrl(config, options);\n const formData = getFormData(options);\n const body = getRequestBody(options);\n\n return getHeaders(config, options).pipe(\n switchMap(headers => {\n return sendRequest(config, options, http, url, body, formData, headers);\n }),\n switchMap(async response => {\n for (const fn of config.interceptors.response._fns) {\n response = await fn(response);\n }\n const responseBody = getResponseBody(response);\n const responseHeader = getResponseHeader(response, options.responseHeader);\n\n let transformedBody = responseBody;\n if (options.responseTransformer && response.ok) {\n transformedBody = await options.responseTransformer(responseBody)\n }\n\n return {\n url,\n ok: response.ok,\n status: response.status,\n statusText: response.statusText,\n body: responseHeader ?? transformedBody,\n } as ApiResult;\n }),\n catchError((error: HttpErrorResponse) => {\n if (!error.status) {\n return throwError(() => error);\n }\n return of({\n url,\n ok: error.ok,\n status: error.status,\n statusText: error.statusText,\n body: error.error ?? error.statusText,\n } as ApiResult);\n }),\n map(result => {\n catchErrorCodes(options, result);\n return result.body as T;\n }),\n catchError((error: ApiError) => {\n return throwError(() => error);\n }),\n );\n};' + ); + }, + usePartial: true, + useData: true, +}; diff --git a/packages/openapi-ts/src/legacy/handlebars/compiled/core/angular/sendRequest.js b/packages/openapi-ts/src/legacy/handlebars/compiled/core/angular/sendRequest.js new file mode 100644 index 000000000..509435921 --- /dev/null +++ b/packages/openapi-ts/src/legacy/handlebars/compiled/core/angular/sendRequest.js @@ -0,0 +1,7 @@ +export default { + compiler: [8, '>= 4.3.0'], + main: function (container, depth0, helpers, partials, data) { + return "export const sendRequest = (\n config: OpenAPIConfig,\n options: ApiRequestOptions,\n http: HttpClient,\n url: string,\n body: unknown,\n formData: FormData | undefined,\n headers: HttpHeaders\n): Observable> => {\n return http.request(options.method, url, {\n headers,\n body: body ?? formData,\n withCredentials: config.WITH_CREDENTIALS,\n observe: 'response',\n });\n};"; + }, + useData: true, +}; diff --git a/packages/openapi-ts/src/legacy/handlebars/compiled/core/axios/getHeaders.js b/packages/openapi-ts/src/legacy/handlebars/compiled/core/axios/getHeaders.js new file mode 100644 index 000000000..b6bbde16d --- /dev/null +++ b/packages/openapi-ts/src/legacy/handlebars/compiled/core/axios/getHeaders.js @@ -0,0 +1,7 @@ +export default { + compiler: [8, '>= 4.3.0'], + main: function (container, depth0, helpers, partials, data) { + return "export const getHeaders = async (config: OpenAPIConfig, options: ApiRequestOptions): Promise> => {\n const [token, username, password, additionalHeaders] = await Promise.all([\n // @ts-ignore\n resolve(options, config.TOKEN),\n // @ts-ignore\n resolve(options, config.USERNAME),\n // @ts-ignore\n resolve(options, config.PASSWORD),\n // @ts-ignore\n resolve(options, config.HEADERS),\n ]);\n\n const headers = Object.entries({\n Accept: 'application/json',\n ...additionalHeaders,\n ...options.headers,\n })\n .filter(([, value]) => value !== undefined && value !== null)\n .reduce((headers, [key, value]) => ({\n ...headers,\n [key]: String(value),\n }), {} as Record);\n\n if (isStringWithValue(token)) {\n headers['Authorization'] = `Bearer ${token}`;\n }\n\n if (isStringWithValue(username) && isStringWithValue(password)) {\n const credentials = base64(`${username}:${password}`);\n headers['Authorization'] = `Basic ${credentials}`;\n }\n\n if (options.body !== undefined) {\n if (options.mediaType) {\n headers['Content-Type'] = options.mediaType;\n } else if (isBlob(options.body)) {\n headers['Content-Type'] = options.body.type || 'application/octet-stream';\n } else if (isString(options.body)) {\n headers['Content-Type'] = 'text/plain';\n } else if (!isFormData(options.body)) {\n headers['Content-Type'] = 'application/json';\n }\n } else if (options.formData !== undefined) {\n if (options.mediaType) {\n headers['Content-Type'] = options.mediaType;\n }\n }\n\n return headers;\n};"; + }, + useData: true, +}; diff --git a/packages/openapi-ts/src/legacy/handlebars/compiled/core/axios/getRequestBody.js b/packages/openapi-ts/src/legacy/handlebars/compiled/core/axios/getRequestBody.js new file mode 100644 index 000000000..063582829 --- /dev/null +++ b/packages/openapi-ts/src/legacy/handlebars/compiled/core/axios/getRequestBody.js @@ -0,0 +1,7 @@ +export default { + compiler: [8, '>= 4.3.0'], + main: function (container, depth0, helpers, partials, data) { + return 'export const getRequestBody = (options: ApiRequestOptions): unknown => {\n if (options.body) {\n return options.body;\n }\n return undefined;\n};'; + }, + useData: true, +}; diff --git a/packages/openapi-ts/src/legacy/handlebars/compiled/core/axios/getResponseBody.js b/packages/openapi-ts/src/legacy/handlebars/compiled/core/axios/getResponseBody.js new file mode 100644 index 000000000..800f8ddbe --- /dev/null +++ b/packages/openapi-ts/src/legacy/handlebars/compiled/core/axios/getResponseBody.js @@ -0,0 +1,7 @@ +export default { + compiler: [8, '>= 4.3.0'], + main: function (container, depth0, helpers, partials, data) { + return 'export const getResponseBody = (response: AxiosResponse): unknown => {\n if (response.status !== 204) {\n return response.data;\n }\n return undefined;\n};'; + }, + useData: true, +}; diff --git a/packages/openapi-ts/src/legacy/handlebars/compiled/core/axios/getResponseHeader.js b/packages/openapi-ts/src/legacy/handlebars/compiled/core/axios/getResponseHeader.js new file mode 100644 index 000000000..3d79fee5e --- /dev/null +++ b/packages/openapi-ts/src/legacy/handlebars/compiled/core/axios/getResponseHeader.js @@ -0,0 +1,7 @@ +export default { + compiler: [8, '>= 4.3.0'], + main: function (container, depth0, helpers, partials, data) { + return 'export const getResponseHeader = (response: AxiosResponse, responseHeader?: string): string | undefined => {\n if (responseHeader) {\n const content = response.headers[responseHeader];\n if (isString(content)) {\n return content;\n }\n }\n return undefined;\n};'; + }, + useData: true, +}; diff --git a/packages/openapi-ts/src/legacy/handlebars/compiled/core/axios/request.js b/packages/openapi-ts/src/legacy/handlebars/compiled/core/axios/request.js new file mode 100644 index 000000000..4ce4ee749 --- /dev/null +++ b/packages/openapi-ts/src/legacy/handlebars/compiled/core/axios/request.js @@ -0,0 +1,332 @@ +export default { + 1: function (container, depth0, helpers, partials, data) { + return 'ApiResult'; + }, + 3: function (container, depth0, helpers, partials, data) { + return 'T'; + }, + 5: function (container, depth0, helpers, partials, data) { + return 'result.body'; + }, + 7: function (container, depth0, helpers, partials, data) { + return 'result'; + }, + compiler: [8, '>= 4.3.0'], + main: function (container, depth0, helpers, partials, data) { + var stack1, + alias1 = depth0 != null ? depth0 : container.nullContext || {}, + lookupProperty = + container.lookupProperty || + function (parent, propertyName) { + if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { + return parent[propertyName]; + } + return undefined; + }; + + return ( + "import axios from 'axios';\nimport type { AxiosError, AxiosRequestConfig, AxiosResponse, AxiosInstance } from 'axios';\n\nimport { ApiError } from './ApiError';\nimport type { ApiRequestOptions } from './ApiRequestOptions';\nimport type { ApiResult } from './ApiResult';\nimport { CancelablePromise } from './CancelablePromise';\nimport type { OnCancel } from './CancelablePromise';\nimport type { OpenAPIConfig } from './OpenAPI';\n\n" + + ((stack1 = container.invokePartial( + lookupProperty(partials, 'functions/isString'), + depth0, + { + name: 'functions/isString', + data: data, + helpers: helpers, + partials: partials, + decorators: container.decorators, + }, + )) != null + ? stack1 + : '') + + '\n\n' + + ((stack1 = container.invokePartial( + lookupProperty(partials, 'functions/isStringWithValue'), + depth0, + { + name: 'functions/isStringWithValue', + data: data, + helpers: helpers, + partials: partials, + decorators: container.decorators, + }, + )) != null + ? stack1 + : '') + + '\n\n' + + ((stack1 = container.invokePartial( + lookupProperty(partials, 'functions/isBlob'), + depth0, + { + name: 'functions/isBlob', + data: data, + helpers: helpers, + partials: partials, + decorators: container.decorators, + }, + )) != null + ? stack1 + : '') + + '\n\n' + + ((stack1 = container.invokePartial( + lookupProperty(partials, 'functions/isFormData'), + depth0, + { + name: 'functions/isFormData', + data: data, + helpers: helpers, + partials: partials, + decorators: container.decorators, + }, + )) != null + ? stack1 + : '') + + '\n\n' + + ((stack1 = container.invokePartial( + lookupProperty(partials, 'functions/isSuccess'), + depth0, + { + name: 'functions/isSuccess', + data: data, + helpers: helpers, + partials: partials, + decorators: container.decorators, + }, + )) != null + ? stack1 + : '') + + '\n\n' + + ((stack1 = container.invokePartial( + lookupProperty(partials, 'functions/base64'), + depth0, + { + name: 'functions/base64', + data: data, + helpers: helpers, + partials: partials, + decorators: container.decorators, + }, + )) != null + ? stack1 + : '') + + '\n\n' + + ((stack1 = container.invokePartial( + lookupProperty(partials, 'functions/getQueryString'), + depth0, + { + name: 'functions/getQueryString', + data: data, + helpers: helpers, + partials: partials, + decorators: container.decorators, + }, + )) != null + ? stack1 + : '') + + '\n\n' + + ((stack1 = container.invokePartial( + lookupProperty(partials, 'functions/getUrl'), + depth0, + { + name: 'functions/getUrl', + data: data, + helpers: helpers, + partials: partials, + decorators: container.decorators, + }, + )) != null + ? stack1 + : '') + + '\n\n' + + ((stack1 = container.invokePartial( + lookupProperty(partials, 'functions/getFormData'), + depth0, + { + name: 'functions/getFormData', + data: data, + helpers: helpers, + partials: partials, + decorators: container.decorators, + }, + )) != null + ? stack1 + : '') + + '\n\n' + + ((stack1 = container.invokePartial( + lookupProperty(partials, 'functions/resolve'), + depth0, + { + name: 'functions/resolve', + data: data, + helpers: helpers, + partials: partials, + decorators: container.decorators, + }, + )) != null + ? stack1 + : '') + + '\n\n' + + ((stack1 = container.invokePartial( + lookupProperty(partials, 'axios/getHeaders'), + depth0, + { + name: 'axios/getHeaders', + data: data, + helpers: helpers, + partials: partials, + decorators: container.decorators, + }, + )) != null + ? stack1 + : '') + + '\n\n' + + ((stack1 = container.invokePartial( + lookupProperty(partials, 'axios/getRequestBody'), + depth0, + { + name: 'axios/getRequestBody', + data: data, + helpers: helpers, + partials: partials, + decorators: container.decorators, + }, + )) != null + ? stack1 + : '') + + '\n\n' + + ((stack1 = container.invokePartial( + lookupProperty(partials, 'axios/sendRequest'), + depth0, + { + name: 'axios/sendRequest', + data: data, + helpers: helpers, + partials: partials, + decorators: container.decorators, + }, + )) != null + ? stack1 + : '') + + '\n\n' + + ((stack1 = container.invokePartial( + lookupProperty(partials, 'axios/getResponseHeader'), + depth0, + { + name: 'axios/getResponseHeader', + data: data, + helpers: helpers, + partials: partials, + decorators: container.decorators, + }, + )) != null + ? stack1 + : '') + + '\n\n' + + ((stack1 = container.invokePartial( + lookupProperty(partials, 'axios/getResponseBody'), + depth0, + { + name: 'axios/getResponseBody', + data: data, + helpers: helpers, + partials: partials, + decorators: container.decorators, + }, + )) != null + ? stack1 + : '') + + '\n\n' + + ((stack1 = container.invokePartial( + lookupProperty(partials, 'functions/catchErrorCodes'), + depth0, + { + name: 'functions/catchErrorCodes', + data: data, + helpers: helpers, + partials: partials, + decorators: container.decorators, + }, + )) != null + ? stack1 + : '') + + '\n\n/**\n * Request method\n * @param config The OpenAPI configuration object\n * @param options The request options from the service\n * @param axiosClient The axios client instance to use\n * @returns CancelablePromise<' + + ((stack1 = lookupProperty(helpers, 'equals').call( + alias1, + lookupProperty( + lookupProperty( + lookupProperty(lookupProperty(data, 'root'), '$config'), + 'services', + ), + 'response', + ), + 'response', + { + name: 'equals', + hash: {}, + fn: container.program(1, data, 0), + inverse: container.program(3, data, 0), + data: data, + loc: { + start: { line: 64, column: 30 }, + end: { line: 64, column: 116 }, + }, + }, + )) != null + ? stack1 + : '') + + '>\n * @throws ApiError\n */\nexport const request = (config: OpenAPIConfig, options: ApiRequestOptions, axiosClient: AxiosInstance = axios): CancelablePromise<' + + ((stack1 = lookupProperty(helpers, 'equals').call( + alias1, + lookupProperty( + lookupProperty( + lookupProperty(lookupProperty(data, 'root'), '$config'), + 'services', + ), + 'response', + ), + 'response', + { + name: 'equals', + hash: {}, + fn: container.program(1, data, 0), + inverse: container.program(3, data, 0), + data: data, + loc: { + start: { line: 67, column: 136 }, + end: { line: 67, column: 222 }, + }, + }, + )) != null + ? stack1 + : '') + + '> => {\n return new CancelablePromise(async (resolve, reject, onCancel) => {\n try {\n const url = getUrl(config, options);\n const formData = getFormData(options);\n const body = getRequestBody(options);\n const headers = await getHeaders(config, options);\n\n if (!onCancel.isCancelled) {\n let response = await sendRequest(config, options, url, body, formData, headers, onCancel, axiosClient);\n\n for (const fn of config.interceptors.response._fns) {\n response = await fn(response);\n }\n\n const responseBody = getResponseBody(response);\n const responseHeader = getResponseHeader(response, options.responseHeader);\n\n let transformedBody = responseBody;\n if (options.responseTransformer && isSuccess(response.status)) {\n transformedBody = await options.responseTransformer(responseBody)\n }\n\n const result: ApiResult = {\n url,\n ok: isSuccess(response.status),\n status: response.status,\n statusText: response.statusText,\n body: responseHeader ?? transformedBody,\n };\n\n catchErrorCodes(options, result);\n\n resolve(' + + ((stack1 = lookupProperty(helpers, 'equals').call( + alias1, + lookupProperty( + lookupProperty( + lookupProperty(lookupProperty(data, 'root'), '$config'), + 'services', + ), + 'response', + ), + 'body', + { + name: 'equals', + hash: {}, + fn: container.program(5, data, 0), + inverse: container.program(7, data, 0), + data: data, + loc: { + start: { line: 100, column: 12 }, + end: { line: 100, column: 98 }, + }, + }, + )) != null + ? stack1 + : '') + + ');\n }\n } catch (error) {\n reject(error);\n }\n });\n};' + ); + }, + usePartial: true, + useData: true, +}; diff --git a/packages/openapi-ts/src/legacy/handlebars/compiled/core/axios/sendRequest.js b/packages/openapi-ts/src/legacy/handlebars/compiled/core/axios/sendRequest.js new file mode 100644 index 000000000..448fd04f1 --- /dev/null +++ b/packages/openapi-ts/src/legacy/handlebars/compiled/core/axios/sendRequest.js @@ -0,0 +1,7 @@ +export default { + compiler: [8, '>= 4.3.0'], + main: function (container, depth0, helpers, partials, data) { + return 'export const sendRequest = async (\n config: OpenAPIConfig,\n options: ApiRequestOptions,\n url: string,\n body: unknown,\n formData: FormData | undefined,\n headers: Record,\n onCancel: OnCancel,\n axiosClient: AxiosInstance\n): Promise> => {\n const controller = new AbortController();\n\n let requestConfig: AxiosRequestConfig = {\n data: body ?? formData,\n headers,\n method: options.method,\n signal: controller.signal,\n url,\n withCredentials: config.WITH_CREDENTIALS,\n };\n\n onCancel(() => controller.abort());\n\n for (const fn of config.interceptors.request._fns) {\n requestConfig = await fn(requestConfig);\n }\n\n try {\n return await axiosClient.request(requestConfig);\n } catch (error) {\n const axiosError = error as AxiosError;\n if (axiosError.response) {\n return axiosError.response;\n }\n throw error;\n }\n};'; + }, + useData: true, +}; diff --git a/packages/openapi-ts/src/legacy/handlebars/compiled/core/fetch/getHeaders.js b/packages/openapi-ts/src/legacy/handlebars/compiled/core/fetch/getHeaders.js new file mode 100644 index 000000000..ba30baa44 --- /dev/null +++ b/packages/openapi-ts/src/legacy/handlebars/compiled/core/fetch/getHeaders.js @@ -0,0 +1,7 @@ +export default { + compiler: [8, '>= 4.3.0'], + main: function (container, depth0, helpers, partials, data) { + return "export const getHeaders = async (config: OpenAPIConfig, options: ApiRequestOptions): Promise => {\n const [token, username, password, additionalHeaders] = await Promise.all([\n // @ts-ignore\n resolve(options, config.TOKEN),\n // @ts-ignore\n resolve(options, config.USERNAME),\n // @ts-ignore\n resolve(options, config.PASSWORD),\n // @ts-ignore\n resolve(options, config.HEADERS),\n ]);\n\n const headers = Object.entries({\n Accept: 'application/json',\n ...additionalHeaders,\n ...options.headers,\n })\n .filter(([, value]) => value !== undefined && value !== null)\n .reduce((headers, [key, value]) => ({\n ...headers,\n [key]: String(value),\n }), {} as Record);\n\n if (isStringWithValue(token)) {\n headers['Authorization'] = `Bearer ${token}`;\n }\n\n if (isStringWithValue(username) && isStringWithValue(password)) {\n const credentials = base64(`${username}:${password}`);\n headers['Authorization'] = `Basic ${credentials}`;\n }\n\n if (options.body !== undefined) {\n if (options.mediaType) {\n headers['Content-Type'] = options.mediaType;\n } else if (isBlob(options.body)) {\n headers['Content-Type'] = options.body.type || 'application/octet-stream';\n } else if (isString(options.body)) {\n headers['Content-Type'] = 'text/plain';\n } else if (!isFormData(options.body)) {\n headers['Content-Type'] = 'application/json';\n }\n }\n\n return new Headers(headers);\n};"; + }, + useData: true, +}; diff --git a/packages/openapi-ts/src/legacy/handlebars/compiled/core/fetch/getRequestBody.js b/packages/openapi-ts/src/legacy/handlebars/compiled/core/fetch/getRequestBody.js new file mode 100644 index 000000000..1378625cb --- /dev/null +++ b/packages/openapi-ts/src/legacy/handlebars/compiled/core/fetch/getRequestBody.js @@ -0,0 +1,7 @@ +export default { + compiler: [8, '>= 4.3.0'], + main: function (container, depth0, helpers, partials, data) { + return "export const getRequestBody = (options: ApiRequestOptions): unknown => {\n if (options.body !== undefined) {\n if (options.mediaType?.includes('application/json') || options.mediaType?.includes('+json')) {\n return JSON.stringify(options.body);\n } else if (isString(options.body) || isBlob(options.body) || isFormData(options.body)) {\n return options.body;\n } else {\n return JSON.stringify(options.body);\n }\n }\n return undefined;\n};"; + }, + useData: true, +}; diff --git a/packages/openapi-ts/src/legacy/handlebars/compiled/core/fetch/getResponseBody.js b/packages/openapi-ts/src/legacy/handlebars/compiled/core/fetch/getResponseBody.js new file mode 100644 index 000000000..7b90b1b61 --- /dev/null +++ b/packages/openapi-ts/src/legacy/handlebars/compiled/core/fetch/getResponseBody.js @@ -0,0 +1,7 @@ +export default { + compiler: [8, '>= 4.3.0'], + main: function (container, depth0, helpers, partials, data) { + return "export const getResponseBody = async (response: Response): Promise => {\n if (response.status !== 204) {\n try {\n const contentType = response.headers.get('Content-Type');\n if (contentType) {\n const binaryTypes = ['application/octet-stream', 'application/pdf', 'application/zip', 'audio/', 'image/', 'video/'];\n if (contentType.includes('application/json') || contentType.includes('+json')) {\n return await response.json();\n } else if (binaryTypes.some(type => contentType.includes(type))) {\n return await response.blob();\n } else if (contentType.includes('multipart/form-data')) {\n return await response.formData();\n } else if (contentType.includes('text/')) {\n return await response.text();\n }\n }\n } catch (error) {\n console.error(error);\n }\n }\n return undefined;\n};"; + }, + useData: true, +}; diff --git a/packages/openapi-ts/src/legacy/handlebars/compiled/core/fetch/getResponseHeader.js b/packages/openapi-ts/src/legacy/handlebars/compiled/core/fetch/getResponseHeader.js new file mode 100644 index 000000000..46f79e225 --- /dev/null +++ b/packages/openapi-ts/src/legacy/handlebars/compiled/core/fetch/getResponseHeader.js @@ -0,0 +1,7 @@ +export default { + compiler: [8, '>= 4.3.0'], + main: function (container, depth0, helpers, partials, data) { + return 'export const getResponseHeader = (response: Response, responseHeader?: string): string | undefined => {\n if (responseHeader) {\n const content = response.headers.get(responseHeader);\n if (isString(content)) {\n return content;\n }\n }\n return undefined;\n};'; + }, + useData: true, +}; diff --git a/packages/openapi-ts/src/legacy/handlebars/compiled/core/fetch/request.js b/packages/openapi-ts/src/legacy/handlebars/compiled/core/fetch/request.js new file mode 100644 index 000000000..9b798af0a --- /dev/null +++ b/packages/openapi-ts/src/legacy/handlebars/compiled/core/fetch/request.js @@ -0,0 +1,342 @@ +export default { + 1: function (container, depth0, helpers, partials, data) { + return "import fetch, { FormData, Headers } from 'node-fetch';\nimport type { RequestInit, Response } from 'node-fetch';\n\n"; + }, + 3: function (container, depth0, helpers, partials, data) { + return 'ApiResult'; + }, + 5: function (container, depth0, helpers, partials, data) { + return 'T'; + }, + 7: function (container, depth0, helpers, partials, data) { + return 'result.body'; + }, + 9: function (container, depth0, helpers, partials, data) { + return 'result'; + }, + compiler: [8, '>= 4.3.0'], + main: function (container, depth0, helpers, partials, data) { + var stack1, + alias1 = depth0 != null ? depth0 : container.nullContext || {}, + lookupProperty = + container.lookupProperty || + function (parent, propertyName) { + if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { + return parent[propertyName]; + } + return undefined; + }; + + return ( + ((stack1 = lookupProperty(helpers, 'equals').call( + alias1, + lookupProperty( + lookupProperty( + lookupProperty(lookupProperty(data, 'root'), '$config'), + 'client', + ), + 'name', + ), + 'legacy/node', + { + name: 'equals', + hash: {}, + fn: container.program(1, data, 0), + inverse: container.noop, + data: data, + loc: { start: { line: 1, column: 0 }, end: { line: 5, column: 11 } }, + }, + )) != null + ? stack1 + : '') + + "import { ApiError } from './ApiError';\nimport type { ApiRequestOptions } from './ApiRequestOptions';\nimport type { ApiResult } from './ApiResult';\nimport { CancelablePromise } from './CancelablePromise';\nimport type { OnCancel } from './CancelablePromise';\nimport type { OpenAPIConfig } from './OpenAPI';\n\n" + + ((stack1 = container.invokePartial( + lookupProperty(partials, 'functions/isString'), + depth0, + { + name: 'functions/isString', + data: data, + helpers: helpers, + partials: partials, + decorators: container.decorators, + }, + )) != null + ? stack1 + : '') + + '\n\n' + + ((stack1 = container.invokePartial( + lookupProperty(partials, 'functions/isStringWithValue'), + depth0, + { + name: 'functions/isStringWithValue', + data: data, + helpers: helpers, + partials: partials, + decorators: container.decorators, + }, + )) != null + ? stack1 + : '') + + '\n\n' + + ((stack1 = container.invokePartial( + lookupProperty(partials, 'functions/isBlob'), + depth0, + { + name: 'functions/isBlob', + data: data, + helpers: helpers, + partials: partials, + decorators: container.decorators, + }, + )) != null + ? stack1 + : '') + + '\n\n' + + ((stack1 = container.invokePartial( + lookupProperty(partials, 'functions/isFormData'), + depth0, + { + name: 'functions/isFormData', + data: data, + helpers: helpers, + partials: partials, + decorators: container.decorators, + }, + )) != null + ? stack1 + : '') + + '\n\n' + + ((stack1 = container.invokePartial( + lookupProperty(partials, 'functions/base64'), + depth0, + { + name: 'functions/base64', + data: data, + helpers: helpers, + partials: partials, + decorators: container.decorators, + }, + )) != null + ? stack1 + : '') + + '\n\n' + + ((stack1 = container.invokePartial( + lookupProperty(partials, 'functions/getQueryString'), + depth0, + { + name: 'functions/getQueryString', + data: data, + helpers: helpers, + partials: partials, + decorators: container.decorators, + }, + )) != null + ? stack1 + : '') + + '\n\n' + + ((stack1 = container.invokePartial( + lookupProperty(partials, 'functions/getUrl'), + depth0, + { + name: 'functions/getUrl', + data: data, + helpers: helpers, + partials: partials, + decorators: container.decorators, + }, + )) != null + ? stack1 + : '') + + '\n\n' + + ((stack1 = container.invokePartial( + lookupProperty(partials, 'functions/getFormData'), + depth0, + { + name: 'functions/getFormData', + data: data, + helpers: helpers, + partials: partials, + decorators: container.decorators, + }, + )) != null + ? stack1 + : '') + + '\n\n' + + ((stack1 = container.invokePartial( + lookupProperty(partials, 'functions/resolve'), + depth0, + { + name: 'functions/resolve', + data: data, + helpers: helpers, + partials: partials, + decorators: container.decorators, + }, + )) != null + ? stack1 + : '') + + '\n\n' + + ((stack1 = container.invokePartial( + lookupProperty(partials, 'fetch/getHeaders'), + depth0, + { + name: 'fetch/getHeaders', + data: data, + helpers: helpers, + partials: partials, + decorators: container.decorators, + }, + )) != null + ? stack1 + : '') + + '\n\n' + + ((stack1 = container.invokePartial( + lookupProperty(partials, 'fetch/getRequestBody'), + depth0, + { + name: 'fetch/getRequestBody', + data: data, + helpers: helpers, + partials: partials, + decorators: container.decorators, + }, + )) != null + ? stack1 + : '') + + '\n\n' + + ((stack1 = container.invokePartial( + lookupProperty(partials, 'fetch/sendRequest'), + depth0, + { + name: 'fetch/sendRequest', + data: data, + helpers: helpers, + partials: partials, + decorators: container.decorators, + }, + )) != null + ? stack1 + : '') + + '\n\n' + + ((stack1 = container.invokePartial( + lookupProperty(partials, 'fetch/getResponseHeader'), + depth0, + { + name: 'fetch/getResponseHeader', + data: data, + helpers: helpers, + partials: partials, + decorators: container.decorators, + }, + )) != null + ? stack1 + : '') + + '\n\n' + + ((stack1 = container.invokePartial( + lookupProperty(partials, 'fetch/getResponseBody'), + depth0, + { + name: 'fetch/getResponseBody', + data: data, + helpers: helpers, + partials: partials, + decorators: container.decorators, + }, + )) != null + ? stack1 + : '') + + '\n\n' + + ((stack1 = container.invokePartial( + lookupProperty(partials, 'functions/catchErrorCodes'), + depth0, + { + name: 'functions/catchErrorCodes', + data: data, + helpers: helpers, + partials: partials, + decorators: container.decorators, + }, + )) != null + ? stack1 + : '') + + '\n\n/**\n * Request method\n * @param config The OpenAPI configuration object\n * @param options The request options from the service\n * @returns CancelablePromise<' + + ((stack1 = lookupProperty(helpers, 'equals').call( + alias1, + lookupProperty( + lookupProperty( + lookupProperty(lookupProperty(data, 'root'), '$config'), + 'services', + ), + 'response', + ), + 'response', + { + name: 'equals', + hash: {}, + fn: container.program(3, data, 0), + inverse: container.program(5, data, 0), + data: data, + loc: { + start: { line: 62, column: 30 }, + end: { line: 62, column: 116 }, + }, + }, + )) != null + ? stack1 + : '') + + '>\n * @throws ApiError\n */\nexport const request = (config: OpenAPIConfig, options: ApiRequestOptions): CancelablePromise<' + + ((stack1 = lookupProperty(helpers, 'equals').call( + alias1, + lookupProperty( + lookupProperty( + lookupProperty(lookupProperty(data, 'root'), '$config'), + 'services', + ), + 'response', + ), + 'response', + { + name: 'equals', + hash: {}, + fn: container.program(3, data, 0), + inverse: container.program(5, data, 0), + data: data, + loc: { + start: { line: 65, column: 100 }, + end: { line: 65, column: 186 }, + }, + }, + )) != null + ? stack1 + : '') + + '> => {\n return new CancelablePromise(async (resolve, reject, onCancel) => {\n try {\n const url = getUrl(config, options);\n const formData = getFormData(options);\n const body = getRequestBody(options);\n const headers = await getHeaders(config, options);\n\n if (!onCancel.isCancelled) {\n let response = await sendRequest(config, options, url, body, formData, headers, onCancel);\n\n for (const fn of config.interceptors.response._fns) {\n response = await fn(response);\n }\n\n const responseBody = await getResponseBody(response);\n const responseHeader = getResponseHeader(response, options.responseHeader);\n\n let transformedBody = responseBody;\n if (options.responseTransformer && response.ok) {\n transformedBody = await options.responseTransformer(responseBody)\n }\n\n const result: ApiResult = {\n url,\n ok: response.ok,\n status: response.status,\n statusText: response.statusText,\n body: responseHeader ?? transformedBody,\n };\n\n catchErrorCodes(options, result);\n\n resolve(' + + ((stack1 = lookupProperty(helpers, 'equals').call( + alias1, + lookupProperty( + lookupProperty( + lookupProperty(lookupProperty(data, 'root'), '$config'), + 'services', + ), + 'response', + ), + 'body', + { + name: 'equals', + hash: {}, + fn: container.program(7, data, 0), + inverse: container.program(9, data, 0), + data: data, + loc: { + start: { line: 98, column: 12 }, + end: { line: 98, column: 98 }, + }, + }, + )) != null + ? stack1 + : '') + + ');\n }\n } catch (error) {\n reject(error);\n }\n });\n};' + ); + }, + usePartial: true, + useData: true, +}; diff --git a/packages/openapi-ts/src/legacy/handlebars/compiled/core/fetch/sendRequest.js b/packages/openapi-ts/src/legacy/handlebars/compiled/core/fetch/sendRequest.js new file mode 100644 index 000000000..0b0087c7b --- /dev/null +++ b/packages/openapi-ts/src/legacy/handlebars/compiled/core/fetch/sendRequest.js @@ -0,0 +1,47 @@ +export default { + 1: function (container, depth0, helpers, partials, data) { + return ' if (config.WITH_CREDENTIALS) {\n request.credentials = config.CREDENTIALS;\n }\n'; + }, + compiler: [8, '>= 4.3.0'], + main: function (container, depth0, helpers, partials, data) { + var stack1, + lookupProperty = + container.lookupProperty || + function (parent, propertyName) { + if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { + return parent[propertyName]; + } + return undefined; + }; + + return ( + 'export const sendRequest = async (\n config: OpenAPIConfig,\n options: ApiRequestOptions,\n url: string,\n body: any,\n formData: FormData | undefined,\n headers: Headers,\n onCancel: OnCancel\n): Promise => {\n const controller = new AbortController();\n\n let request: RequestInit = {\n headers,\n body: body ?? formData,\n method: options.method,\n signal: controller.signal,\n };\n\n' + + ((stack1 = lookupProperty(helpers, 'equals').call( + depth0 != null ? depth0 : container.nullContext || {}, + lookupProperty( + lookupProperty( + lookupProperty(lookupProperty(data, 'root'), '$config'), + 'client', + ), + 'name', + ), + 'legacy/fetch', + { + name: 'equals', + hash: {}, + fn: container.program(1, data, 0), + inverse: container.noop, + data: data, + loc: { + start: { line: 19, column: 1 }, + end: { line: 23, column: 12 }, + }, + }, + )) != null + ? stack1 + : '') + + '\n for (const fn of config.interceptors.request._fns) {\n request = await fn(request);\n }\n\n onCancel(() => controller.abort());\n\n return await fetch(url, request);\n};' + ); + }, + useData: true, +}; diff --git a/packages/openapi-ts/src/legacy/handlebars/compiled/core/functions/base64.js b/packages/openapi-ts/src/legacy/handlebars/compiled/core/functions/base64.js new file mode 100644 index 000000000..b8fa64c80 --- /dev/null +++ b/packages/openapi-ts/src/legacy/handlebars/compiled/core/functions/base64.js @@ -0,0 +1,7 @@ +export default { + compiler: [8, '>= 4.3.0'], + main: function (container, depth0, helpers, partials, data) { + return "export const base64 = (str: string): string => {\n try {\n return btoa(str);\n } catch (err) {\n // @ts-ignore\n return Buffer.from(str).toString('base64');\n }\n};"; + }, + useData: true, +}; diff --git a/packages/openapi-ts/src/legacy/handlebars/compiled/core/functions/catchErrorCodes.js b/packages/openapi-ts/src/legacy/handlebars/compiled/core/functions/catchErrorCodes.js new file mode 100644 index 000000000..91272e89e --- /dev/null +++ b/packages/openapi-ts/src/legacy/handlebars/compiled/core/functions/catchErrorCodes.js @@ -0,0 +1,7 @@ +export default { + compiler: [8, '>= 4.3.0'], + main: function (container, depth0, helpers, partials, data) { + return "export const catchErrorCodes = (options: ApiRequestOptions, result: ApiResult): void => {\n const errors: Record = {\n 400: 'Bad Request',\n 401: 'Unauthorized',\n 402: 'Payment Required',\n 403: 'Forbidden',\n 404: 'Not Found',\n 405: 'Method Not Allowed',\n 406: 'Not Acceptable',\n 407: 'Proxy Authentication Required',\n 408: 'Request Timeout',\n 409: 'Conflict',\n 410: 'Gone',\n 411: 'Length Required',\n 412: 'Precondition Failed',\n 413: 'Payload Too Large',\n 414: 'URI Too Long',\n 415: 'Unsupported Media Type',\n 416: 'Range Not Satisfiable',\n 417: 'Expectation Failed',\n 418: 'Im a teapot',\n 421: 'Misdirected Request',\n 422: 'Unprocessable Content',\n 423: 'Locked',\n 424: 'Failed Dependency',\n 425: 'Too Early',\n 426: 'Upgrade Required',\n 428: 'Precondition Required',\n 429: 'Too Many Requests',\n 431: 'Request Header Fields Too Large',\n 451: 'Unavailable For Legal Reasons',\n 500: 'Internal Server Error',\n 501: 'Not Implemented',\n 502: 'Bad Gateway',\n 503: 'Service Unavailable',\n 504: 'Gateway Timeout',\n 505: 'HTTP Version Not Supported',\n 506: 'Variant Also Negotiates',\n 507: 'Insufficient Storage',\n 508: 'Loop Detected',\n 510: 'Not Extended',\n 511: 'Network Authentication Required',\n ...options.errors,\n }\n\n const error = errors[result.status];\n if (error) {\n throw new ApiError(options, result, error);\n }\n\n if (!result.ok) {\n const errorStatus = result.status ?? 'unknown';\n const errorStatusText = result.statusText ?? 'unknown';\n const errorBody = (() => {\n try {\n return JSON.stringify(result.body, null, 2);\n } catch (e) {\n return undefined;\n }\n })();\n\n throw new ApiError(options, result,\n `Generic Error: status: ${errorStatus}; status text: ${errorStatusText}; body: ${errorBody}`\n );\n }\n};"; + }, + useData: true, +}; diff --git a/packages/openapi-ts/src/legacy/handlebars/compiled/core/functions/getFormData.js b/packages/openapi-ts/src/legacy/handlebars/compiled/core/functions/getFormData.js new file mode 100644 index 000000000..aadad3cc5 --- /dev/null +++ b/packages/openapi-ts/src/legacy/handlebars/compiled/core/functions/getFormData.js @@ -0,0 +1,7 @@ +export default { + compiler: [8, '>= 4.3.0'], + main: function (container, depth0, helpers, partials, data) { + return 'export const getFormData = (options: ApiRequestOptions): FormData | undefined => {\n if (options.formData) {\n const formData = new FormData();\n\n const process = (key: string, value: unknown) => {\n if (isString(value) || isBlob(value)) {\n formData.append(key, value);\n } else {\n formData.append(key, JSON.stringify(value));\n }\n };\n\n Object.entries(options.formData)\n .filter(([, value]) => value !== undefined && value !== null)\n .forEach(([key, value]) => {\n if (Array.isArray(value)) {\n value.forEach(v => process(key, v));\n } else {\n process(key, value);\n }\n });\n\n return formData;\n }\n return undefined;\n};'; + }, + useData: true, +}; diff --git a/packages/openapi-ts/src/legacy/handlebars/compiled/core/functions/getQueryString.js b/packages/openapi-ts/src/legacy/handlebars/compiled/core/functions/getQueryString.js new file mode 100644 index 000000000..f9c6ca47b --- /dev/null +++ b/packages/openapi-ts/src/legacy/handlebars/compiled/core/functions/getQueryString.js @@ -0,0 +1,7 @@ +export default { + compiler: [8, '>= 4.3.0'], + main: function (container, depth0, helpers, partials, data) { + return "export const getQueryString = (params: Record): string => {\n const qs: string[] = [];\n\n const append = (key: string, value: unknown) => {\n qs.push(`${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`);\n };\n\n const encodePair = (key: string, value: unknown) => {\n if (value === undefined || value === null) {\n return;\n }\n\n if (value instanceof Date) {\n append(key, value.toISOString());\n } else if (Array.isArray(value)) {\n value.forEach(v => encodePair(key, v));\n } else if (typeof value === 'object') {\n Object.entries(value).forEach(([k, v]) => encodePair(`${key}[${k}]`, v));\n } else {\n append(key, value);\n }\n };\n\n Object.entries(params).forEach(([key, value]) => encodePair(key, value));\n\n return qs.length ? `?${qs.join('&')}` : '';\n};"; + }, + useData: true, +}; diff --git a/packages/openapi-ts/src/legacy/handlebars/compiled/core/functions/getUrl.js b/packages/openapi-ts/src/legacy/handlebars/compiled/core/functions/getUrl.js new file mode 100644 index 000000000..6229a3a36 --- /dev/null +++ b/packages/openapi-ts/src/legacy/handlebars/compiled/core/functions/getUrl.js @@ -0,0 +1,7 @@ +export default { + compiler: [8, '>= 4.3.0'], + main: function (container, depth0, helpers, partials, data) { + return "const getUrl = (config: OpenAPIConfig, options: ApiRequestOptions): string => {\n const encoder = config.ENCODE_PATH || encodeURI;\n\n const path = options.url\n .replace('{api-version}', config.VERSION)\n .replace(/{(.*?)}/g, (substring: string, group: string) => {\n if (options.path?.hasOwnProperty(group)) {\n return encoder(String(options.path[group]));\n }\n return substring;\n });\n\n const url = config.BASE + path;\n return options.query ? url + getQueryString(options.query) : url;\n};"; + }, + useData: true, +}; diff --git a/packages/openapi-ts/src/legacy/handlebars/compiled/core/functions/isBlob.js b/packages/openapi-ts/src/legacy/handlebars/compiled/core/functions/isBlob.js new file mode 100644 index 000000000..a2e49389a --- /dev/null +++ b/packages/openapi-ts/src/legacy/handlebars/compiled/core/functions/isBlob.js @@ -0,0 +1,7 @@ +export default { + compiler: [8, '>= 4.3.0'], + main: function (container, depth0, helpers, partials, data) { + return 'export const isBlob = (value: any): value is Blob => {\n return value instanceof Blob;\n};'; + }, + useData: true, +}; diff --git a/packages/openapi-ts/src/legacy/handlebars/compiled/core/functions/isFormData.js b/packages/openapi-ts/src/legacy/handlebars/compiled/core/functions/isFormData.js new file mode 100644 index 000000000..9d0880a49 --- /dev/null +++ b/packages/openapi-ts/src/legacy/handlebars/compiled/core/functions/isFormData.js @@ -0,0 +1,7 @@ +export default { + compiler: [8, '>= 4.3.0'], + main: function (container, depth0, helpers, partials, data) { + return 'export const isFormData = (value: unknown): value is FormData => {\n return value instanceof FormData;\n};'; + }, + useData: true, +}; diff --git a/packages/openapi-ts/src/legacy/handlebars/compiled/core/functions/isString.js b/packages/openapi-ts/src/legacy/handlebars/compiled/core/functions/isString.js new file mode 100644 index 000000000..54f1fd264 --- /dev/null +++ b/packages/openapi-ts/src/legacy/handlebars/compiled/core/functions/isString.js @@ -0,0 +1,7 @@ +export default { + compiler: [8, '>= 4.3.0'], + main: function (container, depth0, helpers, partials, data) { + return "export const isString = (value: unknown): value is string => {\n return typeof value === 'string';\n};"; + }, + useData: true, +}; diff --git a/packages/openapi-ts/src/legacy/handlebars/compiled/core/functions/isStringWithValue.js b/packages/openapi-ts/src/legacy/handlebars/compiled/core/functions/isStringWithValue.js new file mode 100644 index 000000000..693b6f883 --- /dev/null +++ b/packages/openapi-ts/src/legacy/handlebars/compiled/core/functions/isStringWithValue.js @@ -0,0 +1,7 @@ +export default { + compiler: [8, '>= 4.3.0'], + main: function (container, depth0, helpers, partials, data) { + return "export const isStringWithValue = (value: unknown): value is string => {\n return isString(value) && value !== '';\n};"; + }, + useData: true, +}; diff --git a/packages/openapi-ts/src/legacy/handlebars/compiled/core/functions/isSuccess.js b/packages/openapi-ts/src/legacy/handlebars/compiled/core/functions/isSuccess.js new file mode 100644 index 000000000..b51b66827 --- /dev/null +++ b/packages/openapi-ts/src/legacy/handlebars/compiled/core/functions/isSuccess.js @@ -0,0 +1,7 @@ +export default { + compiler: [8, '>= 4.3.0'], + main: function (container, depth0, helpers, partials, data) { + return 'export const isSuccess = (status: number): boolean => {\n return status >= 200 && status < 300;\n};'; + }, + useData: true, +}; diff --git a/packages/openapi-ts/src/legacy/handlebars/compiled/core/functions/resolve.js b/packages/openapi-ts/src/legacy/handlebars/compiled/core/functions/resolve.js new file mode 100644 index 000000000..79457a4a7 --- /dev/null +++ b/packages/openapi-ts/src/legacy/handlebars/compiled/core/functions/resolve.js @@ -0,0 +1,7 @@ +export default { + compiler: [8, '>= 4.3.0'], + main: function (container, depth0, helpers, partials, data) { + return "type Resolver = (options: ApiRequestOptions) => Promise;\n\nexport const resolve = async (options: ApiRequestOptions, resolver?: T | Resolver): Promise => {\n if (typeof resolver === 'function') {\n return (resolver as Resolver)(options);\n }\n return resolver;\n};"; + }, + useData: true, +}; diff --git a/packages/openapi-ts/src/legacy/handlebars/compiled/core/request.js b/packages/openapi-ts/src/legacy/handlebars/compiled/core/request.js new file mode 100644 index 000000000..f536aca4a --- /dev/null +++ b/packages/openapi-ts/src/legacy/handlebars/compiled/core/request.js @@ -0,0 +1,225 @@ +export default { + 1: function (container, depth0, helpers, partials, data) { + var stack1, + lookupProperty = + container.lookupProperty || + function (parent, propertyName) { + if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { + return parent[propertyName]; + } + return undefined; + }; + + return (stack1 = container.invokePartial( + lookupProperty(partials, 'angular/request'), + depth0, + { + name: 'angular/request', + data: data, + helpers: helpers, + partials: partials, + decorators: container.decorators, + }, + )) != null + ? stack1 + : ''; + }, + 3: function (container, depth0, helpers, partials, data) { + var stack1, + lookupProperty = + container.lookupProperty || + function (parent, propertyName) { + if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { + return parent[propertyName]; + } + return undefined; + }; + + return (stack1 = container.invokePartial( + lookupProperty(partials, 'axios/request'), + depth0, + { + name: 'axios/request', + data: data, + helpers: helpers, + partials: partials, + decorators: container.decorators, + }, + )) != null + ? stack1 + : ''; + }, + 5: function (container, depth0, helpers, partials, data) { + var stack1, + lookupProperty = + container.lookupProperty || + function (parent, propertyName) { + if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { + return parent[propertyName]; + } + return undefined; + }; + + return (stack1 = container.invokePartial( + lookupProperty(partials, 'fetch/request'), + depth0, + { + name: 'fetch/request', + data: data, + helpers: helpers, + partials: partials, + decorators: container.decorators, + }, + )) != null + ? stack1 + : ''; + }, + 7: function (container, depth0, helpers, partials, data) { + var stack1, + lookupProperty = + container.lookupProperty || + function (parent, propertyName) { + if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { + return parent[propertyName]; + } + return undefined; + }; + + return (stack1 = container.invokePartial( + lookupProperty(partials, 'xhr/request'), + depth0, + { + name: 'xhr/request', + data: data, + helpers: helpers, + partials: partials, + decorators: container.decorators, + }, + )) != null + ? stack1 + : ''; + }, + compiler: [8, '>= 4.3.0'], + main: function (container, depth0, helpers, partials, data) { + var stack1, + alias1 = depth0 != null ? depth0 : container.nullContext || {}, + lookupProperty = + container.lookupProperty || + function (parent, propertyName) { + if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { + return parent[propertyName]; + } + return undefined; + }; + + return ( + ((stack1 = lookupProperty(helpers, 'equals').call( + alias1, + lookupProperty( + lookupProperty( + lookupProperty(lookupProperty(data, 'root'), '$config'), + 'client', + ), + 'name', + ), + 'legacy/angular', + { + name: 'equals', + hash: {}, + fn: container.program(1, data, 0), + inverse: container.noop, + data: data, + loc: { start: { line: 1, column: 0 }, end: { line: 1, column: 87 } }, + }, + )) != null + ? stack1 + : '') + + ((stack1 = lookupProperty(helpers, 'equals').call( + alias1, + lookupProperty( + lookupProperty( + lookupProperty(lookupProperty(data, 'root'), '$config'), + 'client', + ), + 'name', + ), + 'legacy/axios', + { + name: 'equals', + hash: {}, + fn: container.program(3, data, 0), + inverse: container.noop, + data: data, + loc: { start: { line: 2, column: 0 }, end: { line: 2, column: 83 } }, + }, + )) != null + ? stack1 + : '') + + ((stack1 = lookupProperty(helpers, 'equals').call( + alias1, + lookupProperty( + lookupProperty( + lookupProperty(lookupProperty(data, 'root'), '$config'), + 'client', + ), + 'name', + ), + 'legacy/fetch', + { + name: 'equals', + hash: {}, + fn: container.program(5, data, 0), + inverse: container.noop, + data: data, + loc: { start: { line: 3, column: 0 }, end: { line: 3, column: 83 } }, + }, + )) != null + ? stack1 + : '') + + ((stack1 = lookupProperty(helpers, 'equals').call( + alias1, + lookupProperty( + lookupProperty( + lookupProperty(lookupProperty(data, 'root'), '$config'), + 'client', + ), + 'name', + ), + 'legacy/node', + { + name: 'equals', + hash: {}, + fn: container.program(5, data, 0), + inverse: container.noop, + data: data, + loc: { start: { line: 4, column: 0 }, end: { line: 4, column: 82 } }, + }, + )) != null + ? stack1 + : '') + + ((stack1 = lookupProperty(helpers, 'equals').call( + alias1, + lookupProperty( + lookupProperty( + lookupProperty(lookupProperty(data, 'root'), '$config'), + 'client', + ), + 'name', + ), + 'legacy/xhr', + { + name: 'equals', + hash: {}, + fn: container.program(7, data, 0), + inverse: container.noop, + data: data, + loc: { start: { line: 5, column: 0 }, end: { line: 5, column: 79 } }, + }, + )) != null + ? stack1 + : '') + ); + }, + usePartial: true, + useData: true, +}; diff --git a/packages/openapi-ts/src/legacy/handlebars/compiled/core/xhr/getHeaders.js b/packages/openapi-ts/src/legacy/handlebars/compiled/core/xhr/getHeaders.js new file mode 100644 index 000000000..ba30baa44 --- /dev/null +++ b/packages/openapi-ts/src/legacy/handlebars/compiled/core/xhr/getHeaders.js @@ -0,0 +1,7 @@ +export default { + compiler: [8, '>= 4.3.0'], + main: function (container, depth0, helpers, partials, data) { + return "export const getHeaders = async (config: OpenAPIConfig, options: ApiRequestOptions): Promise => {\n const [token, username, password, additionalHeaders] = await Promise.all([\n // @ts-ignore\n resolve(options, config.TOKEN),\n // @ts-ignore\n resolve(options, config.USERNAME),\n // @ts-ignore\n resolve(options, config.PASSWORD),\n // @ts-ignore\n resolve(options, config.HEADERS),\n ]);\n\n const headers = Object.entries({\n Accept: 'application/json',\n ...additionalHeaders,\n ...options.headers,\n })\n .filter(([, value]) => value !== undefined && value !== null)\n .reduce((headers, [key, value]) => ({\n ...headers,\n [key]: String(value),\n }), {} as Record);\n\n if (isStringWithValue(token)) {\n headers['Authorization'] = `Bearer ${token}`;\n }\n\n if (isStringWithValue(username) && isStringWithValue(password)) {\n const credentials = base64(`${username}:${password}`);\n headers['Authorization'] = `Basic ${credentials}`;\n }\n\n if (options.body !== undefined) {\n if (options.mediaType) {\n headers['Content-Type'] = options.mediaType;\n } else if (isBlob(options.body)) {\n headers['Content-Type'] = options.body.type || 'application/octet-stream';\n } else if (isString(options.body)) {\n headers['Content-Type'] = 'text/plain';\n } else if (!isFormData(options.body)) {\n headers['Content-Type'] = 'application/json';\n }\n }\n\n return new Headers(headers);\n};"; + }, + useData: true, +}; diff --git a/packages/openapi-ts/src/legacy/handlebars/compiled/core/xhr/getRequestBody.js b/packages/openapi-ts/src/legacy/handlebars/compiled/core/xhr/getRequestBody.js new file mode 100644 index 000000000..1378625cb --- /dev/null +++ b/packages/openapi-ts/src/legacy/handlebars/compiled/core/xhr/getRequestBody.js @@ -0,0 +1,7 @@ +export default { + compiler: [8, '>= 4.3.0'], + main: function (container, depth0, helpers, partials, data) { + return "export const getRequestBody = (options: ApiRequestOptions): unknown => {\n if (options.body !== undefined) {\n if (options.mediaType?.includes('application/json') || options.mediaType?.includes('+json')) {\n return JSON.stringify(options.body);\n } else if (isString(options.body) || isBlob(options.body) || isFormData(options.body)) {\n return options.body;\n } else {\n return JSON.stringify(options.body);\n }\n }\n return undefined;\n};"; + }, + useData: true, +}; diff --git a/packages/openapi-ts/src/legacy/handlebars/compiled/core/xhr/getResponseBody.js b/packages/openapi-ts/src/legacy/handlebars/compiled/core/xhr/getResponseBody.js new file mode 100644 index 000000000..8229393a7 --- /dev/null +++ b/packages/openapi-ts/src/legacy/handlebars/compiled/core/xhr/getResponseBody.js @@ -0,0 +1,7 @@ +export default { + compiler: [8, '>= 4.3.0'], + main: function (container, depth0, helpers, partials, data) { + return "export const getResponseBody = (xhr: XMLHttpRequest): unknown => {\n if (xhr.status !== 204) {\n try {\n const contentType = xhr.getResponseHeader('Content-Type');\n if (contentType) {\n if (contentType.includes('application/json') || contentType.includes('+json')) {\n return JSON.parse(xhr.responseText);\n } else {\n return xhr.responseText;\n }\n }\n } catch (error) {\n console.error(error);\n }\n }\n return undefined;\n};"; + }, + useData: true, +}; diff --git a/packages/openapi-ts/src/legacy/handlebars/compiled/core/xhr/getResponseHeader.js b/packages/openapi-ts/src/legacy/handlebars/compiled/core/xhr/getResponseHeader.js new file mode 100644 index 000000000..560ee1ef8 --- /dev/null +++ b/packages/openapi-ts/src/legacy/handlebars/compiled/core/xhr/getResponseHeader.js @@ -0,0 +1,7 @@ +export default { + compiler: [8, '>= 4.3.0'], + main: function (container, depth0, helpers, partials, data) { + return 'export const getResponseHeader = (xhr: XMLHttpRequest, responseHeader?: string): string | undefined => {\n if (responseHeader) {\n const content = xhr.getResponseHeader(responseHeader);\n if (isString(content)) {\n return content;\n }\n }\n return undefined;\n};'; + }, + useData: true, +}; diff --git a/packages/openapi-ts/src/legacy/handlebars/compiled/core/xhr/request.js b/packages/openapi-ts/src/legacy/handlebars/compiled/core/xhr/request.js new file mode 100644 index 000000000..3bd1b801f --- /dev/null +++ b/packages/openapi-ts/src/legacy/handlebars/compiled/core/xhr/request.js @@ -0,0 +1,332 @@ +export default { + 1: function (container, depth0, helpers, partials, data) { + return 'ApiResult'; + }, + 3: function (container, depth0, helpers, partials, data) { + return 'T'; + }, + 5: function (container, depth0, helpers, partials, data) { + return 'result.body'; + }, + 7: function (container, depth0, helpers, partials, data) { + return 'result'; + }, + compiler: [8, '>= 4.3.0'], + main: function (container, depth0, helpers, partials, data) { + var stack1, + alias1 = depth0 != null ? depth0 : container.nullContext || {}, + lookupProperty = + container.lookupProperty || + function (parent, propertyName) { + if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { + return parent[propertyName]; + } + return undefined; + }; + + return ( + "import { ApiError } from './ApiError';\nimport type { ApiRequestOptions } from './ApiRequestOptions';\nimport type { ApiResult } from './ApiResult';\nimport { CancelablePromise } from './CancelablePromise';\nimport type { OnCancel } from './CancelablePromise';\nimport type { OpenAPIConfig } from './OpenAPI';\n\n" + + ((stack1 = container.invokePartial( + lookupProperty(partials, 'functions/isString'), + depth0, + { + name: 'functions/isString', + data: data, + helpers: helpers, + partials: partials, + decorators: container.decorators, + }, + )) != null + ? stack1 + : '') + + '\n\n' + + ((stack1 = container.invokePartial( + lookupProperty(partials, 'functions/isStringWithValue'), + depth0, + { + name: 'functions/isStringWithValue', + data: data, + helpers: helpers, + partials: partials, + decorators: container.decorators, + }, + )) != null + ? stack1 + : '') + + '\n\n' + + ((stack1 = container.invokePartial( + lookupProperty(partials, 'functions/isBlob'), + depth0, + { + name: 'functions/isBlob', + data: data, + helpers: helpers, + partials: partials, + decorators: container.decorators, + }, + )) != null + ? stack1 + : '') + + '\n\n' + + ((stack1 = container.invokePartial( + lookupProperty(partials, 'functions/isFormData'), + depth0, + { + name: 'functions/isFormData', + data: data, + helpers: helpers, + partials: partials, + decorators: container.decorators, + }, + )) != null + ? stack1 + : '') + + '\n\n' + + ((stack1 = container.invokePartial( + lookupProperty(partials, 'functions/isSuccess'), + depth0, + { + name: 'functions/isSuccess', + data: data, + helpers: helpers, + partials: partials, + decorators: container.decorators, + }, + )) != null + ? stack1 + : '') + + '\n\n' + + ((stack1 = container.invokePartial( + lookupProperty(partials, 'functions/base64'), + depth0, + { + name: 'functions/base64', + data: data, + helpers: helpers, + partials: partials, + decorators: container.decorators, + }, + )) != null + ? stack1 + : '') + + '\n\n' + + ((stack1 = container.invokePartial( + lookupProperty(partials, 'functions/getQueryString'), + depth0, + { + name: 'functions/getQueryString', + data: data, + helpers: helpers, + partials: partials, + decorators: container.decorators, + }, + )) != null + ? stack1 + : '') + + '\n\n' + + ((stack1 = container.invokePartial( + lookupProperty(partials, 'functions/getUrl'), + depth0, + { + name: 'functions/getUrl', + data: data, + helpers: helpers, + partials: partials, + decorators: container.decorators, + }, + )) != null + ? stack1 + : '') + + '\n\n' + + ((stack1 = container.invokePartial( + lookupProperty(partials, 'functions/getFormData'), + depth0, + { + name: 'functions/getFormData', + data: data, + helpers: helpers, + partials: partials, + decorators: container.decorators, + }, + )) != null + ? stack1 + : '') + + '\n\n' + + ((stack1 = container.invokePartial( + lookupProperty(partials, 'functions/resolve'), + depth0, + { + name: 'functions/resolve', + data: data, + helpers: helpers, + partials: partials, + decorators: container.decorators, + }, + )) != null + ? stack1 + : '') + + '\n\n' + + ((stack1 = container.invokePartial( + lookupProperty(partials, 'fetch/getHeaders'), + depth0, + { + name: 'fetch/getHeaders', + data: data, + helpers: helpers, + partials: partials, + decorators: container.decorators, + }, + )) != null + ? stack1 + : '') + + '\n\n' + + ((stack1 = container.invokePartial( + lookupProperty(partials, 'xhr/getRequestBody'), + depth0, + { + name: 'xhr/getRequestBody', + data: data, + helpers: helpers, + partials: partials, + decorators: container.decorators, + }, + )) != null + ? stack1 + : '') + + '\n\n' + + ((stack1 = container.invokePartial( + lookupProperty(partials, 'xhr/sendRequest'), + depth0, + { + name: 'xhr/sendRequest', + data: data, + helpers: helpers, + partials: partials, + decorators: container.decorators, + }, + )) != null + ? stack1 + : '') + + '\n\n' + + ((stack1 = container.invokePartial( + lookupProperty(partials, 'xhr/getResponseHeader'), + depth0, + { + name: 'xhr/getResponseHeader', + data: data, + helpers: helpers, + partials: partials, + decorators: container.decorators, + }, + )) != null + ? stack1 + : '') + + '\n\n' + + ((stack1 = container.invokePartial( + lookupProperty(partials, 'xhr/getResponseBody'), + depth0, + { + name: 'xhr/getResponseBody', + data: data, + helpers: helpers, + partials: partials, + decorators: container.decorators, + }, + )) != null + ? stack1 + : '') + + '\n\n' + + ((stack1 = container.invokePartial( + lookupProperty(partials, 'functions/catchErrorCodes'), + depth0, + { + name: 'functions/catchErrorCodes', + data: data, + helpers: helpers, + partials: partials, + decorators: container.decorators, + }, + )) != null + ? stack1 + : '') + + '\n\n/**\n * Request method\n * @param config The OpenAPI configuration object\n * @param options The request options from the service\n * @returns CancelablePromise<' + + ((stack1 = lookupProperty(helpers, 'equals').call( + alias1, + lookupProperty( + lookupProperty( + lookupProperty(lookupProperty(data, 'root'), '$config'), + 'services', + ), + 'response', + ), + 'response', + { + name: 'equals', + hash: {}, + fn: container.program(1, data, 0), + inverse: container.program(3, data, 0), + data: data, + loc: { + start: { line: 60, column: 30 }, + end: { line: 60, column: 116 }, + }, + }, + )) != null + ? stack1 + : '') + + '>\n * @throws ApiError\n */\nexport const request = (config: OpenAPIConfig, options: ApiRequestOptions): CancelablePromise<' + + ((stack1 = lookupProperty(helpers, 'equals').call( + alias1, + lookupProperty( + lookupProperty( + lookupProperty(lookupProperty(data, 'root'), '$config'), + 'services', + ), + 'response', + ), + 'response', + { + name: 'equals', + hash: {}, + fn: container.program(1, data, 0), + inverse: container.program(3, data, 0), + data: data, + loc: { + start: { line: 63, column: 100 }, + end: { line: 63, column: 186 }, + }, + }, + )) != null + ? stack1 + : '') + + '> => {\n return new CancelablePromise(async (resolve, reject, onCancel) => {\n try {\n const url = getUrl(config, options);\n const formData = getFormData(options);\n const body = getRequestBody(options);\n const headers = await getHeaders(config, options);\n\n if (!onCancel.isCancelled) {\n let response = await sendRequest(config, options, url, body, formData, headers, onCancel);\n\n for (const fn of config.interceptors.response._fns) {\n response = await fn(response);\n }\n\n const responseBody = getResponseBody(response);\n const responseHeader = getResponseHeader(response, options.responseHeader);\n\n let transformedBody = responseBody;\n if (options.responseTransformer && isSuccess(response.status)) {\n transformedBody = await options.responseTransformer(responseBody)\n }\n\n const result: ApiResult = {\n url,\n ok: isSuccess(response.status),\n status: response.status,\n statusText: response.statusText,\n body: responseHeader ?? transformedBody,\n };\n\n catchErrorCodes(options, result);\n\n resolve(' + + ((stack1 = lookupProperty(helpers, 'equals').call( + alias1, + lookupProperty( + lookupProperty( + lookupProperty(lookupProperty(data, 'root'), '$config'), + 'services', + ), + 'response', + ), + 'body', + { + name: 'equals', + hash: {}, + fn: container.program(5, data, 0), + inverse: container.program(7, data, 0), + data: data, + loc: { + start: { line: 96, column: 12 }, + end: { line: 96, column: 98 }, + }, + }, + )) != null + ? stack1 + : '') + + ');\n }\n } catch (error) {\n reject(error);\n }\n });\n};' + ); + }, + usePartial: true, + useData: true, +}; diff --git a/packages/openapi-ts/src/legacy/handlebars/compiled/core/xhr/sendRequest.js b/packages/openapi-ts/src/legacy/handlebars/compiled/core/xhr/sendRequest.js new file mode 100644 index 000000000..41c79a585 --- /dev/null +++ b/packages/openapi-ts/src/legacy/handlebars/compiled/core/xhr/sendRequest.js @@ -0,0 +1,7 @@ +export default { + compiler: [8, '>= 4.3.0'], + main: function (container, depth0, helpers, partials, data) { + return "export const sendRequest = async (\n config: OpenAPIConfig,\n options: ApiRequestOptions,\n url: string,\n body: any,\n formData: FormData | undefined,\n headers: Headers,\n onCancel: OnCancel\n): Promise => {\n let xhr = new XMLHttpRequest();\n xhr.open(options.method, url, true);\n xhr.withCredentials = config.WITH_CREDENTIALS;\n\n headers.forEach((value, key) => {\n xhr.setRequestHeader(key, value);\n });\n\n return new Promise(async (resolve, reject) => {\n xhr.onload = () => resolve(xhr);\n xhr.onabort = () => reject(new Error('Request aborted'));\n xhr.onerror = () => reject(new Error('Network error'));\n\n for (const fn of config.interceptors.request._fns) {\n xhr = await fn(xhr);\n }\n\n xhr.send(body ?? formData);\n\n onCancel(() => xhr.abort());\n });\n};"; + }, + useData: true, +}; diff --git a/packages/openapi-ts/src/legacy/handlebars/handlebars.cjs b/packages/openapi-ts/src/legacy/handlebars/handlebars.cjs new file mode 100644 index 000000000..99e456f01 --- /dev/null +++ b/packages/openapi-ts/src/legacy/handlebars/handlebars.cjs @@ -0,0 +1,79 @@ +const Handlebars = require('handlebars'); +const { + readFileSync, + readdirSync, + statSync, + existsSync, + mkdirSync, + writeFileSync, + rmdirSync, +} = require('node:fs'); +const path = require('node:path'); + +const getFilesRecursively = (folderPath) => { + let fileList = []; + + const files = readdirSync(folderPath); + + files.forEach((file) => { + const fullPath = path.join(folderPath, file); + + if (statSync(fullPath).isDirectory()) { + fileList = fileList.concat(getFilesRecursively(fullPath)); + } else { + fileList.push(fullPath); + } + }); + + return fileList; +}; + +const templatePaths = getFilesRecursively( + path.resolve('src', 'legacy', 'handlebars', 'templates'), +); + +const compiledDirPath = path.resolve('src', 'legacy', 'handlebars', 'compiled'); + +if (existsSync(compiledDirPath)) { + rmdirSync(compiledDirPath, { + recursive: true, + }); +} + +templatePaths.forEach((templatePath) => { + const template = readFileSync(templatePath, 'utf8').toString().trim(); + + const compiled = Handlebars.precompile(template, { + knownHelpers: { + camelCase: true, + equals: true, + ifdef: true, + notEquals: true, + transformServiceName: true, + }, + knownHelpersOnly: true, + noEscape: true, + preventIndent: true, + strict: true, + }); + + const parts = templatePath.split(path.sep); + const fileName = parts[parts.length - 1]; + const fileNameParts = fileName.split('.'); + const fileNameBase = fileNameParts + .slice(0, fileNameParts.length - 1) + .join('.'); + const compiledPath = path.resolve( + compiledDirPath, + ...parts.slice(parts.lastIndexOf('templates') + 1, parts.length - 1), + `${fileNameBase}.js`, + ); + + const compiledDir = path.dirname(compiledPath); + + if (!existsSync(compiledDir)) { + mkdirSync(compiledDir, { recursive: true }); + } + + writeFileSync(compiledPath, `export default ${compiled};`); +}); diff --git a/packages/openapi-ts/src/templates/client.hbs b/packages/openapi-ts/src/legacy/handlebars/templates/client.hbs similarity index 100% rename from packages/openapi-ts/src/templates/client.hbs rename to packages/openapi-ts/src/legacy/handlebars/templates/client.hbs diff --git a/packages/openapi-ts/src/templates/core/ApiError.hbs b/packages/openapi-ts/src/legacy/handlebars/templates/core/ApiError.hbs similarity index 100% rename from packages/openapi-ts/src/templates/core/ApiError.hbs rename to packages/openapi-ts/src/legacy/handlebars/templates/core/ApiError.hbs diff --git a/packages/openapi-ts/src/templates/core/ApiRequestOptions.hbs b/packages/openapi-ts/src/legacy/handlebars/templates/core/ApiRequestOptions.hbs similarity index 100% rename from packages/openapi-ts/src/templates/core/ApiRequestOptions.hbs rename to packages/openapi-ts/src/legacy/handlebars/templates/core/ApiRequestOptions.hbs diff --git a/packages/openapi-ts/src/templates/core/ApiResult.hbs b/packages/openapi-ts/src/legacy/handlebars/templates/core/ApiResult.hbs similarity index 100% rename from packages/openapi-ts/src/templates/core/ApiResult.hbs rename to packages/openapi-ts/src/legacy/handlebars/templates/core/ApiResult.hbs diff --git a/packages/openapi-ts/src/templates/core/BaseHttpRequest.hbs b/packages/openapi-ts/src/legacy/handlebars/templates/core/BaseHttpRequest.hbs similarity index 100% rename from packages/openapi-ts/src/templates/core/BaseHttpRequest.hbs rename to packages/openapi-ts/src/legacy/handlebars/templates/core/BaseHttpRequest.hbs diff --git a/packages/openapi-ts/src/templates/core/CancelablePromise.hbs b/packages/openapi-ts/src/legacy/handlebars/templates/core/CancelablePromise.hbs similarity index 100% rename from packages/openapi-ts/src/templates/core/CancelablePromise.hbs rename to packages/openapi-ts/src/legacy/handlebars/templates/core/CancelablePromise.hbs diff --git a/packages/openapi-ts/src/templates/core/HttpRequest.hbs b/packages/openapi-ts/src/legacy/handlebars/templates/core/HttpRequest.hbs similarity index 100% rename from packages/openapi-ts/src/templates/core/HttpRequest.hbs rename to packages/openapi-ts/src/legacy/handlebars/templates/core/HttpRequest.hbs diff --git a/packages/openapi-ts/src/templates/core/OpenAPI.hbs b/packages/openapi-ts/src/legacy/handlebars/templates/core/OpenAPI.hbs similarity index 100% rename from packages/openapi-ts/src/templates/core/OpenAPI.hbs rename to packages/openapi-ts/src/legacy/handlebars/templates/core/OpenAPI.hbs diff --git a/packages/openapi-ts/src/templates/core/angular/getHeaders.hbs b/packages/openapi-ts/src/legacy/handlebars/templates/core/angular/getHeaders.hbs similarity index 100% rename from packages/openapi-ts/src/templates/core/angular/getHeaders.hbs rename to packages/openapi-ts/src/legacy/handlebars/templates/core/angular/getHeaders.hbs diff --git a/packages/openapi-ts/src/templates/core/angular/getRequestBody.hbs b/packages/openapi-ts/src/legacy/handlebars/templates/core/angular/getRequestBody.hbs similarity index 100% rename from packages/openapi-ts/src/templates/core/angular/getRequestBody.hbs rename to packages/openapi-ts/src/legacy/handlebars/templates/core/angular/getRequestBody.hbs diff --git a/packages/openapi-ts/src/templates/core/angular/getResponseBody.hbs b/packages/openapi-ts/src/legacy/handlebars/templates/core/angular/getResponseBody.hbs similarity index 100% rename from packages/openapi-ts/src/templates/core/angular/getResponseBody.hbs rename to packages/openapi-ts/src/legacy/handlebars/templates/core/angular/getResponseBody.hbs diff --git a/packages/openapi-ts/src/templates/core/angular/getResponseHeader.hbs b/packages/openapi-ts/src/legacy/handlebars/templates/core/angular/getResponseHeader.hbs similarity index 100% rename from packages/openapi-ts/src/templates/core/angular/getResponseHeader.hbs rename to packages/openapi-ts/src/legacy/handlebars/templates/core/angular/getResponseHeader.hbs diff --git a/packages/openapi-ts/src/templates/core/angular/request.hbs b/packages/openapi-ts/src/legacy/handlebars/templates/core/angular/request.hbs similarity index 100% rename from packages/openapi-ts/src/templates/core/angular/request.hbs rename to packages/openapi-ts/src/legacy/handlebars/templates/core/angular/request.hbs diff --git a/packages/openapi-ts/src/templates/core/angular/sendRequest.hbs b/packages/openapi-ts/src/legacy/handlebars/templates/core/angular/sendRequest.hbs similarity index 100% rename from packages/openapi-ts/src/templates/core/angular/sendRequest.hbs rename to packages/openapi-ts/src/legacy/handlebars/templates/core/angular/sendRequest.hbs diff --git a/packages/openapi-ts/src/templates/core/axios/getHeaders.hbs b/packages/openapi-ts/src/legacy/handlebars/templates/core/axios/getHeaders.hbs similarity index 100% rename from packages/openapi-ts/src/templates/core/axios/getHeaders.hbs rename to packages/openapi-ts/src/legacy/handlebars/templates/core/axios/getHeaders.hbs diff --git a/packages/openapi-ts/src/templates/core/axios/getRequestBody.hbs b/packages/openapi-ts/src/legacy/handlebars/templates/core/axios/getRequestBody.hbs similarity index 100% rename from packages/openapi-ts/src/templates/core/axios/getRequestBody.hbs rename to packages/openapi-ts/src/legacy/handlebars/templates/core/axios/getRequestBody.hbs diff --git a/packages/openapi-ts/src/templates/core/axios/getResponseBody.hbs b/packages/openapi-ts/src/legacy/handlebars/templates/core/axios/getResponseBody.hbs similarity index 100% rename from packages/openapi-ts/src/templates/core/axios/getResponseBody.hbs rename to packages/openapi-ts/src/legacy/handlebars/templates/core/axios/getResponseBody.hbs diff --git a/packages/openapi-ts/src/templates/core/axios/getResponseHeader.hbs b/packages/openapi-ts/src/legacy/handlebars/templates/core/axios/getResponseHeader.hbs similarity index 100% rename from packages/openapi-ts/src/templates/core/axios/getResponseHeader.hbs rename to packages/openapi-ts/src/legacy/handlebars/templates/core/axios/getResponseHeader.hbs diff --git a/packages/openapi-ts/src/templates/core/axios/request.hbs b/packages/openapi-ts/src/legacy/handlebars/templates/core/axios/request.hbs similarity index 100% rename from packages/openapi-ts/src/templates/core/axios/request.hbs rename to packages/openapi-ts/src/legacy/handlebars/templates/core/axios/request.hbs diff --git a/packages/openapi-ts/src/templates/core/axios/sendRequest.hbs b/packages/openapi-ts/src/legacy/handlebars/templates/core/axios/sendRequest.hbs similarity index 100% rename from packages/openapi-ts/src/templates/core/axios/sendRequest.hbs rename to packages/openapi-ts/src/legacy/handlebars/templates/core/axios/sendRequest.hbs diff --git a/packages/openapi-ts/src/templates/core/fetch/getHeaders.hbs b/packages/openapi-ts/src/legacy/handlebars/templates/core/fetch/getHeaders.hbs similarity index 100% rename from packages/openapi-ts/src/templates/core/fetch/getHeaders.hbs rename to packages/openapi-ts/src/legacy/handlebars/templates/core/fetch/getHeaders.hbs diff --git a/packages/openapi-ts/src/templates/core/fetch/getRequestBody.hbs b/packages/openapi-ts/src/legacy/handlebars/templates/core/fetch/getRequestBody.hbs similarity index 100% rename from packages/openapi-ts/src/templates/core/fetch/getRequestBody.hbs rename to packages/openapi-ts/src/legacy/handlebars/templates/core/fetch/getRequestBody.hbs diff --git a/packages/openapi-ts/src/templates/core/fetch/getResponseBody.hbs b/packages/openapi-ts/src/legacy/handlebars/templates/core/fetch/getResponseBody.hbs similarity index 100% rename from packages/openapi-ts/src/templates/core/fetch/getResponseBody.hbs rename to packages/openapi-ts/src/legacy/handlebars/templates/core/fetch/getResponseBody.hbs diff --git a/packages/openapi-ts/src/templates/core/fetch/getResponseHeader.hbs b/packages/openapi-ts/src/legacy/handlebars/templates/core/fetch/getResponseHeader.hbs similarity index 100% rename from packages/openapi-ts/src/templates/core/fetch/getResponseHeader.hbs rename to packages/openapi-ts/src/legacy/handlebars/templates/core/fetch/getResponseHeader.hbs diff --git a/packages/openapi-ts/src/templates/core/fetch/request.hbs b/packages/openapi-ts/src/legacy/handlebars/templates/core/fetch/request.hbs similarity index 100% rename from packages/openapi-ts/src/templates/core/fetch/request.hbs rename to packages/openapi-ts/src/legacy/handlebars/templates/core/fetch/request.hbs diff --git a/packages/openapi-ts/src/templates/core/fetch/sendRequest.hbs b/packages/openapi-ts/src/legacy/handlebars/templates/core/fetch/sendRequest.hbs similarity index 100% rename from packages/openapi-ts/src/templates/core/fetch/sendRequest.hbs rename to packages/openapi-ts/src/legacy/handlebars/templates/core/fetch/sendRequest.hbs diff --git a/packages/openapi-ts/src/templates/core/functions/base64.hbs b/packages/openapi-ts/src/legacy/handlebars/templates/core/functions/base64.hbs similarity index 100% rename from packages/openapi-ts/src/templates/core/functions/base64.hbs rename to packages/openapi-ts/src/legacy/handlebars/templates/core/functions/base64.hbs diff --git a/packages/openapi-ts/src/templates/core/functions/catchErrorCodes.hbs b/packages/openapi-ts/src/legacy/handlebars/templates/core/functions/catchErrorCodes.hbs similarity index 100% rename from packages/openapi-ts/src/templates/core/functions/catchErrorCodes.hbs rename to packages/openapi-ts/src/legacy/handlebars/templates/core/functions/catchErrorCodes.hbs diff --git a/packages/openapi-ts/src/templates/core/functions/getFormData.hbs b/packages/openapi-ts/src/legacy/handlebars/templates/core/functions/getFormData.hbs similarity index 100% rename from packages/openapi-ts/src/templates/core/functions/getFormData.hbs rename to packages/openapi-ts/src/legacy/handlebars/templates/core/functions/getFormData.hbs diff --git a/packages/openapi-ts/src/templates/core/functions/getQueryString.hbs b/packages/openapi-ts/src/legacy/handlebars/templates/core/functions/getQueryString.hbs similarity index 100% rename from packages/openapi-ts/src/templates/core/functions/getQueryString.hbs rename to packages/openapi-ts/src/legacy/handlebars/templates/core/functions/getQueryString.hbs diff --git a/packages/openapi-ts/src/templates/core/functions/getUrl.hbs b/packages/openapi-ts/src/legacy/handlebars/templates/core/functions/getUrl.hbs similarity index 100% rename from packages/openapi-ts/src/templates/core/functions/getUrl.hbs rename to packages/openapi-ts/src/legacy/handlebars/templates/core/functions/getUrl.hbs diff --git a/packages/openapi-ts/src/templates/core/functions/isBlob.hbs b/packages/openapi-ts/src/legacy/handlebars/templates/core/functions/isBlob.hbs similarity index 100% rename from packages/openapi-ts/src/templates/core/functions/isBlob.hbs rename to packages/openapi-ts/src/legacy/handlebars/templates/core/functions/isBlob.hbs diff --git a/packages/openapi-ts/src/templates/core/functions/isFormData.hbs b/packages/openapi-ts/src/legacy/handlebars/templates/core/functions/isFormData.hbs similarity index 100% rename from packages/openapi-ts/src/templates/core/functions/isFormData.hbs rename to packages/openapi-ts/src/legacy/handlebars/templates/core/functions/isFormData.hbs diff --git a/packages/openapi-ts/src/templates/core/functions/isString.hbs b/packages/openapi-ts/src/legacy/handlebars/templates/core/functions/isString.hbs similarity index 100% rename from packages/openapi-ts/src/templates/core/functions/isString.hbs rename to packages/openapi-ts/src/legacy/handlebars/templates/core/functions/isString.hbs diff --git a/packages/openapi-ts/src/templates/core/functions/isStringWithValue.hbs b/packages/openapi-ts/src/legacy/handlebars/templates/core/functions/isStringWithValue.hbs similarity index 100% rename from packages/openapi-ts/src/templates/core/functions/isStringWithValue.hbs rename to packages/openapi-ts/src/legacy/handlebars/templates/core/functions/isStringWithValue.hbs diff --git a/packages/openapi-ts/src/templates/core/functions/isSuccess.hbs b/packages/openapi-ts/src/legacy/handlebars/templates/core/functions/isSuccess.hbs similarity index 100% rename from packages/openapi-ts/src/templates/core/functions/isSuccess.hbs rename to packages/openapi-ts/src/legacy/handlebars/templates/core/functions/isSuccess.hbs diff --git a/packages/openapi-ts/src/templates/core/functions/resolve.hbs b/packages/openapi-ts/src/legacy/handlebars/templates/core/functions/resolve.hbs similarity index 100% rename from packages/openapi-ts/src/templates/core/functions/resolve.hbs rename to packages/openapi-ts/src/legacy/handlebars/templates/core/functions/resolve.hbs diff --git a/packages/openapi-ts/src/templates/core/request.hbs b/packages/openapi-ts/src/legacy/handlebars/templates/core/request.hbs similarity index 100% rename from packages/openapi-ts/src/templates/core/request.hbs rename to packages/openapi-ts/src/legacy/handlebars/templates/core/request.hbs diff --git a/packages/openapi-ts/src/templates/core/xhr/getHeaders.hbs b/packages/openapi-ts/src/legacy/handlebars/templates/core/xhr/getHeaders.hbs similarity index 100% rename from packages/openapi-ts/src/templates/core/xhr/getHeaders.hbs rename to packages/openapi-ts/src/legacy/handlebars/templates/core/xhr/getHeaders.hbs diff --git a/packages/openapi-ts/src/templates/core/xhr/getRequestBody.hbs b/packages/openapi-ts/src/legacy/handlebars/templates/core/xhr/getRequestBody.hbs similarity index 100% rename from packages/openapi-ts/src/templates/core/xhr/getRequestBody.hbs rename to packages/openapi-ts/src/legacy/handlebars/templates/core/xhr/getRequestBody.hbs diff --git a/packages/openapi-ts/src/templates/core/xhr/getResponseBody.hbs b/packages/openapi-ts/src/legacy/handlebars/templates/core/xhr/getResponseBody.hbs similarity index 100% rename from packages/openapi-ts/src/templates/core/xhr/getResponseBody.hbs rename to packages/openapi-ts/src/legacy/handlebars/templates/core/xhr/getResponseBody.hbs diff --git a/packages/openapi-ts/src/templates/core/xhr/getResponseHeader.hbs b/packages/openapi-ts/src/legacy/handlebars/templates/core/xhr/getResponseHeader.hbs similarity index 100% rename from packages/openapi-ts/src/templates/core/xhr/getResponseHeader.hbs rename to packages/openapi-ts/src/legacy/handlebars/templates/core/xhr/getResponseHeader.hbs diff --git a/packages/openapi-ts/src/templates/core/xhr/request.hbs b/packages/openapi-ts/src/legacy/handlebars/templates/core/xhr/request.hbs similarity index 100% rename from packages/openapi-ts/src/templates/core/xhr/request.hbs rename to packages/openapi-ts/src/legacy/handlebars/templates/core/xhr/request.hbs diff --git a/packages/openapi-ts/src/templates/core/xhr/sendRequest.hbs b/packages/openapi-ts/src/legacy/handlebars/templates/core/xhr/sendRequest.hbs similarity index 100% rename from packages/openapi-ts/src/templates/core/xhr/sendRequest.hbs rename to packages/openapi-ts/src/legacy/handlebars/templates/core/xhr/sendRequest.hbs diff --git a/packages/openapi-ts/src/node/index.ts b/packages/openapi-ts/src/node/index.ts deleted file mode 100644 index dba118ff7..000000000 --- a/packages/openapi-ts/src/node/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -export { createClient, defineConfig } from '../'; -export type { Plugins } from '../plugins'; -export type { Operation } from '../types/client'; -export type { UserConfig } from '../types/config'; diff --git a/packages/openapi-ts/src/node/tsconfig.json b/packages/openapi-ts/src/node/tsconfig.json deleted file mode 100644 index 38e89fc09..000000000 --- a/packages/openapi-ts/src/node/tsconfig.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "compilerOptions": { - "lib": ["ESNext", "DOM"], - "stripInternal": true - }, - "exclude": ["../**/__tests__"], - "extends": "../../tsconfig.base.json", - "include": ["../", "../client/interfaces"] -} diff --git a/packages/openapi-ts/src/types/config.ts b/packages/openapi-ts/src/types/config.ts index e58230d33..07c1fc0e4 100644 --- a/packages/openapi-ts/src/types/config.ts +++ b/packages/openapi-ts/src/types/config.ts @@ -26,6 +26,7 @@ export interface ClientConfig { */ client?: | Client + | false | { /** * Bundle the client module? Set this to true if you're using a standalone diff --git a/packages/openapi-ts/src/types/hbs.d.ts b/packages/openapi-ts/src/types/hbs.d.ts deleted file mode 100644 index 44f69c1d9..000000000 --- a/packages/openapi-ts/src/types/hbs.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * We precompile the handlebar templates during the build process, - * however in the source code we want to reference these templates - * by importing the hbs files directly. Of course this is not allowed - * by Typescript, so we need to provide some declaration for these - * types. - * @see: build.js for more information - */ -declare module '*.hbs' { - const template: { - compiler: [number, string]; - main: () => void; - useData: true; - }; - export default template; -} diff --git a/packages/openapi-ts/src/utils/handlebars.ts b/packages/openapi-ts/src/utils/handlebars.ts index 2398a6eaa..1c435e46a 100644 --- a/packages/openapi-ts/src/utils/handlebars.ts +++ b/packages/openapi-ts/src/utils/handlebars.ts @@ -1,49 +1,93 @@ import Handlebars from 'handlebars/runtime'; -import templateClient from '../templates/client.hbs'; -import angularGetHeaders from '../templates/core/angular/getHeaders.hbs'; -import angularGetRequestBody from '../templates/core/angular/getRequestBody.hbs'; -import angularGetResponseBody from '../templates/core/angular/getResponseBody.hbs'; -import angularGetResponseHeader from '../templates/core/angular/getResponseHeader.hbs'; -import angularRequest from '../templates/core/angular/request.hbs'; -import angularSendRequest from '../templates/core/angular/sendRequest.hbs'; -import templateCoreApiError from '../templates/core/ApiError.hbs'; -import templateCoreApiRequestOptions from '../templates/core/ApiRequestOptions.hbs'; -import templateCoreApiResult from '../templates/core/ApiResult.hbs'; -import axiosGetHeaders from '../templates/core/axios/getHeaders.hbs'; -import axiosGetRequestBody from '../templates/core/axios/getRequestBody.hbs'; -import axiosGetResponseBody from '../templates/core/axios/getResponseBody.hbs'; -import axiosGetResponseHeader from '../templates/core/axios/getResponseHeader.hbs'; -import axiosRequest from '../templates/core/axios/request.hbs'; -import axiosSendRequest from '../templates/core/axios/sendRequest.hbs'; -import templateCoreBaseHttpRequest from '../templates/core/BaseHttpRequest.hbs'; -import templateCancelablePromise from '../templates/core/CancelablePromise.hbs'; -import fetchGetHeaders from '../templates/core/fetch/getHeaders.hbs'; -import fetchGetRequestBody from '../templates/core/fetch/getRequestBody.hbs'; -import fetchGetResponseBody from '../templates/core/fetch/getResponseBody.hbs'; -import fetchGetResponseHeader from '../templates/core/fetch/getResponseHeader.hbs'; -import fetchRequest from '../templates/core/fetch/request.hbs'; -import fetchSendRequest from '../templates/core/fetch/sendRequest.hbs'; -import functionBase64 from '../templates/core/functions/base64.hbs'; -import functionCatchErrorCodes from '../templates/core/functions/catchErrorCodes.hbs'; -import functionGetFormData from '../templates/core/functions/getFormData.hbs'; -import functionGetQueryString from '../templates/core/functions/getQueryString.hbs'; -import functionGetUrl from '../templates/core/functions/getUrl.hbs'; -import functionIsBlob from '../templates/core/functions/isBlob.hbs'; -import functionIsFormData from '../templates/core/functions/isFormData.hbs'; -import functionIsString from '../templates/core/functions/isString.hbs'; -import functionIsStringWithValue from '../templates/core/functions/isStringWithValue.hbs'; -import functionIsSuccess from '../templates/core/functions/isSuccess.hbs'; -import functionResolve from '../templates/core/functions/resolve.hbs'; -import templateCoreHttpRequest from '../templates/core/HttpRequest.hbs'; -import templateCoreSettings from '../templates/core/OpenAPI.hbs'; -import templateCoreRequest from '../templates/core/request.hbs'; -import xhrGetHeaders from '../templates/core/xhr/getHeaders.hbs'; -import xhrGetRequestBody from '../templates/core/xhr/getRequestBody.hbs'; -import xhrGetResponseBody from '../templates/core/xhr/getResponseBody.hbs'; -import xhrGetResponseHeader from '../templates/core/xhr/getResponseHeader.hbs'; -import xhrRequest from '../templates/core/xhr/request.hbs'; -import xhrSendRequest from '../templates/core/xhr/sendRequest.hbs'; +// @ts-ignore +import templateClient from '../legacy/handlebars/compiled/client.js'; +// @ts-ignore +import angularGetHeaders from '../legacy/handlebars/compiled/core/angular/getHeaders.js'; +// @ts-ignore +import angularGetRequestBody from '../legacy/handlebars/compiled/core/angular/getRequestBody.js'; +// @ts-ignore +import angularGetResponseBody from '../legacy/handlebars/compiled/core/angular/getResponseBody.js'; +// @ts-ignore +import angularGetResponseHeader from '../legacy/handlebars/compiled/core/angular/getResponseHeader.js'; +// @ts-ignore +import angularRequest from '../legacy/handlebars/compiled/core/angular/request.js'; +// @ts-ignore +import angularSendRequest from '../legacy/handlebars/compiled/core/angular/sendRequest.js'; +// @ts-ignore +import templateCoreApiError from '../legacy/handlebars/compiled/core/ApiError.js'; +// @ts-ignore +import templateCoreApiRequestOptions from '../legacy/handlebars/compiled/core/ApiRequestOptions.js'; +// @ts-ignore +import templateCoreApiResult from '../legacy/handlebars/compiled/core/ApiResult.js'; +// @ts-ignore +import axiosGetHeaders from '../legacy/handlebars/compiled/core/axios/getHeaders.js'; +// @ts-ignore +import axiosGetRequestBody from '../legacy/handlebars/compiled/core/axios/getRequestBody.js'; +// @ts-ignore +import axiosGetResponseBody from '../legacy/handlebars/compiled/core/axios/getResponseBody.js'; +// @ts-ignore +import axiosGetResponseHeader from '../legacy/handlebars/compiled/core/axios/getResponseHeader.js'; +// @ts-ignore +import axiosRequest from '../legacy/handlebars/compiled/core/axios/request.js'; +// @ts-ignore +import axiosSendRequest from '../legacy/handlebars/compiled/core/axios/sendRequest.js'; +// @ts-ignore +import templateCoreBaseHttpRequest from '../legacy/handlebars/compiled/core/BaseHttpRequest.js'; +// @ts-ignore +import templateCancelablePromise from '../legacy/handlebars/compiled/core/CancelablePromise.js'; +// @ts-ignore +import fetchGetHeaders from '../legacy/handlebars/compiled/core/fetch/getHeaders.js'; +// @ts-ignore +import fetchGetRequestBody from '../legacy/handlebars/compiled/core/fetch/getRequestBody.js'; +// @ts-ignore +import fetchGetResponseBody from '../legacy/handlebars/compiled/core/fetch/getResponseBody.js'; +// @ts-ignore +import fetchGetResponseHeader from '../legacy/handlebars/compiled/core/fetch/getResponseHeader.js'; +// @ts-ignore +import fetchRequest from '../legacy/handlebars/compiled/core/fetch/request.js'; +// @ts-ignore +import fetchSendRequest from '../legacy/handlebars/compiled/core/fetch/sendRequest.js'; +// @ts-ignore +import functionBase64 from '../legacy/handlebars/compiled/core/functions/base64.js'; +// @ts-ignore +import functionCatchErrorCodes from '../legacy/handlebars/compiled/core/functions/catchErrorCodes.js'; +// @ts-ignore +import functionGetFormData from '../legacy/handlebars/compiled/core/functions/getFormData.js'; +// @ts-ignore +import functionGetQueryString from '../legacy/handlebars/compiled/core/functions/getQueryString.js'; +// @ts-ignore +import functionGetUrl from '../legacy/handlebars/compiled/core/functions/getUrl.js'; +// @ts-ignore +import functionIsBlob from '../legacy/handlebars/compiled/core/functions/isBlob.js'; +// @ts-ignore +import functionIsFormData from '../legacy/handlebars/compiled/core/functions/isFormData.js'; +// @ts-ignore +import functionIsString from '../legacy/handlebars/compiled/core/functions/isString.js'; +// @ts-ignore +import functionIsStringWithValue from '../legacy/handlebars/compiled/core/functions/isStringWithValue.js'; +// @ts-ignore +import functionIsSuccess from '../legacy/handlebars/compiled/core/functions/isSuccess.js'; +// @ts-ignore +import functionResolve from '../legacy/handlebars/compiled/core/functions/resolve.js'; +// @ts-ignore +import templateCoreHttpRequest from '../legacy/handlebars/compiled/core/HttpRequest.js'; +// @ts-ignore +import templateCoreSettings from '../legacy/handlebars/compiled/core/OpenAPI.js'; +// @ts-ignore +import templateCoreRequest from '../legacy/handlebars/compiled/core/request.js'; +// @ts-ignore +import xhrGetHeaders from '../legacy/handlebars/compiled/core/xhr/getHeaders.js'; +// @ts-ignore +import xhrGetRequestBody from '../legacy/handlebars/compiled/core/xhr/getRequestBody.js'; +// @ts-ignore +import xhrGetResponseBody from '../legacy/handlebars/compiled/core/xhr/getResponseBody.js'; +// @ts-ignore +import xhrGetResponseHeader from '../legacy/handlebars/compiled/core/xhr/getResponseHeader.js'; +// @ts-ignore +import xhrRequest from '../legacy/handlebars/compiled/core/xhr/request.js'; +// @ts-ignore +import xhrSendRequest from '../legacy/handlebars/compiled/core/xhr/sendRequest.js'; import { camelCase } from './camelCase'; import { transformServiceName } from './transform'; @@ -128,7 +172,7 @@ export const registerHandlebarTemplates = (): Templates => { }, }; - // Generic functions used in 'request' file @see src/templates/core/request.hbs for more info + // Generic functions used in 'request' file @see src/legacy/handlebars/templates/core/request.hbs for more info Handlebars.registerPartial( 'functions/base64', Handlebars.template(functionBase64), diff --git a/packages/openapi-ts/src/utils/performance.ts b/packages/openapi-ts/src/utils/performance.ts index 087c41127..ae0dd8582 100644 --- a/packages/openapi-ts/src/utils/performance.ts +++ b/packages/openapi-ts/src/utils/performance.ts @@ -5,18 +5,42 @@ const idLength = (id: string) => `${id}-length`; const idStart = (id: string) => `${id}-start`; export const Performance = { - clear: () => { + clear: (): void => { performance.clearMarks(); performance.clearMeasures(); }, - end: (id: string) => { - performance.mark(idEnd(id)); - }, - getEntriesByName: (id: string) => performance.getEntriesByName(idLength(id)), - measure: (id: string) => { - performance.measure(idLength(id), idStart(id), idEnd(id)); - }, - start: (id: string) => { - performance.mark(idStart(id)); - }, + end: (id: string): PerformanceMark => performance.mark(idEnd(id)), + getEntriesByName: (id: string): PerformanceEntryList => + performance.getEntriesByName(idLength(id)), + measure: (id: string): PerformanceMeasure => + performance.measure(idLength(id), idStart(id), idEnd(id)), + start: (id: string): PerformanceMark => performance.mark(idStart(id)), }; + +export class PerformanceReport { + totalMeasure: PerformanceMeasure; + + constructor({ totalMark }: { totalMark: string }) { + this.totalMeasure = Performance.measure(totalMark); + } + + public report({ marks }: { marks: ReadonlyArray }) { + const totalDuration = Math.ceil(this.totalMeasure.duration * 100) / 100; + const totalName = this.totalMeasure.name; + console.warn( + `${totalName.substring(0, totalName.length - idLength('').length)}: ${totalDuration.toFixed(2)}ms`, + ); + + marks.forEach((mark) => { + const markMeasure = Performance.measure(mark); + const markDuration = Math.ceil(markMeasure.duration * 100) / 100; + const percentage = + Math.ceil( + (markMeasure.duration / this.totalMeasure.duration) * 100 * 100, + ) / 100; + console.warn( + `${mark}: ${markDuration.toFixed(2)}ms (${percentage.toFixed(2)}%)`, + ); + }); + } +} diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle/client.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle/client.ts.snap deleted file mode 100644 index 7d794d27a..000000000 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle/client.ts.snap +++ /dev/null @@ -1,15 +0,0 @@ -export { createClient } from './core/'; -export type { - Client, - Config, - Options, - RequestOptions, - RequestOptionsBase, - RequestResult, -} from './core/types'; -export { - createConfig, - formDataBodySerializer, - jsonBodySerializer, - urlSearchParamsBodySerializer, -} from './core/utils'; diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle/core/index.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle/client/index.ts.snap similarity index 93% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle/core/index.ts.snap rename to packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle/client/index.ts.snap index afe16e6a1..d0890ea39 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle/core/index.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle/client/index.ts.snap @@ -84,3 +84,11 @@ export const createClient = (config: Config): Client => { setConfig, } as Client; }; + +export type { Config, Options } from './types'; +export { + createConfig, + formDataBodySerializer, + jsonBodySerializer, + urlSearchParamsBodySerializer, +} from './utils'; diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle/core/types.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle/client/types.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle/core/types.ts.snap rename to packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle/client/types.ts.snap diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle/core/utils.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle/client/utils.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle/core/utils.ts.snap rename to packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle/client/utils.ts.snap diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle_transform/client.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle_transform/client.ts.snap deleted file mode 100644 index 7d794d27a..000000000 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle_transform/client.ts.snap +++ /dev/null @@ -1,15 +0,0 @@ -export { createClient } from './core/'; -export type { - Client, - Config, - Options, - RequestOptions, - RequestOptionsBase, - RequestResult, -} from './core/types'; -export { - createConfig, - formDataBodySerializer, - jsonBodySerializer, - urlSearchParamsBodySerializer, -} from './core/utils'; diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle_transform/core/index.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle_transform/client/index.ts.snap similarity index 93% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle_transform/core/index.ts.snap rename to packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle_transform/client/index.ts.snap index afe16e6a1..d0890ea39 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle_transform/core/index.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle_transform/client/index.ts.snap @@ -84,3 +84,11 @@ export const createClient = (config: Config): Client => { setConfig, } as Client; }; + +export type { Config, Options } from './types'; +export { + createConfig, + formDataBodySerializer, + jsonBodySerializer, + urlSearchParamsBodySerializer, +} from './utils'; diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle_transform/core/types.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle_transform/client/types.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle_transform/core/types.ts.snap rename to packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle_transform/client/types.ts.snap diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle_transform/core/utils.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle_transform/client/utils.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle_transform/core/utils.ts.snap rename to packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle_transform/client/utils.ts.snap diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle/client.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle/client.ts.snap deleted file mode 100644 index 31f504580..000000000 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle/client.ts.snap +++ /dev/null @@ -1,19 +0,0 @@ -export { createClient } from './core/'; -export type { - Client, - Config, - Options, - RequestOptions, - RequestOptionsBase, - RequestResult, -} from './core/types'; -export { - type BodySerializer, - createConfig, - formDataBodySerializer, - jsonBodySerializer, - type Middleware, - type QuerySerializer, - type QuerySerializerOptions, - urlSearchParamsBodySerializer, -} from './core/utils'; diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle_transform/core/index.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle/client/index.ts.snap similarity index 95% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle_transform/core/index.ts.snap rename to packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle/client/index.ts.snap index ab5cd4a1f..46a8d73ad 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle_transform/core/index.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle/client/index.ts.snap @@ -144,3 +144,11 @@ export const createClient = (config: Config = {}): Client => { trace: (options) => request({ ...options, method: 'TRACE' }), }; }; + +export type { Config, Options } from './types'; +export { + createConfig, + formDataBodySerializer, + jsonBodySerializer, + urlSearchParamsBodySerializer, +} from './utils'; diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle/core/types.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle/client/types.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle/core/types.ts.snap rename to packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle/client/types.ts.snap diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle/core/utils.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle/client/utils.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle/core/utils.ts.snap rename to packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle/client/utils.ts.snap diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle_transform/client.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle_transform/client.ts.snap deleted file mode 100644 index 31f504580..000000000 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle_transform/client.ts.snap +++ /dev/null @@ -1,19 +0,0 @@ -export { createClient } from './core/'; -export type { - Client, - Config, - Options, - RequestOptions, - RequestOptionsBase, - RequestResult, -} from './core/types'; -export { - type BodySerializer, - createConfig, - formDataBodySerializer, - jsonBodySerializer, - type Middleware, - type QuerySerializer, - type QuerySerializerOptions, - urlSearchParamsBodySerializer, -} from './core/utils'; diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle/core/index.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle_transform/client/index.ts.snap similarity index 95% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle/core/index.ts.snap rename to packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle_transform/client/index.ts.snap index ab5cd4a1f..46a8d73ad 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle/core/index.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle_transform/client/index.ts.snap @@ -144,3 +144,11 @@ export const createClient = (config: Config = {}): Client => { trace: (options) => request({ ...options, method: 'TRACE' }), }; }; + +export type { Config, Options } from './types'; +export { + createConfig, + formDataBodySerializer, + jsonBodySerializer, + urlSearchParamsBodySerializer, +} from './utils'; diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle_transform/core/types.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle_transform/client/types.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle_transform/core/types.ts.snap rename to packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle_transform/client/types.ts.snap diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle_transform/core/utils.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle_transform/client/utils.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle_transform/core/utils.ts.snap rename to packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle_transform/client/utils.ts.snap diff --git a/packages/openapi-ts/test/bin.spec.ts b/packages/openapi-ts/test/bin.spec.ts index 01d317077..94d415a3f 100755 --- a/packages/openapi-ts/test/bin.spec.ts +++ b/packages/openapi-ts/test/bin.spec.ts @@ -14,7 +14,7 @@ describe('bin', () => { '--dry-run', 'true', ]); - expect(result.stdout.toString()).toContain('Done!'); + expect(result.stdout.toString()).toContain('Creating Fetch client'); expect(result.stderr.toString()).toContain('Duplicate operationId'); }); @@ -119,7 +119,7 @@ describe('bin', () => { '--dry-run', 'true', ]); - expect(result.stdout.toString()).toContain('Done!'); + expect(result.stdout.toString()).toContain('Creating Fetch client'); expect(result.stderr.toString()).toContain('Duplicate operationId'); }); @@ -139,7 +139,7 @@ describe('bin', () => { '--dry-run', 'true', ]); - expect(result.stdout.toString()).toContain('Done!'); + expect(result.stdout.toString()).toContain('Creating Fetch client'); expect(result.stderr.toString()).toContain('Duplicate operationId'); }); @@ -187,6 +187,8 @@ describe('bin', () => { './test/spec/v3.json', '--output', './test/generated/bin', + '--client', + 'invalid/client', '--dry-run', 'true', ]); diff --git a/packages/openapi-ts/test/e2e/scripts/generateClient.ts b/packages/openapi-ts/test/e2e/scripts/generateClient.ts index 11d37940d..df78a483f 100644 --- a/packages/openapi-ts/test/e2e/scripts/generateClient.ts +++ b/packages/openapi-ts/test/e2e/scripts/generateClient.ts @@ -4,7 +4,7 @@ import type { Config } from '../../../src/types/config' export const generateClient = async ( dir: string, version: string, - client: Config['client'], + client: Config['client']['name'], useOptions: boolean = false, name?: string ) => { diff --git a/packages/openapi-ts/test/index.spec.ts b/packages/openapi-ts/test/index.spec.ts index cc2e77bdb..996338245 100644 --- a/packages/openapi-ts/test/index.spec.ts +++ b/packages/openapi-ts/test/index.spec.ts @@ -38,6 +38,7 @@ describe('OpenAPI v2', () => { }, ])('$description', async ({ name, config }) => { const output = toOutputPath(name); + // @ts-ignore await createClient({ ...config, input: V2_SPEC_PATH, @@ -429,6 +430,7 @@ describe('OpenAPI v3', () => { '$description', async ({ name, config }) => { const output = toOutputPath(name); + // @ts-ignore await createClient({ ...config, input: V3_SPEC_PATH, @@ -446,6 +448,7 @@ describe('OpenAPI v3', () => { async ({ name, config }) => { const output = toOutputPath(name + '_transform'); + // @ts-ignore await createClient({ ...config, input: V3_TRANSFORMS_SPEC_PATH, diff --git a/packages/openapi-ts/test/sample.cjs b/packages/openapi-ts/test/sample.cjs index 5be6f2b4c..8c8397214 100644 --- a/packages/openapi-ts/test/sample.cjs +++ b/packages/openapi-ts/test/sample.cjs @@ -1,7 +1,7 @@ const path = require('node:path'); const main = async () => { - /** @type {import('../src/node').UserConfig} */ + /** @type {import('../src').UserConfig} */ const config = { client: { // bundle: true, @@ -38,7 +38,7 @@ const main = async () => { // name: '^Parameters', }, types: { - dates: 'types+transform', + // dates: 'types+transform', // enums: 'javascript', // export: false, // include: @@ -50,7 +50,7 @@ const main = async () => { }; const { createClient } = await import( - path.resolve(process.cwd(), 'dist/node/index.cjs') + path.resolve(process.cwd(), 'dist', 'index.cjs') ); await createClient(config); }; diff --git a/packages/openapi-ts/tsconfig.check.json b/packages/openapi-ts/tsconfig.check.json deleted file mode 100644 index b1498316f..000000000 --- a/packages/openapi-ts/tsconfig.check.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "compilerOptions": { - "exactOptionalPropertyTypes": true, - "module": "NodeNext", - "moduleResolution": "NodeNext", - "noEmit": true, - "strict": true, - "target": "ES2020" - }, - "include": ["dist/**/*", "types/**/*"] -} diff --git a/packages/openapi-ts/tsconfig.json b/packages/openapi-ts/tsconfig.json index e16902e20..1824d6eec 100644 --- a/packages/openapi-ts/tsconfig.json +++ b/packages/openapi-ts/tsconfig.json @@ -5,7 +5,5 @@ "esModuleInterop": true, "resolveJsonModule": true }, - "exclude": ["node_modules", "**/__mocks__"], - "files": ["./src/types/hbs.d.ts"], - "include": ["./src/**/*.ts", "rollup.config.ts", "rollup.dts.config.ts"] + "exclude": ["test/custom/request.ts", "test/e2e/**", "test/generated/**"] } diff --git a/packages/openapi-ts/tsup.config.ts b/packages/openapi-ts/tsup.config.ts new file mode 100644 index 000000000..77dfaf864 --- /dev/null +++ b/packages/openapi-ts/tsup.config.ts @@ -0,0 +1,12 @@ +import { defineConfig } from 'tsup'; + +export default defineConfig((options) => ({ + clean: true, + dts: true, + entry: ['src/index.ts'], + format: ['cjs', 'esm'], + minify: !options.watch, + shims: false, + sourcemap: true, + treeshake: true, +})); diff --git a/packages/openapi-ts/vitest.config.e2e.ts b/packages/openapi-ts/vitest.config.e2e.ts index ae277b99b..19429c285 100644 --- a/packages/openapi-ts/vitest.config.e2e.ts +++ b/packages/openapi-ts/vitest.config.e2e.ts @@ -2,10 +2,8 @@ import { fileURLToPath } from 'node:url'; import { defineConfig } from 'vitest/config'; -import { handlebarsPlugin } from './rollup.config'; - export default defineConfig({ - plugins: [handlebarsPlugin()], + plugins: [], test: { // Dont run tests in parallel. This is to ensure the test server can start up. // And that the port was not previously taken. diff --git a/packages/openapi-ts/vitest.config.unit.ts b/packages/openapi-ts/vitest.config.unit.ts index 2b1683955..0da11e718 100644 --- a/packages/openapi-ts/vitest.config.unit.ts +++ b/packages/openapi-ts/vitest.config.unit.ts @@ -2,10 +2,8 @@ import { fileURLToPath } from 'node:url'; import { configDefaults, defineConfig } from 'vitest/config'; -import { handlebarsPlugin } from './rollup.config'; - export default defineConfig({ - plugins: [handlebarsPlugin()], + plugins: [], test: { coverage: { exclude: ['bin', 'dist', 'src/**/*.d.ts'], diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index a226610bd..68d2e5565 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -8,21 +8,15 @@ importers: .: devDependencies: + '@arethetypeswrong/cli': + specifier: 0.16.4 + version: 0.16.4 '@changesets/changelog-github': specifier: 0.5.0 version: 0.5.0(encoding@0.1.13) '@changesets/cli': specifier: 2.27.7 version: 2.27.7 - '@rollup/plugin-commonjs': - specifier: 26.0.1 - version: 26.0.1(rollup@4.18.0) - '@rollup/plugin-terser': - specifier: 0.4.4 - version: 0.4.4(rollup@4.18.0) - '@rollup/plugin-typescript': - specifier: 11.1.6 - version: 11.1.6(rollup@4.18.0)(tslib@2.6.3)(typescript@5.5.3) '@types/node': specifier: 20.14.10 version: 20.14.10 @@ -62,15 +56,9 @@ importers: prettier: specifier: 3.3.2 version: 3.3.2 - rimraf: - specifier: 5.0.8 - version: 5.0.8 - rollup: - specifier: 4.18.0 - version: 4.18.0 - rollup-plugin-dts: - specifier: 6.1.1 - version: 6.1.1(rollup@4.18.0)(typescript@5.5.3) + tsup: + specifier: 8.3.0 + version: 8.3.0(@microsoft/api-extractor@7.47.9(@types/node@20.14.10))(jiti@1.21.6)(postcss@8.4.45)(typescript@5.5.3)(yaml@2.4.5) typescript: specifier: 5.5.3 version: 5.5.3 @@ -526,12 +514,6 @@ importers: '@hey-api/client-fetch': specifier: workspace:* version: link:../client-fetch - '@rollup/plugin-json': - specifier: 6.1.0 - version: 6.1.0(rollup@4.22.0) - '@rollup/plugin-node-resolve': - specifier: 15.2.3 - version: 15.2.3(rollup@4.22.0) '@tanstack/react-query': specifier: 5.56.2 version: 5.56.2(react@18.3.1) @@ -662,6 +644,9 @@ packages: resolution: {integrity: sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw==} engines: {node: '>=6.0.0'} + '@andrewbranch/untar.js@1.0.3': + resolution: {integrity: sha512-Jh15/qVmrLGhkKJBdXlK1+9tY4lZruYjsgkDFj08ZmDiWVBLJcqkok7Z0/R0In+i1rScBpJlSvrTS2Lm41Pbnw==} + '@angular-devkit/architect@0.1703.7': resolution: {integrity: sha512-SwXbdsZqEE3JtvujCLChAii+FA20d1931VDjDYffrGWdQEViTBAr4NKtDr/kOv8KkgiL3fhGibPnRNUHTeAMtg==} engines: {node: ^18.13.0 || >=20.9.0, npm: ^6.11.0 || ^7.5.6 || >=8.0.0, yarn: '>= 1.13.0'} @@ -814,6 +799,15 @@ packages: resolution: {integrity: sha512-pRrmXMCwnmrkS3MLgAIW5dXRzeTv6GLjkjb4HmxNnvAKXN1Nfzp4KmGADBQvlVUcqi+a5D+hfGDLLnd5NnYxog==} engines: {node: '>= 16'} + '@arethetypeswrong/cli@0.16.4': + resolution: {integrity: sha512-qMmdVlJon5FtA+ahn0c1oAVNxiq4xW5lqFiTZ21XHIeVwAVIQ+uRz4UEivqRMsjVV1grzRgJSKqaOrq1MvlVyQ==} + engines: {node: '>=18'} + hasBin: true + + '@arethetypeswrong/core@0.16.4': + resolution: {integrity: sha512-RI3HXgSuKTfcBf1hSEg1P9/cOvmI0flsMm6/QL3L3wju4AlHDqd55JFPfXs4pzgEAgy5L9pul4/HPPz99x2GvA==} + engines: {node: '>=18'} + '@babel/code-frame@7.24.7': resolution: {integrity: sha512-BcYH1CVJBO9tvyIZ2jVeXgSIMvGZ2FDRvDdOIVQyuklNKSsx+eppDEBq/g47Ayw+RqNFE+URvOShmf+f/qwAlA==} engines: {node: '>=6.9.0'} @@ -1564,6 +1558,10 @@ packages: '@changesets/write@0.3.1': resolution: {integrity: sha512-SyGtMXzH3qFqlHKcvFY2eX+6b0NGiFcNav8AFsYwy5l8hejOeoeTDemu5Yjmke2V5jpzY+pBvM0vCCQ3gdZpfw==} + '@colors/colors@1.5.0': + resolution: {integrity: sha512-ooWCrlZP11i8GImSjTHYHLkvFDP48nS4+204nGb1RiX/WXYHmJA2III9/e2DWVabCESdW7hBAEzHRqUn9OUVvQ==} + engines: {node: '>=0.1.90'} + '@cspotcode/source-map-support@0.8.1': resolution: {integrity: sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==} engines: {node: '>=12'} @@ -1613,6 +1611,12 @@ packages: cpu: [ppc64] os: [aix] + '@esbuild/aix-ppc64@0.23.1': + resolution: {integrity: sha512-6VhYk1diRqrhBAqpJEdjASR/+WVRtfjpqKuNw11cLiaWpAT/Uu+nokB+UJnevzy/P9C/ty6AOe0dwueMrGh/iQ==} + engines: {node: '>=18'} + cpu: [ppc64] + os: [aix] + '@esbuild/android-arm64@0.19.12': resolution: {integrity: sha512-P0UVNGIienjZv3f5zq0DP3Nt2IE/3plFzuaS96vihvD0Hd6H/q4WXUGpCxD/E8YrSXfNyRPbpTq+T8ZQioSuPA==} engines: {node: '>=12'} @@ -1631,6 +1635,12 @@ packages: cpu: [arm64] os: [android] + '@esbuild/android-arm64@0.23.1': + resolution: {integrity: sha512-xw50ipykXcLstLeWH7WRdQuysJqejuAGPd30vd1i5zSyKK3WE+ijzHmLKxdiCMtH1pHz78rOg0BKSYOSB/2Khw==} + engines: {node: '>=18'} + cpu: [arm64] + os: [android] + '@esbuild/android-arm@0.19.12': resolution: {integrity: sha512-qg/Lj1mu3CdQlDEEiWrlC4eaPZ1KztwGJ9B6J+/6G+/4ewxJg7gqj8eVYWvao1bXrqGiW2rsBZFSX3q2lcW05w==} engines: {node: '>=12'} @@ -1649,6 +1659,12 @@ packages: cpu: [arm] os: [android] + '@esbuild/android-arm@0.23.1': + resolution: {integrity: sha512-uz6/tEy2IFm9RYOyvKl88zdzZfwEfKZmnX9Cj1BHjeSGNuGLuMD1kR8y5bteYmwqKm1tj8m4cb/aKEorr6fHWQ==} + engines: {node: '>=18'} + cpu: [arm] + os: [android] + '@esbuild/android-x64@0.19.12': resolution: {integrity: sha512-3k7ZoUW6Q6YqhdhIaq/WZ7HwBpnFBlW905Fa4s4qWJyiNOgT1dOqDiVAQFwBH7gBRZr17gLrlFCRzF6jFh7Kew==} engines: {node: '>=12'} @@ -1667,6 +1683,12 @@ packages: cpu: [x64] os: [android] + '@esbuild/android-x64@0.23.1': + resolution: {integrity: sha512-nlN9B69St9BwUoB+jkyU090bru8L0NA3yFvAd7k8dNsVH8bi9a8cUAUSEcEEgTp2z3dbEDGJGfP6VUnkQnlReg==} + engines: {node: '>=18'} + cpu: [x64] + os: [android] + '@esbuild/darwin-arm64@0.19.12': resolution: {integrity: sha512-B6IeSgZgtEzGC42jsI+YYu9Z3HKRxp8ZT3cqhvliEHovq8HSX2YX8lNocDn79gCKJXOSaEot9MVYky7AKjCs8g==} engines: {node: '>=12'} @@ -1685,6 +1707,12 @@ packages: cpu: [arm64] os: [darwin] + '@esbuild/darwin-arm64@0.23.1': + resolution: {integrity: sha512-YsS2e3Wtgnw7Wq53XXBLcV6JhRsEq8hkfg91ESVadIrzr9wO6jJDMZnCQbHm1Guc5t/CdDiFSSfWP58FNuvT3Q==} + engines: {node: '>=18'} + cpu: [arm64] + os: [darwin] + '@esbuild/darwin-x64@0.19.12': resolution: {integrity: sha512-hKoVkKzFiToTgn+41qGhsUJXFlIjxI/jSYeZf3ugemDYZldIXIxhvwN6erJGlX4t5h417iFuheZ7l+YVn05N3A==} engines: {node: '>=12'} @@ -1703,6 +1731,12 @@ packages: cpu: [x64] os: [darwin] + '@esbuild/darwin-x64@0.23.1': + resolution: {integrity: sha512-aClqdgTDVPSEGgoCS8QDG37Gu8yc9lTHNAQlsztQ6ENetKEO//b8y31MMu2ZaPbn4kVsIABzVLXYLhCGekGDqw==} + engines: {node: '>=18'} + cpu: [x64] + os: [darwin] + '@esbuild/freebsd-arm64@0.19.12': resolution: {integrity: sha512-4aRvFIXmwAcDBw9AueDQ2YnGmz5L6obe5kmPT8Vd+/+x/JMVKCgdcRwH6APrbpNXsPz+K653Qg8HB/oXvXVukA==} engines: {node: '>=12'} @@ -1721,6 +1755,12 @@ packages: cpu: [arm64] os: [freebsd] + '@esbuild/freebsd-arm64@0.23.1': + resolution: {integrity: sha512-h1k6yS8/pN/NHlMl5+v4XPfikhJulk4G+tKGFIOwURBSFzE8bixw1ebjluLOjfwtLqY0kewfjLSrO6tN2MgIhA==} + engines: {node: '>=18'} + cpu: [arm64] + os: [freebsd] + '@esbuild/freebsd-x64@0.19.12': resolution: {integrity: sha512-EYoXZ4d8xtBoVN7CEwWY2IN4ho76xjYXqSXMNccFSx2lgqOG/1TBPW0yPx1bJZk94qu3tX0fycJeeQsKovA8gg==} engines: {node: '>=12'} @@ -1739,6 +1779,12 @@ packages: cpu: [x64] os: [freebsd] + '@esbuild/freebsd-x64@0.23.1': + resolution: {integrity: sha512-lK1eJeyk1ZX8UklqFd/3A60UuZ/6UVfGT2LuGo3Wp4/z7eRTRYY+0xOu2kpClP+vMTi9wKOfXi2vjUpO1Ro76g==} + engines: {node: '>=18'} + cpu: [x64] + os: [freebsd] + '@esbuild/linux-arm64@0.19.12': resolution: {integrity: sha512-EoTjyYyLuVPfdPLsGVVVC8a0p1BFFvtpQDB/YLEhaXyf/5bczaGeN15QkR+O4S5LeJ92Tqotve7i1jn35qwvdA==} engines: {node: '>=12'} @@ -1757,6 +1803,12 @@ packages: cpu: [arm64] os: [linux] + '@esbuild/linux-arm64@0.23.1': + resolution: {integrity: sha512-/93bf2yxencYDnItMYV/v116zff6UyTjo4EtEQjUBeGiVpMmffDNUyD9UN2zV+V3LRV3/on4xdZ26NKzn6754g==} + engines: {node: '>=18'} + cpu: [arm64] + os: [linux] + '@esbuild/linux-arm@0.19.12': resolution: {integrity: sha512-J5jPms//KhSNv+LO1S1TX1UWp1ucM6N6XuL6ITdKWElCu8wXP72l9MM0zDTzzeikVyqFE6U8YAV9/tFyj0ti+w==} engines: {node: '>=12'} @@ -1775,6 +1827,12 @@ packages: cpu: [arm] os: [linux] + '@esbuild/linux-arm@0.23.1': + resolution: {integrity: sha512-CXXkzgn+dXAPs3WBwE+Kvnrf4WECwBdfjfeYHpMeVxWE0EceB6vhWGShs6wi0IYEqMSIzdOF1XjQ/Mkm5d7ZdQ==} + engines: {node: '>=18'} + cpu: [arm] + os: [linux] + '@esbuild/linux-ia32@0.19.12': resolution: {integrity: sha512-Thsa42rrP1+UIGaWz47uydHSBOgTUnwBwNq59khgIwktK6x60Hivfbux9iNR0eHCHzOLjLMLfUMLCypBkZXMHA==} engines: {node: '>=12'} @@ -1793,6 +1851,12 @@ packages: cpu: [ia32] os: [linux] + '@esbuild/linux-ia32@0.23.1': + resolution: {integrity: sha512-VTN4EuOHwXEkXzX5nTvVY4s7E/Krz7COC8xkftbbKRYAl96vPiUssGkeMELQMOnLOJ8k3BY1+ZY52tttZnHcXQ==} + engines: {node: '>=18'} + cpu: [ia32] + os: [linux] + '@esbuild/linux-loong64@0.19.12': resolution: {integrity: sha512-LiXdXA0s3IqRRjm6rV6XaWATScKAXjI4R4LoDlvO7+yQqFdlr1Bax62sRwkVvRIrwXxvtYEHHI4dm50jAXkuAA==} engines: {node: '>=12'} @@ -1811,6 +1875,12 @@ packages: cpu: [loong64] os: [linux] + '@esbuild/linux-loong64@0.23.1': + resolution: {integrity: sha512-Vx09LzEoBa5zDnieH8LSMRToj7ir/Jeq0Gu6qJ/1GcBq9GkfoEAoXvLiW1U9J1qE/Y/Oyaq33w5p2ZWrNNHNEw==} + engines: {node: '>=18'} + cpu: [loong64] + os: [linux] + '@esbuild/linux-mips64el@0.19.12': resolution: {integrity: sha512-fEnAuj5VGTanfJ07ff0gOA6IPsvrVHLVb6Lyd1g2/ed67oU1eFzL0r9WL7ZzscD+/N6i3dWumGE1Un4f7Amf+w==} engines: {node: '>=12'} @@ -1829,6 +1899,12 @@ packages: cpu: [mips64el] os: [linux] + '@esbuild/linux-mips64el@0.23.1': + resolution: {integrity: sha512-nrFzzMQ7W4WRLNUOU5dlWAqa6yVeI0P78WKGUo7lg2HShq/yx+UYkeNSE0SSfSure0SqgnsxPvmAUu/vu0E+3Q==} + engines: {node: '>=18'} + cpu: [mips64el] + os: [linux] + '@esbuild/linux-ppc64@0.19.12': resolution: {integrity: sha512-nYJA2/QPimDQOh1rKWedNOe3Gfc8PabU7HT3iXWtNUbRzXS9+vgB0Fjaqr//XNbd82mCxHzik2qotuI89cfixg==} engines: {node: '>=12'} @@ -1847,6 +1923,12 @@ packages: cpu: [ppc64] os: [linux] + '@esbuild/linux-ppc64@0.23.1': + resolution: {integrity: sha512-dKN8fgVqd0vUIjxuJI6P/9SSSe/mB9rvA98CSH2sJnlZ/OCZWO1DJvxj8jvKTfYUdGfcq2dDxoKaC6bHuTlgcw==} + engines: {node: '>=18'} + cpu: [ppc64] + os: [linux] + '@esbuild/linux-riscv64@0.19.12': resolution: {integrity: sha512-2MueBrlPQCw5dVJJpQdUYgeqIzDQgw3QtiAHUC4RBz9FXPrskyyU3VI1hw7C0BSKB9OduwSJ79FTCqtGMWqJHg==} engines: {node: '>=12'} @@ -1865,6 +1947,12 @@ packages: cpu: [riscv64] os: [linux] + '@esbuild/linux-riscv64@0.23.1': + resolution: {integrity: sha512-5AV4Pzp80fhHL83JM6LoA6pTQVWgB1HovMBsLQ9OZWLDqVY8MVobBXNSmAJi//Csh6tcY7e7Lny2Hg1tElMjIA==} + engines: {node: '>=18'} + cpu: [riscv64] + os: [linux] + '@esbuild/linux-s390x@0.19.12': resolution: {integrity: sha512-+Pil1Nv3Umes4m3AZKqA2anfhJiVmNCYkPchwFJNEJN5QxmTs1uzyy4TvmDrCRNT2ApwSari7ZIgrPeUx4UZDg==} engines: {node: '>=12'} @@ -1883,6 +1971,12 @@ packages: cpu: [s390x] os: [linux] + '@esbuild/linux-s390x@0.23.1': + resolution: {integrity: sha512-9ygs73tuFCe6f6m/Tb+9LtYxWR4c9yg7zjt2cYkjDbDpV/xVn+68cQxMXCjUpYwEkze2RcU/rMnfIXNRFmSoDw==} + engines: {node: '>=18'} + cpu: [s390x] + os: [linux] + '@esbuild/linux-x64@0.19.12': resolution: {integrity: sha512-B71g1QpxfwBvNrfyJdVDexenDIt1CiDN1TIXLbhOw0KhJzE78KIFGX6OJ9MrtC0oOqMWf+0xop4qEU8JrJTwCg==} engines: {node: '>=12'} @@ -1901,6 +1995,12 @@ packages: cpu: [x64] os: [linux] + '@esbuild/linux-x64@0.23.1': + resolution: {integrity: sha512-EV6+ovTsEXCPAp58g2dD68LxoP/wK5pRvgy0J/HxPGB009omFPv3Yet0HiaqvrIrgPTBuC6wCH1LTOY91EO5hQ==} + engines: {node: '>=18'} + cpu: [x64] + os: [linux] + '@esbuild/netbsd-x64@0.19.12': resolution: {integrity: sha512-3ltjQ7n1owJgFbuC61Oj++XhtzmymoCihNFgT84UAmJnxJfm4sYCiSLTXZtE00VWYpPMYc+ZQmB6xbSdVh0JWA==} engines: {node: '>=12'} @@ -1919,6 +2019,18 @@ packages: cpu: [x64] os: [netbsd] + '@esbuild/netbsd-x64@0.23.1': + resolution: {integrity: sha512-aevEkCNu7KlPRpYLjwmdcuNz6bDFiE7Z8XC4CPqExjTvrHugh28QzUXVOZtiYghciKUacNktqxdpymplil1beA==} + engines: {node: '>=18'} + cpu: [x64] + os: [netbsd] + + '@esbuild/openbsd-arm64@0.23.1': + resolution: {integrity: sha512-3x37szhLexNA4bXhLrCC/LImN/YtWis6WXr1VESlfVtVeoFJBRINPJ3f0a/6LV8zpikqoUg4hyXw0sFBt5Cr+Q==} + engines: {node: '>=18'} + cpu: [arm64] + os: [openbsd] + '@esbuild/openbsd-x64@0.19.12': resolution: {integrity: sha512-RbrfTB9SWsr0kWmb9srfF+L933uMDdu9BIzdA7os2t0TXhCRjrQyCeOt6wVxr79CKD4c+p+YhCj31HBkYcXebw==} engines: {node: '>=12'} @@ -1937,6 +2049,12 @@ packages: cpu: [x64] os: [openbsd] + '@esbuild/openbsd-x64@0.23.1': + resolution: {integrity: sha512-aY2gMmKmPhxfU+0EdnN+XNtGbjfQgwZj43k8G3fyrDM/UdZww6xrWxmDkuz2eCZchqVeABjV5BpildOrUbBTqA==} + engines: {node: '>=18'} + cpu: [x64] + os: [openbsd] + '@esbuild/sunos-x64@0.19.12': resolution: {integrity: sha512-HKjJwRrW8uWtCQnQOz9qcU3mUZhTUQvi56Q8DPTLLB+DawoiQdjsYq+j+D3s9I8VFtDr+F9CjgXKKC4ss89IeA==} engines: {node: '>=12'} @@ -1955,6 +2073,12 @@ packages: cpu: [x64] os: [sunos] + '@esbuild/sunos-x64@0.23.1': + resolution: {integrity: sha512-RBRT2gqEl0IKQABT4XTj78tpk9v7ehp+mazn2HbUeZl1YMdaGAQqhapjGTCe7uw7y0frDi4gS0uHzhvpFuI1sA==} + engines: {node: '>=18'} + cpu: [x64] + os: [sunos] + '@esbuild/win32-arm64@0.19.12': resolution: {integrity: sha512-URgtR1dJnmGvX864pn1B2YUYNzjmXkuJOIqG2HdU62MVS4EHpU2946OZoTMnRUHklGtJdJZ33QfzdjGACXhn1A==} engines: {node: '>=12'} @@ -1973,6 +2097,12 @@ packages: cpu: [arm64] os: [win32] + '@esbuild/win32-arm64@0.23.1': + resolution: {integrity: sha512-4O+gPR5rEBe2FpKOVyiJ7wNDPA8nGzDuJ6gN4okSA1gEOYZ67N8JPk58tkWtdtPeLz7lBnY6I5L3jdsr3S+A6A==} + engines: {node: '>=18'} + cpu: [arm64] + os: [win32] + '@esbuild/win32-ia32@0.19.12': resolution: {integrity: sha512-+ZOE6pUkMOJfmxmBZElNOx72NKpIa/HFOMGzu8fqzQJ5kgf6aTGrcJaFsNiVMH4JKpMipyK+7k0n2UXN7a8YKQ==} engines: {node: '>=12'} @@ -1991,6 +2121,12 @@ packages: cpu: [ia32] os: [win32] + '@esbuild/win32-ia32@0.23.1': + resolution: {integrity: sha512-BcaL0Vn6QwCwre3Y717nVHZbAa4UBEigzFm6VdsVdT/MbZ38xoj1X9HPkZhbmaBGUD1W8vxAfffbDe8bA6AKnQ==} + engines: {node: '>=18'} + cpu: [ia32] + os: [win32] + '@esbuild/win32-x64@0.19.12': resolution: {integrity: sha512-T1QyPSDCyMXaO3pzBkF96E8xMkiRYbUEZADd29SyPGabqxMViNoii+NcK7eWJAEoU6RZyEm5lVSIjTmcdoB9HA==} engines: {node: '>=12'} @@ -2009,6 +2145,12 @@ packages: cpu: [x64] os: [win32] + '@esbuild/win32-x64@0.23.1': + resolution: {integrity: sha512-BHpFFeslkWrXWyUPnbKm+xYYVYruCinGcftSBaa8zoF9hZO4BcSCFUvHVTtzpIY6YzUnYtuEhZ+C9iEXjxnasg==} + engines: {node: '>=18'} + cpu: [x64] + os: [win32] + '@eslint-community/eslint-utils@4.4.0': resolution: {integrity: sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} @@ -2133,6 +2275,19 @@ packages: '@manypkg/get-packages@1.1.3': resolution: {integrity: sha512-fo+QhuU3qE/2TQMQmbVMqaQ6EWbMhi4ABWP+O4AM1NqPBuy0OrApV5LO6BrrgnhtAHS2NH6RrVk9OL181tTi8A==} + '@microsoft/api-extractor-model@7.29.8': + resolution: {integrity: sha512-t3Z/xcO6TRbMcnKGVMs4uMzv/gd5j0NhMiJIGjD4cJMeFJ1Hf8wnLSx37vxlRlL0GWlGJhnFgxvnaL6JlS+73g==} + + '@microsoft/api-extractor@7.47.9': + resolution: {integrity: sha512-TTq30M1rikVsO5wZVToQT/dGyJY7UXJmjiRtkHPLb74Prx3Etw8+bX7Bv7iLuby6ysb7fuu1NFWqma+csym8Jw==} + hasBin: true + + '@microsoft/tsdoc-config@0.17.0': + resolution: {integrity: sha512-v/EYRXnCAIHxOHW+Plb6OWuUoMotxTN0GLatnpOb1xq0KuTNw/WI3pamJx/UbsoJP5k9MCw1QxvvhPcF9pH3Zg==} + + '@microsoft/tsdoc@0.15.0': + resolution: {integrity: sha512-HZpPoABogPvjeJOdzCOSJsXeL/SMCBgBZMVC3X3d7YYp2gf31MfxhUoYUNwf1ERPJOnQc0wkFn9trqI6ZEdZuA==} + '@neoconfetti/svelte@2.0.0': resolution: {integrity: sha512-n/Uu7/XmHc8w0uBci0QWBjgbRzLhfWsH8yPJ5pMaseIvzSwabXvB30nb3JjzEYNBp9uGt4eCeY7LUmxAjnJV8A==} @@ -2801,55 +2956,6 @@ packages: '@types/react-dom': optional: true - '@rollup/plugin-commonjs@26.0.1': - resolution: {integrity: sha512-UnsKoZK6/aGIH6AdkptXhNvhaqftcjq3zZdT+LY5Ftms6JR06nADcDsYp5hTU9E2lbJUEOhdlY5J4DNTneM+jQ==} - engines: {node: '>=16.0.0 || 14 >= 14.17'} - peerDependencies: - rollup: ^2.68.0||^3.0.0||^4.0.0 - peerDependenciesMeta: - rollup: - optional: true - - '@rollup/plugin-json@6.1.0': - resolution: {integrity: sha512-EGI2te5ENk1coGeADSIwZ7G2Q8CJS2sF120T7jLw4xFw9n7wIOXHo+kIYRAoVpJAN+kmqZSoO3Fp4JtoNF4ReA==} - engines: {node: '>=14.0.0'} - peerDependencies: - rollup: ^1.20.0||^2.0.0||^3.0.0||^4.0.0 - peerDependenciesMeta: - rollup: - optional: true - - '@rollup/plugin-node-resolve@15.2.3': - resolution: {integrity: sha512-j/lym8nf5E21LwBT4Df1VD6hRO2L2iwUeUmP7litikRsVp1H6NWx20NEp0Y7su+7XGc476GnXXc4kFeZNGmaSQ==} - engines: {node: '>=14.0.0'} - peerDependencies: - rollup: ^2.78.0||^3.0.0||^4.0.0 - peerDependenciesMeta: - rollup: - optional: true - - '@rollup/plugin-terser@0.4.4': - resolution: {integrity: sha512-XHeJC5Bgvs8LfukDwWZp7yeqin6ns8RTl2B9avbejt6tZqsqvVoWI7ZTQrcNsfKEDWBTnTxM8nMDkO2IFFbd0A==} - engines: {node: '>=14.0.0'} - peerDependencies: - rollup: ^2.0.0||^3.0.0||^4.0.0 - peerDependenciesMeta: - rollup: - optional: true - - '@rollup/plugin-typescript@11.1.6': - resolution: {integrity: sha512-R92yOmIACgYdJ7dJ97p4K69I8gg6IEHt8M7dUBxN3W6nrO8uUxX5ixl0yU/N3aZTi8WhPuICvOHXQvF6FaykAA==} - engines: {node: '>=14.0.0'} - peerDependencies: - rollup: ^2.14.0||^3.0.0||^4.0.0 - tslib: '*' - typescript: '>=3.7.0' - peerDependenciesMeta: - rollup: - optional: true - tslib: - optional: true - '@rollup/pluginutils@5.1.0': resolution: {integrity: sha512-XTIWOPPcpvyKI6L1NHo0lFlCyznUEyPmPY1mc3KpPVDYulHSTvyeLNVW00QTLIAFNhR3kYnJTQHeGqU4M3n09g==} engines: {node: '>=14.0.0'} @@ -3022,6 +3128,28 @@ packages: '@rushstack/eslint-patch@1.10.4': resolution: {integrity: sha512-WJgX9nzTqknM393q1QJDJmoW28kUfEnybeTfVNcNAPnIx210RXm2DiXiHzfNPJNIUUb1tJnz/l4QGtJ30PgWmA==} + '@rushstack/node-core-library@5.9.0': + resolution: {integrity: sha512-MMsshEWkTbXqxqFxD4gcIUWQOCeBChlGczdZbHfqmNZQFLHB3yWxDFSMHFUdu2/OB9NUk7Awn5qRL+rws4HQNg==} + peerDependencies: + '@types/node': '*' + peerDependenciesMeta: + '@types/node': + optional: true + + '@rushstack/rig-package@0.5.3': + resolution: {integrity: sha512-olzSSjYrvCNxUFZowevC3uz8gvKr3WTpHQ7BkpjtRpA3wK+T0ybep/SRUMfr195gBzJm5gaXw0ZMgjIyHqJUow==} + + '@rushstack/terminal@0.14.2': + resolution: {integrity: sha512-2fC1wqu1VCExKC0/L+0noVcFQEXEnoBOtCIex1TOjBzEDWcw8KzJjjj7aTP6mLxepG0XIyn9OufeFb6SFsa+sg==} + peerDependencies: + '@types/node': '*' + peerDependenciesMeta: + '@types/node': + optional: true + + '@rushstack/ts-command-line@4.22.8': + resolution: {integrity: sha512-XbFjOoV7qZHJnSuFUHv0pKaFA4ixyCuki+xMjsMfDwfvQjs5MYG0IK5COal3tRnG7KCDe2l/G+9LrzYE/RJhgg==} + '@schematics/angular@17.3.7': resolution: {integrity: sha512-HaJroKaberriP4wFefTTSVFrtU9GMvnG3I6ELbOteOyKMH7o2V91FXGJDJ5KnIiLRlBmC30G3r+9Ybc/rtAYkw==} engines: {node: ^18.13.0 || >=20.9.0, npm: ^6.11.0 || ^7.5.6 || >=8.0.0, yarn: '>= 1.13.0'} @@ -3059,6 +3187,10 @@ packages: '@sinclair/typebox@0.27.8': resolution: {integrity: sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==} + '@sindresorhus/is@4.6.0': + resolution: {integrity: sha512-t09vSN3MdfsyCHoFcTRCH/iUtG7OJ0CsjzB8cjAmKc/va/kIgeDI/TxsigdncE/4be734m0cvIYwNaV4i2XqAw==} + engines: {node: '>=10'} + '@stackblitz/sdk@1.11.0': resolution: {integrity: sha512-DFQGANNkEZRzFk1/rDP6TcFdM82ycHE+zfl9C/M/jXlH68jiqHWHFMQURLELoD8koxvu/eW5uhg94NSAZlYrUQ==} @@ -3166,6 +3298,9 @@ packages: resolution: {integrity: sha512-92F7/SFyufn4DXsha9+QfKnN03JGqtMFMXgSHbZOo8JG59WkTni7UzAouNQDf7AuP9OAMxVOPQcqG3sB7w+kkg==} engines: {node: ^16.14.0 || >=18.0.0} + '@types/argparse@1.0.38': + resolution: {integrity: sha512-ebDJ9b0e702Yr7pWgB0jzm+CX4Srzz8RcXtLJDJB+BSccqMa36uyH/zUsSYao5+BD1ytv3k3rPYCq4mAE1hsXA==} + '@types/babel__core@7.20.5': resolution: {integrity: sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA==} @@ -3268,9 +3403,6 @@ packages: '@types/react@18.3.3': resolution: {integrity: sha512-hti/R0pS0q1/xx+TsI73XIqk26eBsISZ2R0wUijXIngRK9R/e7Xw/cXVxQK7R5JjW+SV4zGcn5hXjudkN/pLIw==} - '@types/resolve@1.20.2': - resolution: {integrity: sha512-60BCwRFOZCQhDncwQdxxeOEEkbc5dIMccYLwbxsS4TUNeVECQ/pBJ0j09mrHOl/JJvpRPGwO9SvE4nR2Nb/a4Q==} - '@types/retry@0.12.0': resolution: {integrity: sha512-wWKOClTTiizcZhXnPY4wikVAwmdYHp8q6DmC+EJUzAMsycb7HB32Kh9RN4+0gExjmPmZSAQjgURXIGATPegAvA==} @@ -3804,6 +3936,14 @@ packages: resolution: {integrity: sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA==} engines: {node: '>=8'} + ajv-draft-04@1.0.0: + resolution: {integrity: sha512-mv00Te6nmYbRp5DCwclxtt7yV/joXJPGS7nM+97GdxvuttCOfgI3K4U25zboyeX0O+myI8ERluxQe5wljMmVIw==} + peerDependencies: + ajv: ^8.5.0 + peerDependenciesMeta: + ajv: + optional: true + ajv-formats@2.1.1: resolution: {integrity: sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==} peerDependencies: @@ -3812,6 +3952,14 @@ packages: ajv: optional: true + ajv-formats@3.0.1: + resolution: {integrity: sha512-8iUql50EUR+uUcdRQ3HDqa6EVyo3docL8g5WJ3FNcWmu62IbkGUue/pEyLBW8VGKKucTPgqeks4fIU1DA4yowQ==} + peerDependencies: + ajv: ^8.0.0 + peerDependenciesMeta: + ajv: + optional: true + ajv-keywords@3.5.2: resolution: {integrity: sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ==} peerDependencies: @@ -3828,6 +3976,9 @@ packages: ajv@8.12.0: resolution: {integrity: sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA==} + ajv@8.13.0: + resolution: {integrity: sha512-PRA911Blj99jR5RMeTunVbNXMF6Lp4vZXnk5GQjcnUWUTsrXtekg/pnmFFI2u/I36Y/2bITGS30GZCXei6uNkA==} + ajv@8.16.0: resolution: {integrity: sha512-F0twR8U1ZU67JIEtekUcLkXkoO5mMMmgGD8sK/xUFzJ805jxHQl92hImFAqqXMyMYjSPOyUPAwHYhB72g5sTXw==} @@ -3846,6 +3997,10 @@ packages: resolution: {integrity: sha512-4nJ3yixlEthEJ9Rk4vPcdBRkZvQZlYyu8j4/Mqz5sgIkddmEnH2Yj2ZrnP9S3tQOvSNRUIgVNF/1yPpRAGNRig==} engines: {node: '>=14.16'} + ansi-escapes@7.0.0: + resolution: {integrity: sha512-GdYO7a61mR0fOlAsvC9/rIHf7L96sBc6dEWzeOu+KAea5bZyQRPIpojrVoI4AXGJS/ycu/fBTdLrUkA4ODrvjw==} + engines: {node: '>=18'} + ansi-html-community@0.0.8: resolution: {integrity: sha512-1APHAyr3+PCamwNw3bXCPp4HFLONZt/yIH0sZp0/469KWNTEy+qN5jQ3GVX6DMZ1UXAi34yVwtTeaG/HpBuuzw==} engines: {'0': node >= 0.8.0} @@ -4067,14 +4222,16 @@ packages: buffer@5.7.1: resolution: {integrity: sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==} - builtin-modules@3.3.0: - resolution: {integrity: sha512-zhaCDicdLuWN5UbN5IMnFqNMhNfo919sH85y2/ea+5Yg9TsTkeZxpL+JLbp6cgYFS4sRLp3YV4S6yDuqVWHYOw==} - engines: {node: '>=6'} - bundle-name@4.1.0: resolution: {integrity: sha512-tjwM5exMg6BGRI+kNmTntNsvdZS1X8BFYS6tnJ2hdH0kVxM6/eVZ2xy+FqStSWvYmtfFMDLIxurorHwDKfDz5Q==} engines: {node: '>=18'} + bundle-require@5.0.0: + resolution: {integrity: sha512-GuziW3fSSmopcx4KRymQEJVbZUfqlCqcq7dvs6TYwKRZiegK/2buMxQTPs6MGlNv50wms1699qYO54R8XfRX4w==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + peerDependencies: + esbuild: '>=0.18' + bytes@3.0.0: resolution: {integrity: sha512-pMhOfFDPiv9t5jjIXkHosWmkSyQbvsgEVNkz0ERHbuLh2T/7j4Mqqpz523Fe8MVY89KC6Sh/QfS2sM+SjgFDcw==} engines: {node: '>= 0.8'} @@ -4145,6 +4302,10 @@ packages: resolution: {integrity: sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w==} engines: {node: ^12.17.0 || ^14.13 || >=16.0.0} + char-regex@1.0.2: + resolution: {integrity: sha512-kWWXztvZ5SBQV+eRgKFeh8q5sLuZY2+8WUIzlxWVTg+oGwY14qylx1KbKzHd8P6ZYkAg0xyIDU9JMHhyJMZ1jw==} + engines: {node: '>=10'} + chardet@0.7.0: resolution: {integrity: sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==} @@ -4179,6 +4340,9 @@ packages: citty@0.1.6: resolution: {integrity: sha512-tskPPKEs8D2KPafUypv2gxwJP8h/OaJmC82QQGGDQcHvXX43xF2VDACcJVmZ0EuSxkpO9Kc4MlrA3q0+FG58AQ==} + cjs-module-lexer@1.4.1: + resolution: {integrity: sha512-cuSVIHi9/9E/+821Qjdvngor+xpnlwnuwIyZOaLmHBVdXL+gP+I6QQB9VkO7RI77YIcTV+S1W9AreJ5eN63JBA==} + classnames@2.3.2: resolution: {integrity: sha512-CSbhY4cFEJRe6/GQzIk5qXZ4Jeg5pcsP7b5peFSDpffpe1cqjASH/n9UTjBwOp6XpMSTwQ8Za2K5V02ueA7Tmw==} @@ -4194,10 +4358,19 @@ packages: resolution: {integrity: sha512-VGtlMu3x/4DOtIUwEkRezxUZ2lBacNJCHash0N0WeZDBS+7Ux1dm3XWAgWYxLJFMMdOeXMHXorshEFhbMSGelg==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + cli-highlight@2.1.11: + resolution: {integrity: sha512-9KDcoEVwyUXrjcJNvHD0NFc/hiwe/WPVYIleQh2O1N2Zro5gWJZ/K+3DGn8w8P/F6FxOgzyC5bxDyHIgCSPhGg==} + engines: {node: '>=8.0.0', npm: '>=5.0.0'} + hasBin: true + cli-spinners@2.9.2: resolution: {integrity: sha512-ywqV+5MmyL4E7ybXgKys4DugZbX0FC6LnwrhjuykIjnK9k8OQacQ7axGKnjDXWNhns0xot3bZI5h55H8yo9cJg==} engines: {node: '>=6'} + cli-table3@0.6.5: + resolution: {integrity: sha512-+W/5efTR7y5HRD7gACw9yQjqMVvEMLBHmboM/kPWam+H+Hmyrgjh6YncVKK122YZkXrLudzTuAukUw9FnMf7IQ==} + engines: {node: 10.* || >= 12.*} + cli-truncate@4.0.0: resolution: {integrity: sha512-nPdaFdQ0h/GEigbPClz11D0v/ZJEwxmeVZGeMo3Z5StPtUTkA9o1lD6QwoirYiSDzbcwn2XcjwmCp68W1IS4TA==} engines: {node: '>=18'} @@ -4206,6 +4379,9 @@ packages: resolution: {integrity: sha512-ouuZd4/dm2Sw5Gmqy6bGyNNNe1qt9RpmxveLSO7KcgsTnU7RXfsw+/bukWGo1abgBiMAic068rclZsO4IWmmxQ==} engines: {node: '>= 12'} + cliui@7.0.4: + resolution: {integrity: sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==} + cliui@8.0.1: resolution: {integrity: sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==} engines: {node: '>=12'} @@ -4259,9 +4435,6 @@ packages: common-path-prefix@3.0.0: resolution: {integrity: sha512-QE33hToZseCH3jS0qN96O/bSh3kaw/h+Tq7ngyY9eWDUnTlTNUyqfqvCXioLe5Na5jFsL78ra/wuBU4iuEgd4w==} - commondir@1.0.1: - resolution: {integrity: sha512-W9pAhw0ja1Edb5GVdIF1mjZw/ASI0AlShXM83UUGe2DVr5TdAPEA1OA8m/g8zWp9x6On7gqufY+FatDbC3MDQg==} - compressible@2.0.18: resolution: {integrity: sha512-AF3r7P5dWxL8MxyITRMlORQNaOA2IkAFaTr4k7BUumjPtRpGDTZpl0Pb1XCO6JeDCBdp126Cgs9sMxqSjgYyRg==} engines: {node: '>= 0.6'} @@ -4591,6 +4764,9 @@ packages: emoji-regex@9.2.2: resolution: {integrity: sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==} + emojilib@2.4.0: + resolution: {integrity: sha512-5U0rVMU5Y2n2+ykNLQqMoqklN9ICBT/KsvC1Gz6vqHbz2AXXGkG+Pm5rMWk/8Vjrr/mY9985Hi8DYzn1F09Nyw==} + emojis-list@3.0.0: resolution: {integrity: sha512-/kyM18EfinwXZbno9FyUGeFh87KC8HRQBQGildHZbEuRyWFOmv1U10o9BBp8XVZDVNNuQKyIGIu5ZYAAXJ0V2Q==} engines: {node: '>= 4'} @@ -4625,6 +4801,10 @@ packages: resolution: {integrity: sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A==} engines: {node: '>=6'} + environment@1.1.0: + resolution: {integrity: sha512-xUtoPkMggbz0MPyPiIWr1Kp4aeWJjDZ6SMvURhimjdZgsRuDplF5/s9hcgGhyXMhs+6vpnuoiZ2kFiu3FMnS8Q==} + engines: {node: '>=18'} + err-code@2.0.3: resolution: {integrity: sha512-2bmlRpNKBxT/CRmPOlyISQpNj+qSeYvcym/uT0Jx2bMOlKLtSy1ZmLuVxSEKKyor/N5yhvp/ZiG1oE3DEYMSFA==} @@ -4672,6 +4852,11 @@ packages: engines: {node: '>=12'} hasBin: true + esbuild@0.23.1: + resolution: {integrity: sha512-VVNz/9Sa0bs5SELtn3f7qhJCDPCF5oMEl5cO9/SSinpE9hbPVvxbd572HH5AKiP7WD8INO53GgfDDhRjkylHEg==} + engines: {node: '>=18'} + hasBin: true + escalade@3.1.2: resolution: {integrity: sha512-ErCHMCae19vR8vQGe50xIsVomy19rg6gFu3+r3jkEO46suLMWBksvVyoGgQV+jOfl84ZSOSlmv6Gxa89PmTGmA==} engines: {node: '>=6'} @@ -4918,10 +5103,21 @@ packages: fd-slicer@1.1.0: resolution: {integrity: sha512-cE1qsB/VwyQozZ+q1dGxR8LBYNZeofhEdUNGSMbQD3Gw2lAzX9Zb3uIU6Ebc/Fmyjo9AWWfnn0AUCHqtevs/8g==} + fdir@6.3.0: + resolution: {integrity: sha512-QOnuT+BOtivR77wYvCWHfGt9s4Pz1VIMbD463vegT5MLqNXy8rYFT/lPVEqf/bhYeT6qmqrNHhsX+rWwe3rOCQ==} + peerDependencies: + picomatch: ^3 || ^4 + peerDependenciesMeta: + picomatch: + optional: true + fetch-blob@3.2.0: resolution: {integrity: sha512-7yAQpD2UMJzLi1Dqv7qFYnPbaPx7ZfFK6PiIxQ4PfkGPyNyl2Ugx+a/umUonmKqjhM4DnfbMvdX6otXq83soQQ==} engines: {node: ^12.20 || >= 14.13} + fflate@0.8.2: + resolution: {integrity: sha512-cPJU47OaAoCbg0pBvzsgpTPhmhqI5eJjh/JIu8tPj5q+T7iLvW/JAYUqmE7KOB4R1ZyEhzBaIQpQpardBF5z8A==} + figures@3.2.0: resolution: {integrity: sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg==} engines: {node: '>=8'} @@ -5182,6 +5378,9 @@ packages: resolution: {integrity: sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==} hasBin: true + highlight.js@10.7.3: + resolution: {integrity: sha512-tzcUFauisWKNHaRkN4Wjl/ZA07gENAjFl3J/c480dprkGTg5EQstgaNFqBfUqCq54kZRIEcreTsAgF/m2quD7A==} + hookable@5.5.3: resolution: {integrity: sha512-Yc+BQe8SvoXH1643Qez1zqLRmbA5rCL+sSmk6TVos0LWVfNIB7PGncdlId77WzLGSIB5KaWgTaNTs2lNVEI6VQ==} @@ -5300,6 +5499,10 @@ packages: resolution: {integrity: sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==} engines: {node: '>=6'} + import-lazy@4.0.0: + resolution: {integrity: sha512-rKtvo6a868b5Hu3heneU+L4yEQ4jYKLtjpnPeUdK7h0yzXGmyBTypknlkCvHFBqfX9YlorEiMM6Dnq/5atfHkw==} + engines: {node: '>=8'} + import-meta-resolve@4.1.0: resolution: {integrity: sha512-I6fiaX09Xivtk+THaMfAwnA3MVA5Big1WHF1Dfx9hFuvNIWpXnorlkzhcQf6ehrqQiiZECRt1poOAkPmer3ruw==} @@ -5354,10 +5557,6 @@ packages: resolution: {integrity: sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==} engines: {node: '>=8'} - is-builtin-module@3.2.1: - resolution: {integrity: sha512-BSLE3HnV2syZ0FK0iMA/yUGplUeMmNz4AW5fnTunbCIqZi4vG3WjJT9FHMy5D69xmAYBHXQhJdALdpwVxV501A==} - engines: {node: '>=6'} - is-core-module@2.14.0: resolution: {integrity: sha512-a5dFJih5ZLYlRtDc0dZWP7RiKr6xIKzmn/oAYCDvdLThadVgyJwlaoQPmRtMSpz+rk0OGAgIu+TcM9HUF0fk1A==} engines: {node: '>= 0.4'} @@ -5404,9 +5603,6 @@ packages: is-lambda@1.0.1: resolution: {integrity: sha512-z7CMFGNrENq5iFB9Bqo64Xk6Y9sg+epq1myIcdHaGnbMTYOxvzsEtdYqQUylB7LxfkvgrrjP32T6Ywciio9UIQ==} - is-module@1.0.0: - resolution: {integrity: sha512-51ypPSPCoTEIN9dy5Oy+h4pShgJmPCygKfyRCISBI+JoWT/2oJvK8QPxmwv7b/p239jXrm9M1mlQbyKJ5A152g==} - is-number@7.0.0: resolution: {integrity: sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==} engines: {node: '>=0.12.0'} @@ -5426,9 +5622,6 @@ packages: is-potential-custom-element-name@1.0.1: resolution: {integrity: sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ==} - is-reference@1.2.1: - resolution: {integrity: sha512-U82MsXXiFIrjCK4otLT+o2NA2Cd2g5MLoOVXUZjIOhLurrRxpEXzI8O0KZHr3IjLvlAH1kTPYSuqer5T9ZVBKQ==} - is-reference@3.0.2: resolution: {integrity: sha512-v3rht/LgVcsdZa3O2Nqs+NMowLOxeOm7Ay9+/ARQ2F+qEoANRcqrjAZKGN0v8ymUetZGgkp26LTnGT7H0Qo9Pg==} @@ -5513,6 +5706,13 @@ packages: resolution: {integrity: sha512-2yTgeWTWzMWkHu6Jp9NKgePDaYHbntiwvYuuJLbbN9vl7DC9DvXKOB2BC3ZZ92D3cvV/aflH0osDfwpHepQ53w==} hasBin: true + jju@1.4.0: + resolution: {integrity: sha512-8wb9Yw966OSxApiCt0K3yNJL8pnNeIv+OEq2YMidz4FKP6nonSRoOXc80iXY4JaN2FC11B9qsNmDsm+ZOfMROA==} + + joycon@3.1.1: + resolution: {integrity: sha512-34wB/Y7MW7bzjKRjUKTa46I2Z7eV62Rkhva+KkopW7Qvv/OSWBqvkSY7vusOPrNuZcUG3tApvdVgNB8POj3SPw==} + engines: {node: '>=10'} + js-beautify@1.15.1: resolution: {integrity: sha512-ESjNzSlt/sWE8sciZH8kBF8BPlwXPwhR6pWKAw8bw4Bwj+iZcnKW6ONWUutJ7eObuBZQpiIb8S7OYspWrKt7rA==} engines: {node: '>=14'} @@ -5668,6 +5868,10 @@ packages: resolution: {integrity: sha512-Lllokma2mtoniUOS94CcOErHWAug5iu7HOmDrvWgpw8jyQH2fomgB+7lZS4HWZxytUuQwkGOwe49FvwVaA85Xw==} engines: {node: '>=18.0.0'} + load-tsconfig@0.2.5: + resolution: {integrity: sha512-IXO6OCs9yg8tMKzfPZ1YmheJbZCiEsnBdcB03l0OcfK9prKnJb96siuHCr5Fl37/yo9DnKU+TLpxzTUspw9shg==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + load-yaml-file@0.2.0: resolution: {integrity: sha512-OfCBkGEw4nN6JLtgRidPX6QxjBQGQf72q3si2uvqyFEMbycSFFHwAZeXx6cJgFM9wmLrf9zBwCP3Ivqa+LLZPw==} engines: {node: '>=6'} @@ -5709,6 +5913,9 @@ packages: lodash.merge@4.6.2: resolution: {integrity: sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==} + lodash.sortby@4.7.0: + resolution: {integrity: sha512-HDWXG8isMntAyRF5vZ7xKuEvOhT4AhlRt/3czTSjvGUxjYCBVRQY48ViDHyfYz9VIoBkW4TMGQNapx+l3RUwdA==} + lodash.startcase@4.4.0: resolution: {integrity: sha512-+WKqsK294HMSc2jEbNgpHpd0JfIBhp7rEV4aqXWqFr6AlXov+SlcgB1Fv01y2kGe3Gc8nMW7VA0SrGuSkRfIEg==} @@ -5737,6 +5944,9 @@ packages: resolution: {integrity: sha512-bfJaPTuEiTYBu+ulDaeQ0F+uLmlfFkMgXj4cbwfuMSjgObGMzb55FMMbDvbRU0fAHZ4sLGkz2mKwcMg8Dvm8Ww==} engines: {node: '>=18'} + lru-cache@10.4.3: + resolution: {integrity: sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==} + lru-cache@4.1.5: resolution: {integrity: sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g==} @@ -5782,6 +5992,17 @@ packages: mark.js@8.11.1: resolution: {integrity: sha512-1I+1qpDt4idfgLQG+BNWmrqku+7/2bi5nLf4YwF8y8zXvmfiTBY3PV3ZibfrjBueCByROpuBjLLFCajqkgYoLQ==} + marked-terminal@7.1.0: + resolution: {integrity: sha512-+pvwa14KZL74MVXjYdPR3nSInhGhNvPce/3mqLVZT2oUvt654sL1XImFuLZ1pkA866IYZ3ikDTOFUIC7XzpZZg==} + engines: {node: '>=16.0.0'} + peerDependencies: + marked: '>=1 <14' + + marked@9.1.6: + resolution: {integrity: sha512-jcByLnIFkd5gSXZmjNvS1TlmRhCXZjIzHYlaGkPlLIekG55JDR2Z4va9tZwCiP+/RDERiNhMOFu01xd6O5ct1Q==} + engines: {node: '>= 16'} + hasBin: true + mdn-data@2.0.30: resolution: {integrity: sha512-GaqWWShW4kv/G9IEucWScBx9G1/vsFZZJUO+tD26M8J8z3Kw5RDQjaoZe03YAClgeS/SWPOcb4nkFBTEi5DUEA==} @@ -5849,6 +6070,9 @@ packages: minimalistic-assert@1.0.1: resolution: {integrity: sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==} + minimatch@3.0.8: + resolution: {integrity: sha512-6FsRAQsxQ61mw+qP1ZzbL9Bc78x2p5OqNgNpnoAFLTrX8n5Kxph0CsnhmKKNXTWjXqU5L0pGPR7hYk+XWZr60Q==} + minimatch@3.1.2: resolution: {integrity: sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==} @@ -5989,6 +6213,10 @@ packages: resolution: {integrity: sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==} engines: {node: '>=10.5.0'} + node-emoji@2.1.3: + resolution: {integrity: sha512-E2WEOVsgs7O16zsURJ/eH8BqhF029wGpEOnv7Urwdo2wmQanOACwJQh0devF9D9RhoZru0+9JXIS0dBXIAz+lA==} + engines: {node: '>=18'} + node-fetch-native@1.6.4: resolution: {integrity: sha512-IhOigYzAKHd244OC0JIMIUrjzctirCmPkaIfhDeGcEETWof5zKYUW7e7MYvChGWh/4CJeXEgsRyGzuF334rOOQ==} @@ -6232,9 +6460,18 @@ packages: parse5-html-rewriting-stream@7.0.0: resolution: {integrity: sha512-mazCyGWkmCRWDI15Zp+UiCqMp/0dgEmkZRvhlsqqKYr4SsVm/TvnSpD9fCvqCA2zoWJcfRym846ejWBBHRiYEg==} + parse5-htmlparser2-tree-adapter@6.0.1: + resolution: {integrity: sha512-qPuWvbLgvDGilKc5BoicRovlT4MtYT6JfJyBOMDsKoiT+GiuP5qyrPCnR9HcPECIJJmZh5jRndyNThnhhb/vlA==} + parse5-sax-parser@7.0.0: resolution: {integrity: sha512-5A+v2SNsq8T6/mG3ahcz8ZtQ0OUFTatxPbeidoMB7tkJSGDY3tdfl4MHovtLQHkEn5CGxijNWRQHhRQ6IRpXKg==} + parse5@5.1.1: + resolution: {integrity: sha512-ugq4DFI0Ptb+WWjAdOK16+u/nHfiIrcE+sh8kZMaM0WllQKLI9rOUq6c2b7cwPkXdzfQESqvoqK6ug7U/Yyzug==} + + parse5@6.0.1: + resolution: {integrity: sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw==} + parse5@7.1.2: resolution: {integrity: sha512-Czj1WaSVpaoj0wbhMzLmWD69anp2WH7FXMB9n1Sy8/ZFF9jolSQVMu1Ij5WIyGmcBmhk7EOndpO4mIpihVqAXw==} @@ -6309,6 +6546,10 @@ packages: resolution: {integrity: sha512-xUXwsxNjwTQ8K3GnT4pCJm+xq3RUPQbmkYJTP5aFIfNIvbcc/4MUxgBaaRSZJ6yGJZiGSyYlM6MzwTsRk8SYCg==} engines: {node: '>=12'} + picomatch@4.0.2: + resolution: {integrity: sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg==} + engines: {node: '>=12'} + pidtree@0.6.0: resolution: {integrity: sha512-eG2dWTVw5bzqGRztnHExczNxt5VGsE6OwTeCG3fdUf9KBsZzO3R5OIIIzWR+iZA0NtZ+RDVdaoE2dK1cn6jH4g==} engines: {node: '>=0.10'} @@ -6391,6 +6632,24 @@ packages: ts-node: optional: true + postcss-load-config@6.0.1: + resolution: {integrity: sha512-oPtTM4oerL+UXmx+93ytZVN82RrlY/wPUV8IeDxFrzIjXOLF1pN+EmKPLbubvKHT2HC20xXsCAH2Z+CKV6Oz/g==} + engines: {node: '>= 18'} + peerDependencies: + jiti: '>=1.21.0' + postcss: '>=8.0.9' + tsx: ^4.8.1 + yaml: ^2.4.2 + peerDependenciesMeta: + jiti: + optional: true + postcss: + optional: true + tsx: + optional: true + yaml: + optional: true + postcss-loader@8.1.1: resolution: {integrity: sha512-0IeqyAsG6tYiDRCYKQJLAmgQr47DX6N7sFSWvQxt6AcupX8DIdmykuk/o/tx0Lze3ErGHJEp5OSRxrelC6+NdQ==} engines: {node: '>= 18.12.0'} @@ -6772,18 +7031,6 @@ packages: deprecated: Rimraf versions prior to v4 are no longer supported hasBin: true - rimraf@5.0.8: - resolution: {integrity: sha512-XSh0V2/yNhDEi8HwdIefD8MLgs4LQXPag/nEJWs3YUc3Upn+UHa1GyIkEg9xSSNt7HnkO5FjTvmcRzgf+8UZuw==} - engines: {node: '>=18'} - hasBin: true - - rollup-plugin-dts@6.1.1: - resolution: {integrity: sha512-aSHRcJ6KG2IHIioYlvAOcEq6U99sVtqDDKVhnwt70rW6tsz3tv5OSjEiWcgzfsHdLyGXZ/3b/7b/+Za3Y6r1XA==} - engines: {node: '>=16'} - peerDependencies: - rollup: ^3.29.4 || ^4 - typescript: ^4.5 || ^5.0 - rollup@4.18.0: resolution: {integrity: sha512-QmJz14PX3rzbJCN1SG4Xe/bAAX2a6NpCP8ab2vfu2GiUr8AQcr2nCV/oEO3yneFarB67zk8ShlIyWb2LGTb3Sg==} engines: {node: '>=18.0.0', npm: '>=8.0.0'} @@ -6892,6 +7139,11 @@ packages: resolution: {integrity: sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==} hasBin: true + semver@7.5.4: + resolution: {integrity: sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==} + engines: {node: '>=10'} + hasBin: true + semver@7.6.0: resolution: {integrity: sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg==} engines: {node: '>=10'} @@ -6988,6 +7240,10 @@ packages: resolution: {integrity: sha512-94Bdh3cC2PKrbgSOUqTiGPWVZeSiXfKOVZNJniWoqrWrRkB1CJzBU3NEbiTsPcYy1lDsANA/THzS+9WBiy5nfQ==} engines: {node: '>= 10'} + skin-tone@2.0.0: + resolution: {integrity: sha512-kUMbT1oBJCpgrnKoSr0o6wPtvRWT9W9UKvGLwfJYO2WuahZRHOpEyL1ckyMGgMWh0UdpmaoFqKKD29WTomNEGA==} + engines: {node: '>=8'} + slash@3.0.0: resolution: {integrity: sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==} engines: {node: '>=8'} @@ -7008,9 +7264,6 @@ packages: resolution: {integrity: sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==} engines: {node: '>= 6.0.0', npm: '>= 3.0.0'} - smob@1.5.0: - resolution: {integrity: sha512-g6T+p7QO8npa+/hNx9ohv1E5pVCmWrVCUzUXJyLdMmftX6ER0oiWY/w9knEonLpnOp6b6FenKnMfR8gqwWdwig==} - sockjs@0.3.24: resolution: {integrity: sha512-GJgLTZ7vYb/JtPSSZ10hsOYIvEYsjbNU+zPdIHcUaWVNUEPivzxku31865sSSud0Da0W4lEeOPlmw93zLQchuQ==} @@ -7050,6 +7303,10 @@ packages: resolution: {integrity: sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA==} engines: {node: '>= 8'} + source-map@0.8.0-beta.0: + resolution: {integrity: sha512-2ymg6oRBpebeZi9UUNsgQ89bhx01TcTkmNTGnNO88imTmbSgy4nfujrgVEFKWpMTEGA11EDkTt7mqObTPdigIA==} + engines: {node: '>= 8'} + spawndamnit@2.0.0: resolution: {integrity: sha512-j4JKEcncSjFlqIwU5L/rp2N5SIPsdxaRsIv678+TZxZ0SRDJTm8JrxJMjE/XuiEZNEir3S8l0Fa3Ke339WI4qA==} @@ -7177,6 +7434,10 @@ packages: resolution: {integrity: sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==} engines: {node: '>=10'} + supports-hyperlinks@3.1.0: + resolution: {integrity: sha512-2rn0BZ+/f7puLOHZm1HOJfwBggfaHXUpPUSSG/SWM4TWp5KCfmNYwnC3hruy2rZlMnmWZ+QAGpZfchu3f3695A==} + engines: {node: '>=14.18'} + supports-preserve-symlinks-flag@1.0.0: resolution: {integrity: sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==} engines: {node: '>= 0.4'} @@ -7343,6 +7604,10 @@ packages: tinybench@2.8.0: resolution: {integrity: sha512-1/eK7zUnIklz4JUUlL+658n58XO2hHLQfSk1Zf2LKieUjxidN16eKFEoDEfjHc3ohofSSqK3X5yO6VGb6iW8Lw==} + tinyglobby@0.2.6: + resolution: {integrity: sha512-NbBoFBpqfcgd1tCiO8Lkfdk+xrA7mlLR9zgvZcZWQQwU63XAfUePyd6wZBaU93Hqw347lHnwFzttAkemHzzz4g==} + engines: {node: '>=12.0.0'} + tinypool@0.8.4: resolution: {integrity: sha512-i11VH5gS6IFeLY3gMBQ00/MmLncVP7JLXOw1vlgkytLmJK7QnEr7NXf0LBdxfmNPAeyetukOk0bOYrJrFGjYJQ==} engines: {node: '>=14.0.0'} @@ -7386,6 +7651,9 @@ packages: tr46@0.0.3: resolution: {integrity: sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==} + tr46@1.0.1: + resolution: {integrity: sha512-dTpowEjclQ7Kgx5SdBkqRzVhERQXov8/l9Ft9dVM9fmg0W0KQSVaXX9T4i6twCPNtYiZM53lpSSUAwJbFPOHxA==} + tr46@5.0.0: resolution: {integrity: sha512-tk2G5R2KRwBd+ZN0zaEXpmzdKyOYksXwywulIX95MBODjSzMIuQnQ3m8JxgbhnL1LeVo7lqQKsYa1O3Htl7K5g==} engines: {node: '>=18'} @@ -7426,10 +7694,29 @@ packages: tslib@2.6.3: resolution: {integrity: sha512-xNvxJEOUiWPGhUuUdQgAJPKOOJfGnIyKySOc09XkKsgdUV/3E2zvwZYdejjmRgPCgcym1juLH3226yA7sEFJKQ==} - tsutils@3.21.0: - resolution: {integrity: sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==} - engines: {node: '>= 6'} - peerDependencies: + tsup@8.3.0: + resolution: {integrity: sha512-ALscEeyS03IomcuNdFdc0YWGVIkwH1Ws7nfTbAPuoILvEV2hpGQAY72LIOjglGo4ShWpZfpBqP/jpQVCzqYQag==} + engines: {node: '>=18'} + hasBin: true + peerDependencies: + '@microsoft/api-extractor': ^7.36.0 + '@swc/core': ^1 + postcss: ^8.4.12 + typescript: '>=4.5.0' + peerDependenciesMeta: + '@microsoft/api-extractor': + optional: true + '@swc/core': + optional: true + postcss: + optional: true + typescript: + optional: true + + tsutils@3.21.0: + resolution: {integrity: sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==} + 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' tuf-js@2.2.1: @@ -7478,11 +7765,21 @@ packages: typescript: optional: true + typescript@5.4.2: + resolution: {integrity: sha512-+2/g0Fds1ERlP6JsakQQDXjZdZMM+rqpamFZJEKh4kwTIn3iDkgKtby0CeNd5ATNZ4Ry1ax15TMx0W2V+miizQ==} + engines: {node: '>=14.17'} + hasBin: true + typescript@5.5.3: resolution: {integrity: sha512-/hreyEujaB0w76zKo6717l3L0o/qEUtRgdvUBvlkhoWeOVMjMuHNHk0BRBzikzuGDqNmPQbg5ifMEqsHLiIUcQ==} engines: {node: '>=14.17'} hasBin: true + typescript@5.6.1-rc: + resolution: {integrity: sha512-E3b2+1zEFu84jB0YQi9BORDjz9+jGbwwy1Zi3G0LUNw7a7cePUrHMRNy8aPh53nXpkFGVHSxIZo5vKTfYaFiBQ==} + engines: {node: '>=14.17'} + hasBin: true + ufo@1.5.3: resolution: {integrity: sha512-Y7HYmWaFwPUmkoQCUIAYpKqkOf+SbVj/2fJJZ4RJMCfZp0rTGwRbzQD+HghfnhKOjL9E01okqz+ncJskGYfBNw==} @@ -7505,6 +7802,10 @@ packages: resolution: {integrity: sha512-yY5PpDlfVIU5+y/BSCxAJRBIS1Zc2dDG3Ujq+sR0U+JjUevW2JhocOF+soROYDSaAezOzOKuyyixhD6mBknSmQ==} engines: {node: '>=4'} + unicode-emoji-modifier-base@1.0.0: + resolution: {integrity: sha512-yLSH4py7oFH3oG/9K+XWrz1pSi3dfUrWEnInbxMfArOfc1+33BlGPQtLsOYwvdMy11AwUBetYuaRxSPqgkq+8g==} + engines: {node: '>=4'} + unicode-match-property-ecmascript@2.0.0: resolution: {integrity: sha512-5kaZCrbp5mmbz5ulBkDkbY0SsPOjKqVS35VpL9ulMPfSl0J0Xsm+9Evphv9CoIZFwre7aJoa94AY6seMKGVN5Q==} engines: {node: '>=4'} @@ -7843,6 +8144,9 @@ packages: webidl-conversions@3.0.1: resolution: {integrity: sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==} + webidl-conversions@4.0.2: + resolution: {integrity: sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg==} + webidl-conversions@7.0.0: resolution: {integrity: sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==} engines: {node: '>=12'} @@ -7926,6 +8230,9 @@ packages: whatwg-url@5.0.0: resolution: {integrity: sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==} + whatwg-url@7.1.0: + resolution: {integrity: sha512-WUu7Rg1DroM7oQvGWfOiAK21n74Gg+T4elXEQYkOhtyLeWiJFoOGLXPKI/9gzIie9CtwVLm8wtw6YJdKyxSjeg==} + which-pm@2.2.0: resolution: {integrity: sha512-MOiaDbA5ZZgUjkeMWM5EkJp4loW5ZRoa5bc3/aeMox/PJelMhE6t7S/mLuiY43DBupyxH+S0U1bTui9kWUlmsw==} engines: {node: '>=8.15'} @@ -8028,10 +8335,18 @@ packages: engines: {node: '>= 14'} hasBin: true + yargs-parser@20.2.9: + resolution: {integrity: sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==} + engines: {node: '>=10'} + yargs-parser@21.1.1: resolution: {integrity: sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==} engines: {node: '>=12'} + yargs@16.2.0: + resolution: {integrity: sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==} + engines: {node: '>=10'} + yargs@17.7.2: resolution: {integrity: sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==} engines: {node: '>=12'} @@ -8170,6 +8485,8 @@ snapshots: '@jridgewell/gen-mapping': 0.3.5 '@jridgewell/trace-mapping': 0.3.25 + '@andrewbranch/untar.js@1.0.3': {} + '@angular-devkit/architect@0.1703.7(chokidar@3.6.0)': dependencies: '@angular-devkit/core': 17.3.7(chokidar@3.6.0) @@ -8181,7 +8498,7 @@ snapshots: dependencies: '@ampproject/remapping': 2.3.0 '@angular-devkit/architect': 0.1703.7(chokidar@3.6.0) - '@angular-devkit/build-webpack': 0.1703.7(chokidar@3.6.0)(webpack-dev-server@4.15.1(webpack@5.90.3))(webpack@5.90.3(esbuild@0.20.1)) + '@angular-devkit/build-webpack': 0.1703.7(chokidar@3.6.0)(webpack-dev-server@4.15.1(webpack@5.90.3(esbuild@0.23.1)))(webpack@5.90.3(esbuild@0.20.1)) '@angular-devkit/core': 17.3.7(chokidar@3.6.0) '@angular/compiler-cli': 17.3.9(@angular/compiler@17.3.9(@angular/core@17.3.9(rxjs@7.8.1)(zone.js@0.14.7)))(typescript@5.5.3) '@babel/core': 7.24.0 @@ -8241,7 +8558,7 @@ snapshots: watchpack: 2.4.0 webpack: 5.90.3(esbuild@0.20.1) webpack-dev-middleware: 6.1.2(webpack@5.90.3(esbuild@0.20.1)) - webpack-dev-server: 4.15.1(webpack@5.90.3) + webpack-dev-server: 4.15.1(webpack@5.90.3(esbuild@0.23.1)) webpack-merge: 5.10.0 webpack-subresource-integrity: 5.1.0(webpack@5.90.3(esbuild@0.20.1)) optionalDependencies: @@ -8266,12 +8583,12 @@ snapshots: - utf-8-validate - webpack-cli - '@angular-devkit/build-webpack@0.1703.7(chokidar@3.6.0)(webpack-dev-server@4.15.1(webpack@5.90.3))(webpack@5.90.3(esbuild@0.20.1))': + '@angular-devkit/build-webpack@0.1703.7(chokidar@3.6.0)(webpack-dev-server@4.15.1(webpack@5.90.3(esbuild@0.23.1)))(webpack@5.90.3(esbuild@0.20.1))': dependencies: '@angular-devkit/architect': 0.1703.7(chokidar@3.6.0) rxjs: 7.8.1 webpack: 5.90.3(esbuild@0.20.1) - webpack-dev-server: 4.15.1(webpack@5.90.3) + webpack-dev-server: 4.15.1(webpack@5.90.3(esbuild@0.23.1)) transitivePeerDependencies: - chokidar @@ -8399,6 +8716,26 @@ snapshots: '@types/json-schema': 7.0.15 js-yaml: 4.1.0 + '@arethetypeswrong/cli@0.16.4': + dependencies: + '@arethetypeswrong/core': 0.16.4 + chalk: 4.1.2 + cli-table3: 0.6.5 + commander: 10.0.1 + marked: 9.1.6 + marked-terminal: 7.1.0(marked@9.1.6) + semver: 7.6.2 + + '@arethetypeswrong/core@0.16.4': + dependencies: + '@andrewbranch/untar.js': 1.0.3 + cjs-module-lexer: 1.4.1 + fflate: 0.8.2 + lru-cache: 10.4.3 + semver: 7.6.2 + typescript: 5.6.1-rc + validate-npm-package-name: 5.0.1 + '@babel/code-frame@7.24.7': dependencies: '@babel/highlight': 7.24.7 @@ -9564,6 +9901,9 @@ snapshots: human-id: 1.0.2 prettier: 2.8.8 + '@colors/colors@1.5.0': + optional: true + '@cspotcode/source-map-support@0.8.1': dependencies: '@jridgewell/trace-mapping': 0.3.9 @@ -9606,6 +9946,9 @@ snapshots: '@esbuild/aix-ppc64@0.21.5': optional: true + '@esbuild/aix-ppc64@0.23.1': + optional: true + '@esbuild/android-arm64@0.19.12': optional: true @@ -9615,6 +9958,9 @@ snapshots: '@esbuild/android-arm64@0.21.5': optional: true + '@esbuild/android-arm64@0.23.1': + optional: true + '@esbuild/android-arm@0.19.12': optional: true @@ -9624,6 +9970,9 @@ snapshots: '@esbuild/android-arm@0.21.5': optional: true + '@esbuild/android-arm@0.23.1': + optional: true + '@esbuild/android-x64@0.19.12': optional: true @@ -9633,6 +9982,9 @@ snapshots: '@esbuild/android-x64@0.21.5': optional: true + '@esbuild/android-x64@0.23.1': + optional: true + '@esbuild/darwin-arm64@0.19.12': optional: true @@ -9642,6 +9994,9 @@ snapshots: '@esbuild/darwin-arm64@0.21.5': optional: true + '@esbuild/darwin-arm64@0.23.1': + optional: true + '@esbuild/darwin-x64@0.19.12': optional: true @@ -9651,6 +10006,9 @@ snapshots: '@esbuild/darwin-x64@0.21.5': optional: true + '@esbuild/darwin-x64@0.23.1': + optional: true + '@esbuild/freebsd-arm64@0.19.12': optional: true @@ -9660,6 +10018,9 @@ snapshots: '@esbuild/freebsd-arm64@0.21.5': optional: true + '@esbuild/freebsd-arm64@0.23.1': + optional: true + '@esbuild/freebsd-x64@0.19.12': optional: true @@ -9669,6 +10030,9 @@ snapshots: '@esbuild/freebsd-x64@0.21.5': optional: true + '@esbuild/freebsd-x64@0.23.1': + optional: true + '@esbuild/linux-arm64@0.19.12': optional: true @@ -9678,6 +10042,9 @@ snapshots: '@esbuild/linux-arm64@0.21.5': optional: true + '@esbuild/linux-arm64@0.23.1': + optional: true + '@esbuild/linux-arm@0.19.12': optional: true @@ -9687,6 +10054,9 @@ snapshots: '@esbuild/linux-arm@0.21.5': optional: true + '@esbuild/linux-arm@0.23.1': + optional: true + '@esbuild/linux-ia32@0.19.12': optional: true @@ -9696,6 +10066,9 @@ snapshots: '@esbuild/linux-ia32@0.21.5': optional: true + '@esbuild/linux-ia32@0.23.1': + optional: true + '@esbuild/linux-loong64@0.19.12': optional: true @@ -9705,6 +10078,9 @@ snapshots: '@esbuild/linux-loong64@0.21.5': optional: true + '@esbuild/linux-loong64@0.23.1': + optional: true + '@esbuild/linux-mips64el@0.19.12': optional: true @@ -9714,6 +10090,9 @@ snapshots: '@esbuild/linux-mips64el@0.21.5': optional: true + '@esbuild/linux-mips64el@0.23.1': + optional: true + '@esbuild/linux-ppc64@0.19.12': optional: true @@ -9723,6 +10102,9 @@ snapshots: '@esbuild/linux-ppc64@0.21.5': optional: true + '@esbuild/linux-ppc64@0.23.1': + optional: true + '@esbuild/linux-riscv64@0.19.12': optional: true @@ -9732,6 +10114,9 @@ snapshots: '@esbuild/linux-riscv64@0.21.5': optional: true + '@esbuild/linux-riscv64@0.23.1': + optional: true + '@esbuild/linux-s390x@0.19.12': optional: true @@ -9741,6 +10126,9 @@ snapshots: '@esbuild/linux-s390x@0.21.5': optional: true + '@esbuild/linux-s390x@0.23.1': + optional: true + '@esbuild/linux-x64@0.19.12': optional: true @@ -9750,6 +10138,9 @@ snapshots: '@esbuild/linux-x64@0.21.5': optional: true + '@esbuild/linux-x64@0.23.1': + optional: true + '@esbuild/netbsd-x64@0.19.12': optional: true @@ -9759,6 +10150,12 @@ snapshots: '@esbuild/netbsd-x64@0.21.5': optional: true + '@esbuild/netbsd-x64@0.23.1': + optional: true + + '@esbuild/openbsd-arm64@0.23.1': + optional: true + '@esbuild/openbsd-x64@0.19.12': optional: true @@ -9768,6 +10165,9 @@ snapshots: '@esbuild/openbsd-x64@0.21.5': optional: true + '@esbuild/openbsd-x64@0.23.1': + optional: true + '@esbuild/sunos-x64@0.19.12': optional: true @@ -9777,6 +10177,9 @@ snapshots: '@esbuild/sunos-x64@0.21.5': optional: true + '@esbuild/sunos-x64@0.23.1': + optional: true + '@esbuild/win32-arm64@0.19.12': optional: true @@ -9786,6 +10189,9 @@ snapshots: '@esbuild/win32-arm64@0.21.5': optional: true + '@esbuild/win32-arm64@0.23.1': + optional: true + '@esbuild/win32-ia32@0.19.12': optional: true @@ -9795,6 +10201,9 @@ snapshots: '@esbuild/win32-ia32@0.21.5': optional: true + '@esbuild/win32-ia32@0.23.1': + optional: true + '@esbuild/win32-x64@0.19.12': optional: true @@ -9804,6 +10213,9 @@ snapshots: '@esbuild/win32-x64@0.21.5': optional: true + '@esbuild/win32-x64@0.23.1': + optional: true + '@eslint-community/eslint-utils@4.4.0(eslint@9.0.0)': dependencies: eslint: 9.0.0 @@ -9953,6 +10365,45 @@ snapshots: globby: 11.1.0 read-yaml-file: 1.1.0 + '@microsoft/api-extractor-model@7.29.8(@types/node@20.14.10)': + dependencies: + '@microsoft/tsdoc': 0.15.0 + '@microsoft/tsdoc-config': 0.17.0 + '@rushstack/node-core-library': 5.9.0(@types/node@20.14.10) + transitivePeerDependencies: + - '@types/node' + optional: true + + '@microsoft/api-extractor@7.47.9(@types/node@20.14.10)': + dependencies: + '@microsoft/api-extractor-model': 7.29.8(@types/node@20.14.10) + '@microsoft/tsdoc': 0.15.0 + '@microsoft/tsdoc-config': 0.17.0 + '@rushstack/node-core-library': 5.9.0(@types/node@20.14.10) + '@rushstack/rig-package': 0.5.3 + '@rushstack/terminal': 0.14.2(@types/node@20.14.10) + '@rushstack/ts-command-line': 4.22.8(@types/node@20.14.10) + lodash: 4.17.21 + minimatch: 3.0.8 + resolve: 1.22.8 + semver: 7.5.4 + source-map: 0.6.1 + typescript: 5.4.2 + transitivePeerDependencies: + - '@types/node' + optional: true + + '@microsoft/tsdoc-config@0.17.0': + dependencies: + '@microsoft/tsdoc': 0.15.0 + ajv: 8.12.0 + jju: 1.4.0 + resolve: 1.22.8 + optional: true + + '@microsoft/tsdoc@0.15.0': + optional: true + '@neoconfetti/svelte@2.0.0': {} '@ngtools/webpack@17.3.7(@angular/compiler-cli@17.3.9(@angular/compiler@17.3.9(@angular/core@17.3.9(rxjs@7.8.1)(zone.js@0.14.7)))(typescript@5.5.3))(typescript@5.5.3)(webpack@5.90.3(esbuild@0.20.1))': @@ -10707,59 +11158,6 @@ snapshots: '@types/react': 18.3.3 '@types/react-dom': 18.3.0 - '@rollup/plugin-commonjs@26.0.1(rollup@4.18.0)': - dependencies: - '@rollup/pluginutils': 5.1.0(rollup@4.18.0) - commondir: 1.0.1 - estree-walker: 2.0.2 - glob: 10.4.3 - is-reference: 1.2.1 - magic-string: 0.30.10 - optionalDependencies: - rollup: 4.18.0 - - '@rollup/plugin-json@6.1.0(rollup@4.22.0)': - dependencies: - '@rollup/pluginutils': 5.1.0(rollup@4.22.0) - optionalDependencies: - rollup: 4.22.0 - - '@rollup/plugin-node-resolve@15.2.3(rollup@4.22.0)': - dependencies: - '@rollup/pluginutils': 5.1.0(rollup@4.22.0) - '@types/resolve': 1.20.2 - deepmerge: 4.3.1 - is-builtin-module: 3.2.1 - is-module: 1.0.0 - resolve: 1.22.8 - optionalDependencies: - rollup: 4.22.0 - - '@rollup/plugin-terser@0.4.4(rollup@4.18.0)': - dependencies: - serialize-javascript: 6.0.2 - smob: 1.5.0 - terser: 5.31.1 - optionalDependencies: - rollup: 4.18.0 - - '@rollup/plugin-typescript@11.1.6(rollup@4.18.0)(tslib@2.6.3)(typescript@5.5.3)': - dependencies: - '@rollup/pluginutils': 5.1.0(rollup@4.18.0) - resolve: 1.22.8 - typescript: 5.5.3 - optionalDependencies: - rollup: 4.18.0 - tslib: 2.6.3 - - '@rollup/pluginutils@5.1.0(rollup@4.18.0)': - dependencies: - '@types/estree': 1.0.5 - estree-walker: 2.0.2 - picomatch: 2.3.1 - optionalDependencies: - rollup: 4.18.0 - '@rollup/pluginutils@5.1.0(rollup@4.22.0)': dependencies: '@types/estree': 1.0.5 @@ -10866,6 +11264,44 @@ snapshots: '@rushstack/eslint-patch@1.10.4': {} + '@rushstack/node-core-library@5.9.0(@types/node@20.14.10)': + dependencies: + ajv: 8.13.0 + ajv-draft-04: 1.0.0(ajv@8.13.0) + ajv-formats: 3.0.1(ajv@8.13.0) + fs-extra: 7.0.1 + import-lazy: 4.0.0 + jju: 1.4.0 + resolve: 1.22.8 + semver: 7.5.4 + optionalDependencies: + '@types/node': 20.14.10 + optional: true + + '@rushstack/rig-package@0.5.3': + dependencies: + resolve: 1.22.8 + strip-json-comments: 3.1.1 + optional: true + + '@rushstack/terminal@0.14.2(@types/node@20.14.10)': + dependencies: + '@rushstack/node-core-library': 5.9.0(@types/node@20.14.10) + supports-color: 8.1.1 + optionalDependencies: + '@types/node': 20.14.10 + optional: true + + '@rushstack/ts-command-line@4.22.8(@types/node@20.14.10)': + dependencies: + '@rushstack/terminal': 0.14.2(@types/node@20.14.10) + '@types/argparse': 1.0.38 + argparse: 1.0.10 + string-argv: 0.3.2 + transitivePeerDependencies: + - '@types/node' + optional: true + '@schematics/angular@17.3.7(chokidar@3.6.0)': dependencies: '@angular-devkit/core': 17.3.7(chokidar@3.6.0) @@ -10916,6 +11352,8 @@ snapshots: '@sinclair/typebox@0.27.8': {} + '@sindresorhus/is@4.6.0': {} + '@stackblitz/sdk@1.11.0': {} '@sveltejs/adapter-auto@3.0.0(@sveltejs/kit@2.5.28(@sveltejs/vite-plugin-svelte@3.0.0(svelte@4.2.19)(vite@5.4.6(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1)))(svelte@4.2.19)(vite@5.4.6(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1)))': @@ -11028,6 +11466,9 @@ snapshots: '@tufjs/canonical-json': 2.0.0 minimatch: 9.0.5 + '@types/argparse@1.0.38': + optional: true + '@types/babel__core@7.20.5': dependencies: '@babel/parser': 7.24.7 @@ -11159,8 +11600,6 @@ snapshots: '@types/prop-types': 15.7.12 csstype: 3.1.3 - '@types/resolve@1.20.2': {} - '@types/retry@0.12.0': {} '@types/semver@7.5.8': {} @@ -11918,6 +12357,11 @@ snapshots: clean-stack: 2.2.0 indent-string: 4.0.0 + ajv-draft-04@1.0.0(ajv@8.13.0): + optionalDependencies: + ajv: 8.13.0 + optional: true + ajv-formats@2.1.1(ajv@8.12.0): optionalDependencies: ajv: 8.12.0 @@ -11926,6 +12370,11 @@ snapshots: optionalDependencies: ajv: 8.16.0 + ajv-formats@3.0.1(ajv@8.13.0): + optionalDependencies: + ajv: 8.13.0 + optional: true + ajv-keywords@3.5.2(ajv@6.12.6): dependencies: ajv: 6.12.6 @@ -11949,6 +12398,14 @@ snapshots: require-from-string: 2.0.2 uri-js: 4.4.1 + ajv@8.13.0: + dependencies: + fast-deep-equal: 3.1.3 + json-schema-traverse: 1.0.0 + require-from-string: 2.0.2 + uri-js: 4.4.1 + optional: true + ajv@8.16.0: dependencies: fast-deep-equal: 3.1.3 @@ -11982,6 +12439,10 @@ snapshots: ansi-escapes@6.2.1: {} + ansi-escapes@7.0.0: + dependencies: + environment: 1.1.0 + ansi-html-community@0.0.8: {} ansi-regex@5.0.1: {} @@ -12231,12 +12692,15 @@ snapshots: base64-js: 1.5.1 ieee754: 1.2.1 - builtin-modules@3.3.0: {} - bundle-name@4.1.0: dependencies: run-applescript: 7.0.0 + bundle-require@5.0.0(esbuild@0.23.1): + dependencies: + esbuild: 0.23.1 + load-tsconfig: 0.2.5 + bytes@3.0.0: {} bytes@3.1.2: {} @@ -12326,6 +12790,8 @@ snapshots: chalk@5.3.0: {} + char-regex@1.0.2: {} + chardet@0.7.0: {} check-error@1.0.3: @@ -12363,6 +12829,8 @@ snapshots: dependencies: consola: 3.2.3 + cjs-module-lexer@1.4.1: {} + classnames@2.3.2: {} clean-stack@2.2.0: {} @@ -12375,8 +12843,23 @@ snapshots: dependencies: restore-cursor: 4.0.0 + cli-highlight@2.1.11: + dependencies: + chalk: 4.1.2 + highlight.js: 10.7.3 + mz: 2.7.0 + parse5: 5.1.1 + parse5-htmlparser2-tree-adapter: 6.0.1 + yargs: 16.2.0 + cli-spinners@2.9.2: {} + cli-table3@0.6.5: + dependencies: + string-width: 4.2.3 + optionalDependencies: + '@colors/colors': 1.5.0 + cli-truncate@4.0.0: dependencies: slice-ansi: 5.0.0 @@ -12384,6 +12867,12 @@ snapshots: cli-width@4.1.0: {} + cliui@7.0.4: + dependencies: + string-width: 4.2.3 + strip-ansi: 6.0.1 + wrap-ansi: 7.0.0 + cliui@8.0.1: dependencies: string-width: 4.2.3 @@ -12434,8 +12923,6 @@ snapshots: common-path-prefix@3.0.0: {} - commondir@1.0.1: {} - compressible@2.0.18: dependencies: mime-db: 1.52.0 @@ -12725,6 +13212,8 @@ snapshots: emoji-regex@9.2.2: {} + emojilib@2.4.0: {} + emojis-list@3.0.0: {} encodeurl@1.0.2: {} @@ -12754,6 +13243,8 @@ snapshots: env-paths@2.2.1: {} + environment@1.1.0: {} + err-code@2.0.3: {} errno@0.1.8: @@ -12858,6 +13349,33 @@ snapshots: '@esbuild/win32-ia32': 0.21.5 '@esbuild/win32-x64': 0.21.5 + esbuild@0.23.1: + optionalDependencies: + '@esbuild/aix-ppc64': 0.23.1 + '@esbuild/android-arm': 0.23.1 + '@esbuild/android-arm64': 0.23.1 + '@esbuild/android-x64': 0.23.1 + '@esbuild/darwin-arm64': 0.23.1 + '@esbuild/darwin-x64': 0.23.1 + '@esbuild/freebsd-arm64': 0.23.1 + '@esbuild/freebsd-x64': 0.23.1 + '@esbuild/linux-arm': 0.23.1 + '@esbuild/linux-arm64': 0.23.1 + '@esbuild/linux-ia32': 0.23.1 + '@esbuild/linux-loong64': 0.23.1 + '@esbuild/linux-mips64el': 0.23.1 + '@esbuild/linux-ppc64': 0.23.1 + '@esbuild/linux-riscv64': 0.23.1 + '@esbuild/linux-s390x': 0.23.1 + '@esbuild/linux-x64': 0.23.1 + '@esbuild/netbsd-x64': 0.23.1 + '@esbuild/openbsd-arm64': 0.23.1 + '@esbuild/openbsd-x64': 0.23.1 + '@esbuild/sunos-x64': 0.23.1 + '@esbuild/win32-arm64': 0.23.1 + '@esbuild/win32-ia32': 0.23.1 + '@esbuild/win32-x64': 0.23.1 + escalade@3.1.2: {} escape-html@1.0.3: {} @@ -13234,11 +13752,17 @@ snapshots: dependencies: pend: 1.2.0 + fdir@6.3.0(picomatch@4.0.2): + optionalDependencies: + picomatch: 4.0.2 + fetch-blob@3.2.0: dependencies: node-domexception: 1.0.0 web-streams-polyfill: 3.3.3 + fflate@0.8.2: {} + figures@3.2.0: dependencies: escape-string-regexp: 1.0.5 @@ -13505,6 +14029,8 @@ snapshots: he@1.2.0: {} + highlight.js@10.7.3: {} + hookable@5.5.3: {} hosted-git-info@7.0.2: @@ -13628,6 +14154,9 @@ snapshots: parent-module: 1.0.1 resolve-from: 4.0.0 + import-lazy@4.0.0: + optional: true + import-meta-resolve@4.1.0: {} imurmurhash@0.1.4: {} @@ -13684,10 +14213,6 @@ snapshots: dependencies: binary-extensions: 2.3.0 - is-builtin-module@3.2.1: - dependencies: - builtin-modules: 3.3.0 - is-core-module@2.14.0: dependencies: hasown: 2.0.2 @@ -13718,8 +14243,6 @@ snapshots: is-lambda@1.0.1: {} - is-module@1.0.0: {} - is-number@7.0.0: {} is-path-inside@3.0.3: {} @@ -13732,10 +14255,6 @@ snapshots: is-potential-custom-element-name@1.0.1: {} - is-reference@1.2.1: - dependencies: - '@types/estree': 1.0.5 - is-reference@3.0.2: dependencies: '@types/estree': 1.0.5 @@ -13817,6 +14336,11 @@ snapshots: jiti@1.21.6: {} + jju@1.4.0: + optional: true + + joycon@3.1.1: {} + js-beautify@1.15.1: dependencies: config-chain: 1.1.13 @@ -13988,6 +14512,8 @@ snapshots: rfdc: 1.4.1 wrap-ansi: 9.0.0 + load-tsconfig@0.2.5: {} + load-yaml-file@0.2.0: dependencies: graceful-fs: 4.2.11 @@ -14028,6 +14554,8 @@ snapshots: lodash.merge@4.6.2: {} + lodash.sortby@4.7.0: {} + lodash.startcase@4.4.0: {} lodash@4.17.21: {} @@ -14059,6 +14587,8 @@ snapshots: lru-cache@10.4.0: {} + lru-cache@10.4.3: {} + lru-cache@4.1.5: dependencies: pseudomap: 1.0.2 @@ -14123,6 +14653,18 @@ snapshots: mark.js@8.11.1: {} + marked-terminal@7.1.0(marked@9.1.6): + dependencies: + ansi-escapes: 7.0.0 + chalk: 5.3.0 + cli-highlight: 2.1.11 + cli-table3: 0.6.5 + marked: 9.1.6 + node-emoji: 2.1.3 + supports-hyperlinks: 3.1.0 + + marked@9.1.6: {} + mdn-data@2.0.30: {} media-typer@0.3.0: {} @@ -14168,6 +14710,11 @@ snapshots: minimalistic-assert@1.0.1: {} + minimatch@3.0.8: + dependencies: + brace-expansion: 1.1.11 + optional: true + minimatch@3.1.2: dependencies: brace-expansion: 1.1.11 @@ -14295,6 +14842,13 @@ snapshots: node-domexception@1.0.0: {} + node-emoji@2.1.3: + dependencies: + '@sindresorhus/is': 4.6.0 + char-regex: 1.0.2 + emojilib: 2.4.0 + skin-tone: 2.0.0 + node-fetch-native@1.6.4: {} node-fetch@2.7.0(encoding@0.1.13): @@ -14595,10 +15149,18 @@ snapshots: parse5: 7.1.2 parse5-sax-parser: 7.0.0 + parse5-htmlparser2-tree-adapter@6.0.1: + dependencies: + parse5: 6.0.1 + parse5-sax-parser@7.0.0: dependencies: parse5: 7.1.2 + parse5@5.1.1: {} + + parse5@6.0.1: {} + parse5@7.1.2: dependencies: entities: 4.5.0 @@ -14650,6 +15212,8 @@ snapshots: picomatch@4.0.1: {} + picomatch@4.0.2: {} + pidtree@0.6.0: {} pify@2.3.0: {} @@ -14726,6 +15290,14 @@ snapshots: postcss: 8.4.39 ts-node: 10.9.2(@types/node@20.14.5)(typescript@5.5.3) + postcss-load-config@6.0.1(jiti@1.21.6)(postcss@8.4.45)(yaml@2.4.5): + dependencies: + lilconfig: 3.1.2 + optionalDependencies: + jiti: 1.21.6 + postcss: 8.4.45 + yaml: 2.4.5 + postcss-loader@8.1.1(postcss@8.4.35)(typescript@5.5.3)(webpack@5.90.3(esbuild@0.20.1)): dependencies: cosmiconfig: 9.0.0(typescript@5.5.3) @@ -15107,18 +15679,6 @@ snapshots: dependencies: glob: 7.2.3 - rimraf@5.0.8: - dependencies: - glob: 10.4.3 - - rollup-plugin-dts@6.1.1(rollup@4.18.0)(typescript@5.5.3): - dependencies: - magic-string: 0.30.10 - rollup: 4.18.0 - typescript: 5.5.3 - optionalDependencies: - '@babel/code-frame': 7.24.7 - rollup@4.18.0: dependencies: '@types/estree': 1.0.5 @@ -15247,6 +15807,11 @@ snapshots: semver@6.3.1: {} + semver@7.5.4: + dependencies: + lru-cache: 6.0.0 + optional: true + semver@7.6.0: dependencies: lru-cache: 6.0.0 @@ -15370,6 +15935,10 @@ snapshots: mrmime: 2.0.0 totalist: 3.0.1 + skin-tone@2.0.0: + dependencies: + unicode-emoji-modifier-base: 1.0.0 + slash@3.0.0: {} slash@4.0.0: {} @@ -15386,8 +15955,6 @@ snapshots: smart-buffer@4.2.0: {} - smob@1.5.0: {} - sockjs@0.3.24: dependencies: faye-websocket: 0.11.4 @@ -15437,6 +16004,10 @@ snapshots: source-map@0.7.4: {} + source-map@0.8.0-beta.0: + dependencies: + whatwg-url: 7.1.0 + spawndamnit@2.0.0: dependencies: cross-spawn: 5.1.0 @@ -15581,6 +16152,11 @@ snapshots: dependencies: has-flag: 4.0.0 + supports-hyperlinks@3.1.0: + dependencies: + has-flag: 4.0.0 + supports-color: 7.2.0 + supports-preserve-symlinks-flag@1.0.0: {} svelte-check@3.6.0(@babel/core@7.24.7)(less@4.2.0)(postcss-load-config@4.0.2(postcss@8.4.39)(ts-node@10.9.2(@types/node@20.14.10)(typescript@5.5.3)))(postcss@8.4.39)(sass@1.71.1)(svelte@4.2.19): @@ -15774,7 +16350,7 @@ snapshots: term-size@2.2.1: {} - terser-webpack-plugin@5.3.10(esbuild@0.20.1)(webpack@5.90.3): + terser-webpack-plugin@5.3.10(esbuild@0.20.1)(webpack@5.90.3(esbuild@0.23.1)): dependencies: '@jridgewell/trace-mapping': 0.3.25 jest-worker: 27.5.1 @@ -15798,6 +16374,7 @@ snapshots: acorn: 8.12.0 commander: 2.20.3 source-map-support: 0.5.21 + optional: true test-exclude@6.0.0: dependencies: @@ -15830,6 +16407,11 @@ snapshots: tinybench@2.8.0: {} + tinyglobby@0.2.6: + dependencies: + fdir: 6.3.0(picomatch@4.0.2) + picomatch: 4.0.2 + tinypool@0.8.4: {} tinypool@1.0.0: {} @@ -15861,6 +16443,10 @@ snapshots: tr46@0.0.3: {} + tr46@1.0.1: + dependencies: + punycode: 2.3.1 + tr46@5.0.0: dependencies: punycode: 2.3.1 @@ -15916,6 +16502,34 @@ snapshots: tslib@2.6.3: {} + tsup@8.3.0(@microsoft/api-extractor@7.47.9(@types/node@20.14.10))(jiti@1.21.6)(postcss@8.4.45)(typescript@5.5.3)(yaml@2.4.5): + dependencies: + bundle-require: 5.0.0(esbuild@0.23.1) + cac: 6.7.14 + chokidar: 3.6.0 + consola: 3.2.3 + debug: 4.3.5 + esbuild: 0.23.1 + execa: 5.1.1 + joycon: 3.1.1 + picocolors: 1.0.1 + postcss-load-config: 6.0.1(jiti@1.21.6)(postcss@8.4.45)(yaml@2.4.5) + resolve-from: 5.0.0 + rollup: 4.22.0 + source-map: 0.8.0-beta.0 + sucrase: 3.35.0 + tinyglobby: 0.2.6 + tree-kill: 1.2.2 + optionalDependencies: + '@microsoft/api-extractor': 7.47.9(@types/node@20.14.10) + postcss: 8.4.45 + typescript: 5.5.3 + transitivePeerDependencies: + - jiti + - supports-color + - tsx + - yaml + tsutils@3.21.0(typescript@5.5.3): dependencies: tslib: 1.14.1 @@ -15968,8 +16582,13 @@ snapshots: - eslint - supports-color + typescript@5.4.2: + optional: true + typescript@5.5.3: {} + typescript@5.6.1-rc: {} + ufo@1.5.3: {} uglify-js@3.18.0: @@ -15986,6 +16605,8 @@ snapshots: unicode-canonical-property-names-ecmascript@2.0.0: {} + unicode-emoji-modifier-base@1.0.0: {} + unicode-match-property-ecmascript@2.0.0: dependencies: unicode-canonical-property-names-ecmascript: 2.0.0 @@ -16440,9 +17061,11 @@ snapshots: webidl-conversions@3.0.1: {} + webidl-conversions@4.0.2: {} + webidl-conversions@7.0.0: {} - webpack-dev-middleware@5.3.4(webpack@5.90.3): + webpack-dev-middleware@5.3.4(webpack@5.90.3(esbuild@0.23.1)): dependencies: colorette: 2.0.20 memfs: 3.5.3 @@ -16461,7 +17084,7 @@ snapshots: optionalDependencies: webpack: 5.90.3(esbuild@0.20.1) - webpack-dev-server@4.15.1(webpack@5.90.3): + webpack-dev-server@4.15.1(webpack@5.90.3(esbuild@0.23.1)): dependencies: '@types/bonjour': 3.5.13 '@types/connect-history-api-fallback': 1.5.4 @@ -16491,7 +17114,7 @@ snapshots: serve-index: 1.9.1 sockjs: 0.3.24 spdy: 4.0.2 - webpack-dev-middleware: 5.3.4(webpack@5.90.3) + webpack-dev-middleware: 5.3.4(webpack@5.90.3(esbuild@0.23.1)) ws: 8.17.1 optionalDependencies: webpack: 5.90.3(esbuild@0.20.1) @@ -16537,7 +17160,7 @@ snapshots: neo-async: 2.6.2 schema-utils: 3.3.0 tapable: 2.2.1 - terser-webpack-plugin: 5.3.10(esbuild@0.20.1)(webpack@5.90.3) + terser-webpack-plugin: 5.3.10(esbuild@0.20.1)(webpack@5.90.3(esbuild@0.23.1)) watchpack: 2.4.0 webpack-sources: 3.2.3 transitivePeerDependencies: @@ -16569,6 +17192,12 @@ snapshots: tr46: 0.0.3 webidl-conversions: 3.0.1 + whatwg-url@7.1.0: + dependencies: + lodash.sortby: 4.7.0 + tr46: 1.0.1 + webidl-conversions: 4.0.2 + which-pm@2.2.0: dependencies: load-yaml-file: 0.2.0 @@ -16648,8 +17277,20 @@ snapshots: yaml@2.4.5: {} + yargs-parser@20.2.9: {} + yargs-parser@21.1.1: {} + yargs@16.2.0: + dependencies: + cliui: 7.0.4 + escalade: 3.1.2 + get-caller-file: 2.0.5 + require-directory: 2.1.1 + string-width: 4.2.3 + y18n: 5.0.8 + yargs-parser: 20.2.9 + yargs@17.7.2: dependencies: cliui: 8.0.1 -- 2.51.2 From 4f1d5d91b896c65120e3f4cc602087d2ca6509d3 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sun, 22 Sep 2024 02:08:38 +0000 Subject: [PATCH 25/49] Version Packages --- .changeset/fifty-plums-battle.md | 5 ----- .changeset/giant-buckets-eat.md | 6 ------ examples/openapi-ts-axios/CHANGELOG.md | 7 +++++++ examples/openapi-ts-axios/package.json | 2 +- examples/openapi-ts-fetch/CHANGELOG.md | 7 +++++++ examples/openapi-ts-fetch/package.json | 2 +- examples/openapi-ts-tanstack-react-query/CHANGELOG.md | 7 +++++++ examples/openapi-ts-tanstack-react-query/package.json | 2 +- examples/openapi-ts-tanstack-svelte-query/CHANGELOG.md | 7 +++++++ examples/openapi-ts-tanstack-svelte-query/package.json | 2 +- examples/openapi-ts-tanstack-vue-query/CHANGELOG.md | 7 +++++++ examples/openapi-ts-tanstack-vue-query/package.json | 2 +- packages/client-axios/CHANGELOG.md | 6 ++++++ packages/client-axios/package.json | 2 +- packages/client-fetch/CHANGELOG.md | 6 ++++++ packages/client-fetch/package.json | 2 +- packages/openapi-ts/CHANGELOG.md | 6 ++++++ packages/openapi-ts/package.json | 2 +- 18 files changed, 61 insertions(+), 19 deletions(-) delete mode 100644 .changeset/fifty-plums-battle.md delete mode 100644 .changeset/giant-buckets-eat.md diff --git a/.changeset/fifty-plums-battle.md b/.changeset/fifty-plums-battle.md deleted file mode 100644 index 04999ef23..000000000 --- a/.changeset/fifty-plums-battle.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@hey-api/openapi-ts': patch ---- - -fix: properly handle dual publishing and type generation diff --git a/.changeset/giant-buckets-eat.md b/.changeset/giant-buckets-eat.md deleted file mode 100644 index 9aa705c24..000000000 --- a/.changeset/giant-buckets-eat.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -'@hey-api/client-axios': patch -'@hey-api/client-fetch': patch ---- - -fix: properly handle dual publishing and type generation diff --git a/examples/openapi-ts-axios/CHANGELOG.md b/examples/openapi-ts-axios/CHANGELOG.md index 3bd1d4135..ed1761486 100644 --- a/examples/openapi-ts-axios/CHANGELOG.md +++ b/examples/openapi-ts-axios/CHANGELOG.md @@ -1,5 +1,12 @@ # @example/openapi-ts-axios +## 0.0.9 + +### Patch Changes + +- Updated dependencies [[`11a276a`](https://github.com/hey-api/openapi-ts/commit/11a276a1e35dde0735363e892d8142016fd87eec)]: + - @hey-api/client-axios@0.2.5 + ## 0.0.8 ### Patch Changes diff --git a/examples/openapi-ts-axios/package.json b/examples/openapi-ts-axios/package.json index f866d2db2..d92cd416f 100644 --- a/examples/openapi-ts-axios/package.json +++ b/examples/openapi-ts-axios/package.json @@ -1,7 +1,7 @@ { "name": "@example/openapi-ts-axios", "private": true, - "version": "0.0.8", + "version": "0.0.9", "type": "module", "scripts": { "build": "tsc && vite build", diff --git a/examples/openapi-ts-fetch/CHANGELOG.md b/examples/openapi-ts-fetch/CHANGELOG.md index 6f7beb160..3ea88a9a9 100644 --- a/examples/openapi-ts-fetch/CHANGELOG.md +++ b/examples/openapi-ts-fetch/CHANGELOG.md @@ -1,5 +1,12 @@ # @example/openapi-ts-fetch +## 0.0.24 + +### Patch Changes + +- Updated dependencies [[`11a276a`](https://github.com/hey-api/openapi-ts/commit/11a276a1e35dde0735363e892d8142016fd87eec)]: + - @hey-api/client-fetch@0.3.2 + ## 0.0.23 ### Patch Changes diff --git a/examples/openapi-ts-fetch/package.json b/examples/openapi-ts-fetch/package.json index d629b4474..d34ea6f84 100644 --- a/examples/openapi-ts-fetch/package.json +++ b/examples/openapi-ts-fetch/package.json @@ -1,7 +1,7 @@ { "name": "@example/openapi-ts-fetch", "private": true, - "version": "0.0.23", + "version": "0.0.24", "type": "module", "scripts": { "build": "tsc && vite build", diff --git a/examples/openapi-ts-tanstack-react-query/CHANGELOG.md b/examples/openapi-ts-tanstack-react-query/CHANGELOG.md index b92b74bff..82fecb736 100644 --- a/examples/openapi-ts-tanstack-react-query/CHANGELOG.md +++ b/examples/openapi-ts-tanstack-react-query/CHANGELOG.md @@ -1,5 +1,12 @@ # @example/openapi-ts-tanstack-react-query +## 0.0.6 + +### Patch Changes + +- Updated dependencies [[`11a276a`](https://github.com/hey-api/openapi-ts/commit/11a276a1e35dde0735363e892d8142016fd87eec)]: + - @hey-api/client-fetch@0.3.2 + ## 0.0.5 ### Patch Changes diff --git a/examples/openapi-ts-tanstack-react-query/package.json b/examples/openapi-ts-tanstack-react-query/package.json index b5a66beeb..800ceaf5d 100644 --- a/examples/openapi-ts-tanstack-react-query/package.json +++ b/examples/openapi-ts-tanstack-react-query/package.json @@ -1,7 +1,7 @@ { "name": "@example/openapi-ts-tanstack-react-query", "private": true, - "version": "0.0.5", + "version": "0.0.6", "type": "module", "scripts": { "build": "tsc && vite build", diff --git a/examples/openapi-ts-tanstack-svelte-query/CHANGELOG.md b/examples/openapi-ts-tanstack-svelte-query/CHANGELOG.md index 97c875c6f..0083fb31d 100644 --- a/examples/openapi-ts-tanstack-svelte-query/CHANGELOG.md +++ b/examples/openapi-ts-tanstack-svelte-query/CHANGELOG.md @@ -1,5 +1,12 @@ # @example/openapi-ts-tanstack-svelte-query +## 0.0.6 + +### Patch Changes + +- Updated dependencies [[`11a276a`](https://github.com/hey-api/openapi-ts/commit/11a276a1e35dde0735363e892d8142016fd87eec)]: + - @hey-api/client-fetch@0.3.2 + ## 0.0.5 ### Patch Changes diff --git a/examples/openapi-ts-tanstack-svelte-query/package.json b/examples/openapi-ts-tanstack-svelte-query/package.json index df5b25617..84b807048 100644 --- a/examples/openapi-ts-tanstack-svelte-query/package.json +++ b/examples/openapi-ts-tanstack-svelte-query/package.json @@ -1,7 +1,7 @@ { "name": "@example/openapi-ts-tanstack-svelte-query", "private": true, - "version": "0.0.5", + "version": "0.0.6", "type": "module", "scripts": { "build": "vite build", diff --git a/examples/openapi-ts-tanstack-vue-query/CHANGELOG.md b/examples/openapi-ts-tanstack-vue-query/CHANGELOG.md index 7d64c3d6c..50d2abadb 100644 --- a/examples/openapi-ts-tanstack-vue-query/CHANGELOG.md +++ b/examples/openapi-ts-tanstack-vue-query/CHANGELOG.md @@ -1,5 +1,12 @@ # @example/openapi-ts-tanstack-vue-query +## 0.0.6 + +### Patch Changes + +- Updated dependencies [[`11a276a`](https://github.com/hey-api/openapi-ts/commit/11a276a1e35dde0735363e892d8142016fd87eec)]: + - @hey-api/client-fetch@0.3.2 + ## 0.0.5 ### Patch Changes diff --git a/examples/openapi-ts-tanstack-vue-query/package.json b/examples/openapi-ts-tanstack-vue-query/package.json index 8e616b064..075f5c992 100644 --- a/examples/openapi-ts-tanstack-vue-query/package.json +++ b/examples/openapi-ts-tanstack-vue-query/package.json @@ -1,7 +1,7 @@ { "name": "@example/openapi-ts-tanstack-vue-query", "private": true, - "version": "0.0.5", + "version": "0.0.6", "type": "module", "scripts": { "build-only": "vite build", diff --git a/packages/client-axios/CHANGELOG.md b/packages/client-axios/CHANGELOG.md index fa3f6a929..bc479048b 100644 --- a/packages/client-axios/CHANGELOG.md +++ b/packages/client-axios/CHANGELOG.md @@ -1,5 +1,11 @@ # @hey-api/client-axios +## 0.2.5 + +### Patch Changes + +- [#1075](https://github.com/hey-api/openapi-ts/pull/1075) [`11a276a`](https://github.com/hey-api/openapi-ts/commit/11a276a1e35dde0735363e892d8142016fd87eec) Thanks [@mrlubos](https://github.com/mrlubos)! - fix: properly handle dual publishing and type generation + ## 0.2.4 ### Patch Changes diff --git a/packages/client-axios/package.json b/packages/client-axios/package.json index 50ba3d1e2..1d4495dfb 100644 --- a/packages/client-axios/package.json +++ b/packages/client-axios/package.json @@ -1,6 +1,6 @@ { "name": "@hey-api/client-axios", - "version": "0.2.4", + "version": "0.2.5", "description": "Type-safe Axios client for your @hey-api/openapi-ts types", "homepage": "https://heyapi.vercel.app/", "repository": { diff --git a/packages/client-fetch/CHANGELOG.md b/packages/client-fetch/CHANGELOG.md index ddeb8be70..578ced6c9 100644 --- a/packages/client-fetch/CHANGELOG.md +++ b/packages/client-fetch/CHANGELOG.md @@ -1,5 +1,11 @@ # @hey-api/client-fetch +## 0.3.2 + +### Patch Changes + +- [#1075](https://github.com/hey-api/openapi-ts/pull/1075) [`11a276a`](https://github.com/hey-api/openapi-ts/commit/11a276a1e35dde0735363e892d8142016fd87eec) Thanks [@mrlubos](https://github.com/mrlubos)! - fix: properly handle dual publishing and type generation + ## 0.3.1 ### Patch Changes diff --git a/packages/client-fetch/package.json b/packages/client-fetch/package.json index 17634844c..603e90a98 100644 --- a/packages/client-fetch/package.json +++ b/packages/client-fetch/package.json @@ -1,6 +1,6 @@ { "name": "@hey-api/client-fetch", - "version": "0.3.1", + "version": "0.3.2", "description": "Type-safe Fetch API client for your @hey-api/openapi-ts types", "homepage": "https://heyapi.vercel.app/", "repository": { diff --git a/packages/openapi-ts/CHANGELOG.md b/packages/openapi-ts/CHANGELOG.md index ae421accc..46947eec5 100644 --- a/packages/openapi-ts/CHANGELOG.md +++ b/packages/openapi-ts/CHANGELOG.md @@ -1,5 +1,11 @@ # @hey-api/openapi-ts +## 0.53.3 + +### Patch Changes + +- [#1075](https://github.com/hey-api/openapi-ts/pull/1075) [`11a276a`](https://github.com/hey-api/openapi-ts/commit/11a276a1e35dde0735363e892d8142016fd87eec) Thanks [@mrlubos](https://github.com/mrlubos)! - fix: properly handle dual publishing and type generation + ## 0.53.2 ### Patch Changes diff --git a/packages/openapi-ts/package.json b/packages/openapi-ts/package.json index 280205549..92b413309 100644 --- a/packages/openapi-ts/package.json +++ b/packages/openapi-ts/package.json @@ -1,6 +1,6 @@ { "name": "@hey-api/openapi-ts", - "version": "0.53.2", + "version": "0.53.3", "description": "Turn your OpenAPI specification into a beautiful TypeScript client", "homepage": "https://heyapi.vercel.app/", "repository": { -- 2.51.2 From f2117b7f6e7e2102b0f976780b4f3219c70c5578 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 23 Sep 2024 03:10:26 +0000 Subject: [PATCH 26/49] chore(deps): bump vue from 3.5.5 to 3.5.8 in the prod-deps group Bumps the prod-deps group with 1 update: [vue](https://github.com/vuejs/core). Updates `vue` from 3.5.5 to 3.5.8 - [Release notes](https://github.com/vuejs/core/releases) - [Changelog](https://github.com/vuejs/core/blob/main/CHANGELOG.md) - [Commits](https://github.com/vuejs/core/compare/v3.5.5...v3.5.8) --- updated-dependencies: - dependency-name: vue dependency-type: direct:production update-type: version-update:semver-patch dependency-group: prod-deps ... Signed-off-by: dependabot[bot] --- .../package.json | 2 +- pnpm-lock.yaml | 367 ++++++++++-------- 2 files changed, 199 insertions(+), 170 deletions(-) diff --git a/examples/openapi-ts-tanstack-vue-query/package.json b/examples/openapi-ts-tanstack-vue-query/package.json index 075f5c992..09f28e509 100644 --- a/examples/openapi-ts-tanstack-vue-query/package.json +++ b/examples/openapi-ts-tanstack-vue-query/package.json @@ -20,7 +20,7 @@ "@tanstack/vue-query": "5.56.2", "@tanstack/vue-query-devtools": "5.56.2", "pinia": "2.2.2", - "vue": "3.5.5", + "vue": "3.5.8", "vue-router": "4.4.5" }, "devDependencies": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 68d2e5565..a4a106686 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -58,7 +58,7 @@ importers: version: 3.3.2 tsup: specifier: 8.3.0 - version: 8.3.0(@microsoft/api-extractor@7.47.9(@types/node@20.14.10))(jiti@1.21.6)(postcss@8.4.45)(typescript@5.5.3)(yaml@2.4.5) + version: 8.3.0(@microsoft/api-extractor@7.47.9(@types/node@20.14.10))(jiti@1.21.6)(postcss@8.4.47)(typescript@5.5.3)(yaml@2.4.5) typescript: specifier: 5.5.3 version: 5.5.3 @@ -77,7 +77,7 @@ importers: devDependencies: vitepress: specifier: 1.3.0 - version: 1.3.0(@algolia/client-search@4.23.3)(@types/node@20.14.10)(@types/react@18.3.3)(axios@1.7.7)(less@4.2.0)(postcss@8.4.45)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.71.1)(search-insights@2.14.0)(terser@5.31.1)(typescript@5.5.3) + version: 1.3.0(@algolia/client-search@4.23.3)(@types/node@20.14.10)(@types/react@18.3.3)(axios@1.7.7)(less@4.2.0)(postcss@8.4.47)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.71.1)(search-insights@2.14.0)(terser@5.31.1)(typescript@5.5.3) examples/openapi-ts-axios: dependencies: @@ -363,19 +363,19 @@ importers: version: link:../../packages/client-fetch '@tanstack/vue-query': specifier: 5.56.2 - version: 5.56.2(vue@3.5.5(typescript@5.5.3)) + version: 5.56.2(vue@3.5.8(typescript@5.5.3)) '@tanstack/vue-query-devtools': specifier: 5.56.2 - version: 5.56.2(@tanstack/vue-query@5.56.2(vue@3.5.5(typescript@5.5.3)))(vue@3.5.5(typescript@5.5.3)) + version: 5.56.2(@tanstack/vue-query@5.56.2(vue@3.5.8(typescript@5.5.3)))(vue@3.5.8(typescript@5.5.3)) pinia: specifier: 2.2.2 - version: 2.2.2(typescript@5.5.3)(vue@3.5.5(typescript@5.5.3)) + version: 2.2.2(typescript@5.5.3)(vue@3.5.8(typescript@5.5.3)) vue: - specifier: 3.5.5 - version: 3.5.5(typescript@5.5.3) + specifier: 3.5.8 + version: 3.5.8(typescript@5.5.3) vue-router: specifier: 4.4.5 - version: 4.4.5(vue@3.5.5(typescript@5.5.3)) + version: 4.4.5(vue@3.5.8(typescript@5.5.3)) devDependencies: '@hey-api/openapi-ts': specifier: workspace:* @@ -394,10 +394,10 @@ importers: version: 20.14.5 '@vitejs/plugin-vue': specifier: 5.0.5 - version: 5.0.5(vite@5.4.6(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1))(vue@3.5.5(typescript@5.5.3)) + version: 5.0.5(vite@5.4.6(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1))(vue@3.5.8(typescript@5.5.3)) '@vitejs/plugin-vue-jsx': specifier: 4.0.0 - version: 4.0.0(vite@5.4.6(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1))(vue@3.5.5(typescript@5.5.3)) + version: 4.0.0(vite@5.4.6(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1))(vue@3.5.8(typescript@5.5.3)) '@vue/eslint-config-prettier': specifier: 9.0.0 version: 9.0.0(@types/eslint@9.6.0)(eslint@9.6.0)(prettier@3.3.2) @@ -442,7 +442,7 @@ importers: version: 5.4.6(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1) vite-plugin-vue-devtools: specifier: 7.3.1 - version: 7.3.1(rollup@4.22.0)(vite@5.4.6(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1))(vue@3.5.5(typescript@5.5.3)) + version: 7.3.1(rollup@4.22.0)(vite@5.4.6(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1))(vue@3.5.8(typescript@5.5.3)) vitest: specifier: 1.6.0 version: 1.6.0(@types/node@20.14.5)(jsdom@24.1.0)(less@4.2.0)(sass@1.71.1)(terser@5.31.1) @@ -525,7 +525,7 @@ importers: version: 5.56.2(svelte@4.2.19) '@tanstack/vue-query': specifier: 5.56.2 - version: 5.56.2(vue@3.5.5(typescript@5.5.3)) + version: 5.56.2(vue@3.5.8(typescript@5.5.3)) '@types/cross-spawn': specifier: 6.0.6 version: 6.0.6 @@ -3670,30 +3670,30 @@ packages: peerDependencies: '@babel/core': ^7.0.0-0 - '@vue/compiler-core@3.5.3': - resolution: {integrity: sha512-adAfy9boPkP233NTyvLbGEqVuIfK/R0ZsBsIOW4BZNfb4BRpRW41Do1u+ozJpsb+mdoy80O20IzAsHaihRb5qA==} - '@vue/compiler-core@3.5.5': resolution: {integrity: sha512-ZrxcY8JMoV+kgDrmRwlDufz0SjDZ7jfoNZiIBluAACMBmgr55o/jTbxnyrccH6VSJXnFaDI4Ik1UFCiq9r8i7w==} - '@vue/compiler-dom@3.5.3': - resolution: {integrity: sha512-wnzFArg9zpvk/811CDOZOadJRugf1Bgl/TQ3RfV4nKfSPok4hi0w10ziYUQR6LnnBAUlEXYLUfZ71Oj9ds/+QA==} + '@vue/compiler-core@3.5.8': + resolution: {integrity: sha512-Uzlxp91EPjfbpeO5KtC0KnXPkuTfGsNDeaKQJxQN718uz+RqDYarEf7UhQJGK+ZYloD2taUbHTI2J4WrUaZQNA==} '@vue/compiler-dom@3.5.5': resolution: {integrity: sha512-HSvK5q1gmBbxRse3S0Wt34RcKuOyjDJKDDMuF3i7NC+QkDFrbAqw8NnrEm/z7zFDxWZa4/5eUwsBOMQzm1RHBA==} - '@vue/compiler-sfc@3.5.3': - resolution: {integrity: sha512-P3uATLny2tfyvMB04OQFe7Sczteno7SLFxwrOA/dw01pBWQHB5HL15a8PosoNX2aG/EAMGqnXTu+1LnmzFhpTQ==} + '@vue/compiler-dom@3.5.8': + resolution: {integrity: sha512-GUNHWvoDSbSa5ZSHT9SnV5WkStWfzJwwTd6NMGzilOE/HM5j+9EB9zGXdtu/fCNEmctBqMs6C9SvVPpVPuk1Eg==} '@vue/compiler-sfc@3.5.5': resolution: {integrity: sha512-MzBHDxwZhgQPHrwJ5tj92gdTYRCuPDSZr8PY3+JFv8cv2UD5/WayH5yo0kKCkKfrtJhc39jNSMityHrkMSbfnA==} - '@vue/compiler-ssr@3.5.3': - resolution: {integrity: sha512-F/5f+r2WzL/2YAPl7UlKcJWHrvoZN8XwEBLnT7S4BXwncH25iDOabhO2M2DWioyTguJAGavDOawejkFXj8EM1w==} + '@vue/compiler-sfc@3.5.8': + resolution: {integrity: sha512-taYpngQtSysrvO9GULaOSwcG5q821zCoIQBtQQSx7Uf7DxpR6CIHR90toPr9QfDD2mqHQPCSgoWBvJu0yV9zjg==} '@vue/compiler-ssr@3.5.5': resolution: {integrity: sha512-oFasHnpv/upubjJEmqiTKQYb4qS3ziJddf4UVWuFw6ebk/QTrTUc+AUoTJdo39x9g+AOQBzhOU0ICCRuUjvkmw==} + '@vue/compiler-ssr@3.5.8': + resolution: {integrity: sha512-W96PtryNsNG9u0ZnN5Q5j27Z/feGrFV6zy9q5tzJVyJaLiwYxvC0ek4IXClZygyhjm+XKM7WD9pdKi/wIRVC/Q==} + '@vue/compiler-vue2@2.7.16': resolution: {integrity: sha512-qYC3Psj9S/mfu9uVi5WvNZIzq+xnXMhOwbTFKKDD7b1lhpnn71jXSFdTQ+WsIEk0ONCd7VV2IMm7ONl6tbQ86A==} @@ -3745,43 +3745,43 @@ packages: typescript: optional: true - '@vue/reactivity@3.5.3': - resolution: {integrity: sha512-2w61UnRWTP7+rj1H/j6FH706gRBHdFVpIqEkSDAyIpafBXYH8xt4gttstbbCWdU3OlcSWO8/3mbKl/93/HSMpw==} - '@vue/reactivity@3.5.5': resolution: {integrity: sha512-V4tTWElZQhT73PSK3Wnax9R9m4qvMX+LeKHnfylZc6SLh4Jc5/BPakp6e3zEhKWi5AN8TDzRkGnLkp8OqycYng==} - '@vue/runtime-core@3.5.3': - resolution: {integrity: sha512-5b2AQw5OZlmCzSsSBWYoZOsy75N4UdMWenTfDdI5bAzXnuVR7iR8Q4AOzQm2OGoA41xjk53VQKrqQhOz2ktWaw==} + '@vue/reactivity@3.5.8': + resolution: {integrity: sha512-mlgUyFHLCUZcAYkqvzYnlBRCh0t5ZQfLYit7nukn1GR96gc48Bp4B7OIcSfVSvlG1k3BPfD+p22gi1t2n9tsXg==} '@vue/runtime-core@3.5.5': resolution: {integrity: sha512-2/CFaRN17jgsXy4MpigWFBCAMmLkXPb4CjaHrndglwYSra7ajvkH2cat21dscuXaH91G8fXAeg5gCyxWJ+wCRA==} - '@vue/runtime-dom@3.5.3': - resolution: {integrity: sha512-wPR1DEGc3XnQ7yHbmkTt3GoY0cEnVGQnARRdAkDzZ8MbUKEs26gogCQo6AOvvgahfjIcnvWJzkZArQ1fmWjcSg==} + '@vue/runtime-core@3.5.8': + resolution: {integrity: sha512-fJuPelh64agZ8vKkZgp5iCkPaEqFJsYzxLk9vSC0X3G8ppknclNDr61gDc45yBGTaN5Xqc1qZWU3/NoaBMHcjQ==} '@vue/runtime-dom@3.5.5': resolution: {integrity: sha512-0bQGgCuL+4Muz5PsCLgF4Ata9BTdhHi5VjsxtTDyI0Wy4MgoSvBGaA6bDc7W7CGgZOyirf9LNeetMYHQ05pgpw==} - '@vue/server-renderer@3.5.3': - resolution: {integrity: sha512-28volmaZVG2PGO3V3+gBPKoSHvLlE8FGfG/GKXKkjjfxLuj/50B/0OQGakM/g6ehQeqCrZYM4eHC4Ks48eig1Q==} - peerDependencies: - vue: 3.5.3 + '@vue/runtime-dom@3.5.8': + resolution: {integrity: sha512-DpAUz+PKjTZPUOB6zJgkxVI3GuYc2iWZiNeeHQUw53kdrparSTG6HeXUrYDjaam8dVsCdvQxDz6ZWxnyjccUjQ==} '@vue/server-renderer@3.5.5': resolution: {integrity: sha512-XjRamLIq5f47cxgy+hiX7zUIY+4RHdPDVrPvvMDAUTdW5RJWX/S0ji/rCbm3LWTT/9Co9bvQME8ZI15ahL4/Qw==} peerDependencies: vue: 3.5.5 + '@vue/server-renderer@3.5.8': + resolution: {integrity: sha512-7AmC9/mEeV9mmXNVyUIm1a1AjUhyeeGNbkLh39J00E7iPeGks8OGRB5blJiMmvqSh8SkaS7jkLWSpXtxUCeagA==} + peerDependencies: + vue: 3.5.8 + '@vue/shared@3.4.31': resolution: {integrity: sha512-Yp3wtJk//8cO4NItOPpi3QkLExAr/aLBGZMmTtW9WpdwBCJpRM6zj9WgWktXAl8IDIozwNMByT45JP3tO3ACWA==} - '@vue/shared@3.5.3': - resolution: {integrity: sha512-Jp2v8nylKBT+PlOUjun2Wp/f++TfJVFjshLzNtJDdmFJabJa7noGMncqXRM1vXGX+Yo2V7WykQFNxusSim8SCA==} - '@vue/shared@3.5.5': resolution: {integrity: sha512-0KyMXyEgnmFAs6rNUL+6eUHtUCqCaNrVd+AW3MX3LyA0Yry5SA0Km03CDKiOua1x1WWnIr+W9+S0GMFoSDWERQ==} + '@vue/shared@3.5.8': + resolution: {integrity: sha512-mJleSWbAGySd2RJdX1RBtcrUBX6snyOc0qHpgk3lGi4l9/P/3ny3ELqFWqYdkXIwwNN/kdm8nD9ky8o6l/Lx2A==} + '@vue/test-utils@2.4.6': resolution: {integrity: sha512-FMxEjOpYNYiFe0GkaHsnJPXFHxQ6m4t8vI/ElPGpMWxZKpmRvQ33OIrvRXemy6yha03RxhOlQuy+gZMC3CQSow==} @@ -3924,6 +3924,11 @@ packages: engines: {node: '>=0.4.0'} hasBin: true + acorn@8.12.1: + resolution: {integrity: sha512-tcpGyI9zbizT9JbV6oYE477V6mTlXvvi0T0G3SNIYE2apm/G5huBa1+K89VGeovbg+jycCrfhl3ADxErOuO6Jg==} + engines: {node: '>=0.4.0'} + hasBin: true + adjust-sourcemap-loader@4.0.0: resolution: {integrity: sha512-OXwN5b9pCUXNQHJpwwD2qP40byEmSgzj8B4ydSN0uMNYWiFmJ6x6KwUllMmfk8Rwu/HJDFR7U8ubsWBoN0Xp0A==} engines: {node: '>=8.9'} @@ -6538,6 +6543,9 @@ packages: picocolors@1.0.1: resolution: {integrity: sha512-anP1Z8qwhkbmu7MFP5iTt+wQKXgwzf7zTyGlcdzabySa9vd0Xt392U0rVmz9poOaBj0uHJKyyo9/upk0HrEQew==} + picocolors@1.1.0: + resolution: {integrity: sha512-TQ92mBOW0l3LeMeyLV6mzy/kWr8lkd/hp3mTg7wYK7zJhuBStmGMBG0BdeDZS/dZx1IukaX6Bk11zcln25o1Aw==} + picomatch@2.3.1: resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==} engines: {node: '>=8.6'} @@ -6731,6 +6739,10 @@ packages: resolution: {integrity: sha512-7KTLTdzdZZYscUc65XmjFiB73vBhBfbPztCYdUNvlaso9PrzjzcmjqBPR0lNGkcVlcO4BjiO5rK/qNz+XAen1Q==} engines: {node: ^10 || ^12 || >=14} + postcss@8.4.47: + resolution: {integrity: sha512-56rxCq7G/XfB4EkXq9Egn5GCqugWvDFjafDOThIdMBsI15iqPqR5r15TfSr1YPYeEI19YeaXMCbY6u88Y76GLQ==} + engines: {node: ^10 || ^12 || >=14} + preact@10.22.0: resolution: {integrity: sha512-RRurnSjJPj4rp5K6XoP45Ui33ncb7e4H7WiOHVpjbkvqvA3U+N8Z6Qbo0AE6leGYBV66n8EhEaFixvIu3SkxFw==} @@ -7286,6 +7298,10 @@ packages: resolution: {integrity: sha512-itJW8lvSA0TXEphiRoawsCksnlf8SyvmFzIhltqAHluXd88pkCd+cXJVHTDwdCr0IzwptSm035IHQktUu1QUMg==} engines: {node: '>=0.10.0'} + source-map-js@1.2.1: + resolution: {integrity: sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==} + engines: {node: '>=0.10.0'} + source-map-loader@5.0.0: resolution: {integrity: sha512-k2Dur7CbSLcAH73sBcIkV5xjPV4SzqO1NJ7+XaQl8if3VODDUj3FNchNGpqgJSKbvUfJuhVdv8K2Eu8/TNl2eA==} engines: {node: '>= 18.12.0'} @@ -8107,16 +8123,16 @@ packages: peerDependencies: typescript: '>=5.0.0' - vue@3.5.3: - resolution: {integrity: sha512-xvRbd0HpuLovYbOHXRHlSBsSvmUJbo0pzbkKTApWnQGf3/cu5Z39mQeA5cZdLRVIoNf3zI6MSoOgHUT5i2jO+Q==} + vue@3.5.5: + resolution: {integrity: sha512-ybC+xn67K4+df1yVeov4UjBGyVcXM0a1g7JVZr+pWVUX3xF6ntXU0wIjkTkduZBUIpxTlsftJSxz2kwhsT7dgA==} peerDependencies: typescript: '*' peerDependenciesMeta: typescript: optional: true - vue@3.5.5: - resolution: {integrity: sha512-ybC+xn67K4+df1yVeov4UjBGyVcXM0a1g7JVZr+pWVUX3xF6ntXU0wIjkTkduZBUIpxTlsftJSxz2kwhsT7dgA==} + vue@3.5.8: + resolution: {integrity: sha512-hvuvuCy51nP/1fSRvrrIqTLSvrSyz2Pq+KQ8S8SXCxTWVE0nMaOnSDnSOxV1eYmGfvK7mqiwvd1C59CEEz7dAQ==} peerDependencies: typescript: '*' peerDependenciesMeta: @@ -8498,7 +8514,7 @@ snapshots: dependencies: '@ampproject/remapping': 2.3.0 '@angular-devkit/architect': 0.1703.7(chokidar@3.6.0) - '@angular-devkit/build-webpack': 0.1703.7(chokidar@3.6.0)(webpack-dev-server@4.15.1(webpack@5.90.3(esbuild@0.23.1)))(webpack@5.90.3(esbuild@0.20.1)) + '@angular-devkit/build-webpack': 0.1703.7(chokidar@3.6.0)(webpack-dev-server@4.15.1(webpack@5.90.3(esbuild@0.20.1)))(webpack@5.90.3(esbuild@0.20.1)) '@angular-devkit/core': 17.3.7(chokidar@3.6.0) '@angular/compiler-cli': 17.3.9(@angular/compiler@17.3.9(@angular/core@17.3.9(rxjs@7.8.1)(zone.js@0.14.7)))(typescript@5.5.3) '@babel/core': 7.24.0 @@ -8556,9 +8572,9 @@ snapshots: undici: 6.11.1 vite: 5.1.7(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.29.1) watchpack: 2.4.0 - webpack: 5.90.3(esbuild@0.20.1) + webpack: 5.90.3(esbuild@0.23.1) webpack-dev-middleware: 6.1.2(webpack@5.90.3(esbuild@0.20.1)) - webpack-dev-server: 4.15.1(webpack@5.90.3(esbuild@0.23.1)) + webpack-dev-server: 4.15.1(webpack@5.90.3(esbuild@0.20.1)) webpack-merge: 5.10.0 webpack-subresource-integrity: 5.1.0(webpack@5.90.3(esbuild@0.20.1)) optionalDependencies: @@ -8583,12 +8599,12 @@ snapshots: - utf-8-validate - webpack-cli - '@angular-devkit/build-webpack@0.1703.7(chokidar@3.6.0)(webpack-dev-server@4.15.1(webpack@5.90.3(esbuild@0.23.1)))(webpack@5.90.3(esbuild@0.20.1))': + '@angular-devkit/build-webpack@0.1703.7(chokidar@3.6.0)(webpack-dev-server@4.15.1(webpack@5.90.3(esbuild@0.20.1)))(webpack@5.90.3(esbuild@0.20.1))': dependencies: '@angular-devkit/architect': 0.1703.7(chokidar@3.6.0) rxjs: 7.8.1 - webpack: 5.90.3(esbuild@0.20.1) - webpack-dev-server: 4.15.1(webpack@5.90.3(esbuild@0.23.1)) + webpack: 5.90.3(esbuild@0.23.1) + webpack-dev-server: 4.15.1(webpack@5.90.3(esbuild@0.20.1)) transitivePeerDependencies: - chokidar @@ -10410,7 +10426,7 @@ snapshots: dependencies: '@angular/compiler-cli': 17.3.9(@angular/compiler@17.3.9(@angular/core@17.3.9(rxjs@7.8.1)(zone.js@0.14.7)))(typescript@5.5.3) typescript: 5.5.3 - webpack: 5.90.3(esbuild@0.20.1) + webpack: 5.90.3(esbuild@0.23.1) '@nodelib/fs.scandir@2.1.5': dependencies: @@ -11433,19 +11449,19 @@ snapshots: '@tanstack/query-core': 5.56.2 svelte: 4.2.19 - '@tanstack/vue-query-devtools@5.56.2(@tanstack/vue-query@5.56.2(vue@3.5.5(typescript@5.5.3)))(vue@3.5.5(typescript@5.5.3))': + '@tanstack/vue-query-devtools@5.56.2(@tanstack/vue-query@5.56.2(vue@3.5.8(typescript@5.5.3)))(vue@3.5.8(typescript@5.5.3))': dependencies: '@tanstack/query-devtools': 5.56.1 - '@tanstack/vue-query': 5.56.2(vue@3.5.5(typescript@5.5.3)) - vue: 3.5.5(typescript@5.5.3) + '@tanstack/vue-query': 5.56.2(vue@3.5.8(typescript@5.5.3)) + vue: 3.5.8(typescript@5.5.3) - '@tanstack/vue-query@5.56.2(vue@3.5.5(typescript@5.5.3))': + '@tanstack/vue-query@5.56.2(vue@3.5.8(typescript@5.5.3))': dependencies: '@tanstack/match-sorter-utils': 8.19.4 '@tanstack/query-core': 5.56.2 '@vue/devtools-api': 6.6.3 - vue: 3.5.5(typescript@5.5.3) - vue-demi: 0.14.10(vue@3.5.5(typescript@5.5.3)) + vue: 3.5.8(typescript@5.5.3) + vue-demi: 0.14.10(vue@3.5.8(typescript@5.5.3)) '@tootallnate/quickjs-emscripten@0.23.0': {} @@ -11864,25 +11880,25 @@ snapshots: transitivePeerDependencies: - supports-color - '@vitejs/plugin-vue-jsx@4.0.0(vite@5.4.6(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1))(vue@3.5.5(typescript@5.5.3))': + '@vitejs/plugin-vue-jsx@4.0.0(vite@5.4.6(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1))(vue@3.5.8(typescript@5.5.3))': dependencies: '@babel/core': 7.24.7 '@babel/plugin-transform-typescript': 7.25.2(@babel/core@7.24.7) '@vue/babel-plugin-jsx': 1.2.2(@babel/core@7.24.7) vite: 5.4.6(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1) - vue: 3.5.5(typescript@5.5.3) + vue: 3.5.8(typescript@5.5.3) transitivePeerDependencies: - supports-color - '@vitejs/plugin-vue@5.0.5(vite@5.4.6(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1))(vue@3.5.3(typescript@5.5.3))': + '@vitejs/plugin-vue@5.0.5(vite@5.4.6(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1))(vue@3.5.5(typescript@5.5.3))': dependencies: vite: 5.4.6(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1) - vue: 3.5.3(typescript@5.5.3) + vue: 3.5.5(typescript@5.5.3) - '@vitejs/plugin-vue@5.0.5(vite@5.4.6(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1))(vue@3.5.5(typescript@5.5.3))': + '@vitejs/plugin-vue@5.0.5(vite@5.4.6(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1))(vue@3.5.8(typescript@5.5.3))': dependencies: vite: 5.4.6(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1) - vue: 3.5.5(typescript@5.5.3) + vue: 3.5.8(typescript@5.5.3) '@vitest/coverage-v8@1.6.0(vitest@1.6.0(@types/node@20.14.10)(jsdom@24.1.0)(less@4.2.0)(sass@1.71.1)(terser@5.31.1))': dependencies: @@ -11999,45 +12015,33 @@ snapshots: '@babel/helper-module-imports': 7.22.15 '@babel/helper-plugin-utils': 7.24.8 '@babel/parser': 7.25.3 - '@vue/compiler-sfc': 3.5.5 + '@vue/compiler-sfc': 3.5.8 - '@vue/compiler-core@3.5.3': + '@vue/compiler-core@3.5.5': dependencies: '@babel/parser': 7.25.3 - '@vue/shared': 3.5.3 + '@vue/shared': 3.5.5 entities: 4.5.0 estree-walker: 2.0.2 - source-map-js: 1.2.0 + source-map-js: 1.2.1 - '@vue/compiler-core@3.5.5': + '@vue/compiler-core@3.5.8': dependencies: '@babel/parser': 7.25.3 - '@vue/shared': 3.5.5 + '@vue/shared': 3.5.8 entities: 4.5.0 estree-walker: 2.0.2 - source-map-js: 1.2.0 - - '@vue/compiler-dom@3.5.3': - dependencies: - '@vue/compiler-core': 3.5.3 - '@vue/shared': 3.5.3 + source-map-js: 1.2.1 '@vue/compiler-dom@3.5.5': dependencies: '@vue/compiler-core': 3.5.5 '@vue/shared': 3.5.5 - '@vue/compiler-sfc@3.5.3': + '@vue/compiler-dom@3.5.8': dependencies: - '@babel/parser': 7.25.3 - '@vue/compiler-core': 3.5.3 - '@vue/compiler-dom': 3.5.3 - '@vue/compiler-ssr': 3.5.3 - '@vue/shared': 3.5.3 - estree-walker: 2.0.2 - magic-string: 0.30.11 - postcss: 8.4.45 - source-map-js: 1.2.0 + '@vue/compiler-core': 3.5.8 + '@vue/shared': 3.5.8 '@vue/compiler-sfc@3.5.5': dependencies: @@ -12051,16 +12055,28 @@ snapshots: postcss: 8.4.45 source-map-js: 1.2.0 - '@vue/compiler-ssr@3.5.3': + '@vue/compiler-sfc@3.5.8': dependencies: - '@vue/compiler-dom': 3.5.3 - '@vue/shared': 3.5.3 + '@babel/parser': 7.25.3 + '@vue/compiler-core': 3.5.8 + '@vue/compiler-dom': 3.5.8 + '@vue/compiler-ssr': 3.5.8 + '@vue/shared': 3.5.8 + estree-walker: 2.0.2 + magic-string: 0.30.11 + postcss: 8.4.47 + source-map-js: 1.2.1 '@vue/compiler-ssr@3.5.5': dependencies: '@vue/compiler-dom': 3.5.5 '@vue/shared': 3.5.5 + '@vue/compiler-ssr@3.5.8': + dependencies: + '@vue/compiler-dom': 3.5.8 + '@vue/shared': 3.5.8 + '@vue/compiler-vue2@2.7.16': dependencies: de-indent: 1.0.2 @@ -12074,7 +12090,7 @@ snapshots: dependencies: '@vue/devtools-kit': 7.3.5 - '@vue/devtools-core@7.3.7(vite@5.4.6(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1))(vue@3.5.5(typescript@5.5.3))': + '@vue/devtools-core@7.3.7(vite@5.4.6(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1))(vue@3.5.8(typescript@5.5.3))': dependencies: '@vue/devtools-kit': 7.3.7 '@vue/devtools-shared': 7.3.7 @@ -12082,7 +12098,7 @@ snapshots: nanoid: 3.3.7 pathe: 1.1.2 vite-hot-client: 0.2.3(vite@5.4.6(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1)) - vue: 3.5.5(typescript@5.5.3) + vue: 3.5.8(typescript@5.5.3) transitivePeerDependencies: - vite @@ -12134,9 +12150,9 @@ snapshots: '@vue/language-core@2.0.29(typescript@5.5.3)': dependencies: '@volar/language-core': 2.4.0-alpha.18 - '@vue/compiler-dom': 3.5.3 + '@vue/compiler-dom': 3.5.5 '@vue/compiler-vue2': 2.7.16 - '@vue/shared': 3.5.3 + '@vue/shared': 3.5.5 computeds: 0.0.1 minimatch: 9.0.5 muggle-string: 0.4.1 @@ -12144,30 +12160,23 @@ snapshots: optionalDependencies: typescript: 5.5.3 - '@vue/reactivity@3.5.3': - dependencies: - '@vue/shared': 3.5.3 - '@vue/reactivity@3.5.5': dependencies: '@vue/shared': 3.5.5 - '@vue/runtime-core@3.5.3': + '@vue/reactivity@3.5.8': dependencies: - '@vue/reactivity': 3.5.3 - '@vue/shared': 3.5.3 + '@vue/shared': 3.5.8 '@vue/runtime-core@3.5.5': dependencies: '@vue/reactivity': 3.5.5 '@vue/shared': 3.5.5 - '@vue/runtime-dom@3.5.3': + '@vue/runtime-core@3.5.8': dependencies: - '@vue/reactivity': 3.5.3 - '@vue/runtime-core': 3.5.3 - '@vue/shared': 3.5.3 - csstype: 3.1.3 + '@vue/reactivity': 3.5.8 + '@vue/shared': 3.5.8 '@vue/runtime-dom@3.5.5': dependencies: @@ -12176,11 +12185,12 @@ snapshots: '@vue/shared': 3.5.5 csstype: 3.1.3 - '@vue/server-renderer@3.5.3(vue@3.5.3(typescript@5.5.3))': + '@vue/runtime-dom@3.5.8': dependencies: - '@vue/compiler-ssr': 3.5.3 - '@vue/shared': 3.5.3 - vue: 3.5.3(typescript@5.5.3) + '@vue/reactivity': 3.5.8 + '@vue/runtime-core': 3.5.8 + '@vue/shared': 3.5.8 + csstype: 3.1.3 '@vue/server-renderer@3.5.5(vue@3.5.5(typescript@5.5.3))': dependencies: @@ -12188,12 +12198,18 @@ snapshots: '@vue/shared': 3.5.5 vue: 3.5.5(typescript@5.5.3) - '@vue/shared@3.4.31': {} + '@vue/server-renderer@3.5.8(vue@3.5.8(typescript@5.5.3))': + dependencies: + '@vue/compiler-ssr': 3.5.8 + '@vue/shared': 3.5.8 + vue: 3.5.8(typescript@5.5.3) - '@vue/shared@3.5.3': {} + '@vue/shared@3.4.31': {} '@vue/shared@3.5.5': {} + '@vue/shared@3.5.8': {} + '@vue/test-utils@2.4.6': dependencies: js-beautify: 1.15.1 @@ -12201,21 +12217,21 @@ snapshots: '@vue/tsconfig@0.5.1': {} - '@vueuse/core@10.11.0(vue@3.5.3(typescript@5.5.3))': + '@vueuse/core@10.11.0(vue@3.5.5(typescript@5.5.3))': dependencies: '@types/web-bluetooth': 0.0.20 '@vueuse/metadata': 10.11.0 - '@vueuse/shared': 10.11.0(vue@3.5.3(typescript@5.5.3)) - vue-demi: 0.14.10(vue@3.5.3(typescript@5.5.3)) + '@vueuse/shared': 10.11.0(vue@3.5.5(typescript@5.5.3)) + vue-demi: 0.14.10(vue@3.5.5(typescript@5.5.3)) transitivePeerDependencies: - '@vue/composition-api' - vue - '@vueuse/integrations@10.11.0(axios@1.7.7)(focus-trap@7.5.4)(vue@3.5.3(typescript@5.5.3))': + '@vueuse/integrations@10.11.0(axios@1.7.7)(focus-trap@7.5.4)(vue@3.5.5(typescript@5.5.3))': dependencies: - '@vueuse/core': 10.11.0(vue@3.5.3(typescript@5.5.3)) - '@vueuse/shared': 10.11.0(vue@3.5.3(typescript@5.5.3)) - vue-demi: 0.14.10(vue@3.5.3(typescript@5.5.3)) + '@vueuse/core': 10.11.0(vue@3.5.5(typescript@5.5.3)) + '@vueuse/shared': 10.11.0(vue@3.5.5(typescript@5.5.3)) + vue-demi: 0.14.10(vue@3.5.5(typescript@5.5.3)) optionalDependencies: axios: 1.7.7 focus-trap: 7.5.4 @@ -12225,9 +12241,9 @@ snapshots: '@vueuse/metadata@10.11.0': {} - '@vueuse/shared@10.11.0(vue@3.5.3(typescript@5.5.3))': + '@vueuse/shared@10.11.0(vue@3.5.5(typescript@5.5.3))': dependencies: - vue-demi: 0.14.10(vue@3.5.3(typescript@5.5.3)) + vue-demi: 0.14.10(vue@3.5.5(typescript@5.5.3)) transitivePeerDependencies: - '@vue/composition-api' - vue @@ -12341,6 +12357,9 @@ snapshots: acorn@8.12.0: {} + acorn@8.12.1: + optional: true + adjust-sourcemap-loader@4.0.0: dependencies: loader-utils: 2.0.4 @@ -12547,7 +12566,7 @@ snapshots: '@babel/core': 7.24.0 find-cache-dir: 4.0.0 schema-utils: 4.2.0 - webpack: 5.90.3(esbuild@0.20.1) + webpack: 5.90.3(esbuild@0.23.1) babel-plugin-istanbul@6.1.1: dependencies: @@ -12984,7 +13003,7 @@ snapshots: normalize-path: 3.0.0 schema-utils: 4.2.0 serialize-javascript: 6.0.2 - webpack: 5.90.3(esbuild@0.20.1) + webpack: 5.90.3(esbuild@0.23.1) core-js-compat@3.37.1: dependencies: @@ -13036,7 +13055,7 @@ snapshots: postcss-value-parser: 4.2.0 semver: 7.6.2 optionalDependencies: - webpack: 5.90.3(esbuild@0.20.1) + webpack: 5.90.3(esbuild@0.23.1) css-select@5.1.0: dependencies: @@ -14455,7 +14474,7 @@ snapshots: dependencies: klona: 2.0.6 less: 4.2.0 - webpack: 5.90.3(esbuild@0.20.1) + webpack: 5.90.3(esbuild@0.23.1) less@4.2.0: dependencies: @@ -14480,7 +14499,7 @@ snapshots: dependencies: webpack-sources: 3.2.3 optionalDependencies: - webpack: 5.90.3(esbuild@0.20.1) + webpack: 5.90.3(esbuild@0.23.1) lilconfig@2.1.0: {} @@ -14706,7 +14725,7 @@ snapshots: dependencies: schema-utils: 4.2.0 tapable: 2.2.1 - webpack: 5.90.3(esbuild@0.20.1) + webpack: 5.90.3(esbuild@0.23.1) minimalistic-assert@1.0.1: {} @@ -15208,6 +15227,8 @@ snapshots: picocolors@1.0.1: {} + picocolors@1.1.0: {} + picomatch@2.3.1: {} picomatch@4.0.1: {} @@ -15220,11 +15241,11 @@ snapshots: pify@4.0.1: {} - pinia@2.2.2(typescript@5.5.3)(vue@3.5.5(typescript@5.5.3)): + pinia@2.2.2(typescript@5.5.3)(vue@3.5.8(typescript@5.5.3)): dependencies: '@vue/devtools-api': 6.6.3 - vue: 3.5.5(typescript@5.5.3) - vue-demi: 0.14.10(vue@3.5.5(typescript@5.5.3)) + vue: 3.5.8(typescript@5.5.3) + vue-demi: 0.14.10(vue@3.5.8(typescript@5.5.3)) optionalDependencies: typescript: 5.5.3 @@ -15290,12 +15311,12 @@ snapshots: postcss: 8.4.39 ts-node: 10.9.2(@types/node@20.14.5)(typescript@5.5.3) - postcss-load-config@6.0.1(jiti@1.21.6)(postcss@8.4.45)(yaml@2.4.5): + postcss-load-config@6.0.1(jiti@1.21.6)(postcss@8.4.47)(yaml@2.4.5): dependencies: lilconfig: 3.1.2 optionalDependencies: jiti: 1.21.6 - postcss: 8.4.45 + postcss: 8.4.47 yaml: 2.4.5 postcss-loader@8.1.1(postcss@8.4.35)(typescript@5.5.3)(webpack@5.90.3(esbuild@0.20.1)): @@ -15305,7 +15326,7 @@ snapshots: postcss: 8.4.35 semver: 7.6.2 optionalDependencies: - webpack: 5.90.3(esbuild@0.20.1) + webpack: 5.90.3(esbuild@0.23.1) transitivePeerDependencies: - typescript @@ -15376,6 +15397,12 @@ snapshots: picocolors: 1.0.1 source-map-js: 1.2.0 + postcss@8.4.47: + dependencies: + nanoid: 3.3.7 + picocolors: 1.1.0 + source-map-js: 1.2.1 + preact@10.22.0: {} preferred-pm@3.1.4: @@ -15761,7 +15788,7 @@ snapshots: neo-async: 2.6.2 optionalDependencies: sass: 1.71.1 - webpack: 5.90.3(esbuild@0.20.1) + webpack: 5.90.3(esbuild@0.23.1) sass@1.71.1: dependencies: @@ -15989,11 +16016,13 @@ snapshots: source-map-js@1.2.0: {} + source-map-js@1.2.1: {} + source-map-loader@5.0.0(webpack@5.90.3(esbuild@0.20.1)): dependencies: iconv-lite: 0.6.3 source-map-js: 1.2.0 - webpack: 5.90.3(esbuild@0.20.1) + webpack: 5.90.3(esbuild@0.23.1) source-map-support@0.5.21: dependencies: @@ -16350,16 +16379,16 @@ snapshots: term-size@2.2.1: {} - terser-webpack-plugin@5.3.10(esbuild@0.20.1)(webpack@5.90.3(esbuild@0.23.1)): + terser-webpack-plugin@5.3.10(esbuild@0.23.1)(webpack@5.90.3(esbuild@0.20.1)): dependencies: '@jridgewell/trace-mapping': 0.3.25 jest-worker: 27.5.1 schema-utils: 3.3.0 serialize-javascript: 6.0.2 terser: 5.29.1 - webpack: 5.90.3(esbuild@0.20.1) + webpack: 5.90.3(esbuild@0.23.1) optionalDependencies: - esbuild: 0.20.1 + esbuild: 0.23.1 terser@5.29.1: dependencies: @@ -16371,7 +16400,7 @@ snapshots: terser@5.31.1: dependencies: '@jridgewell/source-map': 0.3.6 - acorn: 8.12.0 + acorn: 8.12.1 commander: 2.20.3 source-map-support: 0.5.21 optional: true @@ -16502,7 +16531,7 @@ snapshots: tslib@2.6.3: {} - tsup@8.3.0(@microsoft/api-extractor@7.47.9(@types/node@20.14.10))(jiti@1.21.6)(postcss@8.4.45)(typescript@5.5.3)(yaml@2.4.5): + tsup@8.3.0(@microsoft/api-extractor@7.47.9(@types/node@20.14.10))(jiti@1.21.6)(postcss@8.4.47)(typescript@5.5.3)(yaml@2.4.5): dependencies: bundle-require: 5.0.0(esbuild@0.23.1) cac: 6.7.14 @@ -16513,7 +16542,7 @@ snapshots: execa: 5.1.1 joycon: 3.1.1 picocolors: 1.0.1 - postcss-load-config: 6.0.1(jiti@1.21.6)(postcss@8.4.45)(yaml@2.4.5) + postcss-load-config: 6.0.1(jiti@1.21.6)(postcss@8.4.47)(yaml@2.4.5) resolve-from: 5.0.0 rollup: 4.22.0 source-map: 0.8.0-beta.0 @@ -16522,7 +16551,7 @@ snapshots: tree-kill: 1.2.2 optionalDependencies: '@microsoft/api-extractor': 7.47.9(@types/node@20.14.10) - postcss: 8.4.45 + postcss: 8.4.47 typescript: 5.5.3 transitivePeerDependencies: - jiti @@ -16761,9 +16790,9 @@ snapshots: - rollup - supports-color - vite-plugin-vue-devtools@7.3.1(rollup@4.22.0)(vite@5.4.6(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1))(vue@3.5.5(typescript@5.5.3)): + vite-plugin-vue-devtools@7.3.1(rollup@4.22.0)(vite@5.4.6(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1))(vue@3.5.8(typescript@5.5.3)): dependencies: - '@vue/devtools-core': 7.3.7(vite@5.4.6(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1))(vue@3.5.5(typescript@5.5.3)) + '@vue/devtools-core': 7.3.7(vite@5.4.6(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1))(vue@3.5.8(typescript@5.5.3)) '@vue/devtools-kit': 7.3.7 '@vue/devtools-shared': 7.3.7 execa: 8.0.1 @@ -16785,7 +16814,7 @@ snapshots: '@babel/plugin-syntax-import-meta': 7.10.4(@babel/core@7.24.7) '@babel/plugin-transform-typescript': 7.25.2(@babel/core@7.24.7) '@vue/babel-plugin-jsx': 1.2.2(@babel/core@7.24.7) - '@vue/compiler-dom': 3.5.3 + '@vue/compiler-dom': 3.5.5 kolorist: 1.8.0 magic-string: 0.30.11 vite: 5.4.6(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1) @@ -16832,26 +16861,26 @@ snapshots: optionalDependencies: vite: 5.4.6(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1) - vitepress@1.3.0(@algolia/client-search@4.23.3)(@types/node@20.14.10)(@types/react@18.3.3)(axios@1.7.7)(less@4.2.0)(postcss@8.4.45)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.71.1)(search-insights@2.14.0)(terser@5.31.1)(typescript@5.5.3): + vitepress@1.3.0(@algolia/client-search@4.23.3)(@types/node@20.14.10)(@types/react@18.3.3)(axios@1.7.7)(less@4.2.0)(postcss@8.4.47)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.71.1)(search-insights@2.14.0)(terser@5.31.1)(typescript@5.5.3): dependencies: '@docsearch/css': 3.6.0 '@docsearch/js': 3.6.0(@algolia/client-search@4.23.3)(@types/react@18.3.3)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(search-insights@2.14.0) '@shikijs/core': 1.10.3 '@shikijs/transformers': 1.10.3 '@types/markdown-it': 14.1.1 - '@vitejs/plugin-vue': 5.0.5(vite@5.4.6(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1))(vue@3.5.3(typescript@5.5.3)) + '@vitejs/plugin-vue': 5.0.5(vite@5.4.6(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1))(vue@3.5.5(typescript@5.5.3)) '@vue/devtools-api': 7.3.5 '@vue/shared': 3.4.31 - '@vueuse/core': 10.11.0(vue@3.5.3(typescript@5.5.3)) - '@vueuse/integrations': 10.11.0(axios@1.7.7)(focus-trap@7.5.4)(vue@3.5.3(typescript@5.5.3)) + '@vueuse/core': 10.11.0(vue@3.5.5(typescript@5.5.3)) + '@vueuse/integrations': 10.11.0(axios@1.7.7)(focus-trap@7.5.4)(vue@3.5.5(typescript@5.5.3)) focus-trap: 7.5.4 mark.js: 8.11.1 minisearch: 6.3.0 shiki: 1.10.3 vite: 5.4.6(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.31.1) - vue: 3.5.3(typescript@5.5.3) + vue: 3.5.5(typescript@5.5.3) optionalDependencies: - postcss: 8.4.45 + postcss: 8.4.47 transitivePeerDependencies: - '@algolia/client-search' - '@types/node' @@ -16987,14 +17016,14 @@ snapshots: vue-component-type-helpers@2.0.29: {} - vue-demi@0.14.10(vue@3.5.3(typescript@5.5.3)): - dependencies: - vue: 3.5.3(typescript@5.5.3) - vue-demi@0.14.10(vue@3.5.5(typescript@5.5.3)): dependencies: vue: 3.5.5(typescript@5.5.3) + vue-demi@0.14.10(vue@3.5.8(typescript@5.5.3)): + dependencies: + vue: 3.5.8(typescript@5.5.3) + vue-eslint-parser@9.4.3(eslint@9.6.0): dependencies: debug: 4.3.5 @@ -17008,10 +17037,10 @@ snapshots: transitivePeerDependencies: - supports-color - vue-router@4.4.5(vue@3.5.5(typescript@5.5.3)): + vue-router@4.4.5(vue@3.5.8(typescript@5.5.3)): dependencies: '@vue/devtools-api': 6.6.4 - vue: 3.5.5(typescript@5.5.3) + vue: 3.5.8(typescript@5.5.3) vue-tsc@2.0.29(typescript@5.5.3): dependencies: @@ -17020,16 +17049,6 @@ snapshots: semver: 7.6.2 typescript: 5.5.3 - vue@3.5.3(typescript@5.5.3): - dependencies: - '@vue/compiler-dom': 3.5.3 - '@vue/compiler-sfc': 3.5.3 - '@vue/runtime-dom': 3.5.3 - '@vue/server-renderer': 3.5.3(vue@3.5.3(typescript@5.5.3)) - '@vue/shared': 3.5.3 - optionalDependencies: - typescript: 5.5.3 - vue@3.5.5(typescript@5.5.3): dependencies: '@vue/compiler-dom': 3.5.5 @@ -17040,6 +17059,16 @@ snapshots: optionalDependencies: typescript: 5.5.3 + vue@3.5.8(typescript@5.5.3): + dependencies: + '@vue/compiler-dom': 3.5.8 + '@vue/compiler-sfc': 3.5.8 + '@vue/runtime-dom': 3.5.8 + '@vue/server-renderer': 3.5.8(vue@3.5.8(typescript@5.5.3)) + '@vue/shared': 3.5.8 + optionalDependencies: + typescript: 5.5.3 + w3c-xmlserializer@5.0.0: dependencies: xml-name-validator: 5.0.0 @@ -17065,14 +17094,14 @@ snapshots: webidl-conversions@7.0.0: {} - webpack-dev-middleware@5.3.4(webpack@5.90.3(esbuild@0.23.1)): + webpack-dev-middleware@5.3.4(webpack@5.90.3(esbuild@0.20.1)): dependencies: colorette: 2.0.20 memfs: 3.5.3 mime-types: 2.1.35 range-parser: 1.2.1 schema-utils: 4.2.0 - webpack: 5.90.3(esbuild@0.20.1) + webpack: 5.90.3(esbuild@0.23.1) webpack-dev-middleware@6.1.2(webpack@5.90.3(esbuild@0.20.1)): dependencies: @@ -17082,9 +17111,9 @@ snapshots: range-parser: 1.2.1 schema-utils: 4.2.0 optionalDependencies: - webpack: 5.90.3(esbuild@0.20.1) + webpack: 5.90.3(esbuild@0.23.1) - webpack-dev-server@4.15.1(webpack@5.90.3(esbuild@0.23.1)): + webpack-dev-server@4.15.1(webpack@5.90.3(esbuild@0.20.1)): dependencies: '@types/bonjour': 3.5.13 '@types/connect-history-api-fallback': 1.5.4 @@ -17114,10 +17143,10 @@ snapshots: serve-index: 1.9.1 sockjs: 0.3.24 spdy: 4.0.2 - webpack-dev-middleware: 5.3.4(webpack@5.90.3(esbuild@0.23.1)) + webpack-dev-middleware: 5.3.4(webpack@5.90.3(esbuild@0.20.1)) ws: 8.17.1 optionalDependencies: - webpack: 5.90.3(esbuild@0.20.1) + webpack: 5.90.3(esbuild@0.23.1) transitivePeerDependencies: - bufferutil - debug @@ -17135,9 +17164,9 @@ snapshots: webpack-subresource-integrity@5.1.0(webpack@5.90.3(esbuild@0.20.1)): dependencies: typed-assert: 1.0.9 - webpack: 5.90.3(esbuild@0.20.1) + webpack: 5.90.3(esbuild@0.23.1) - webpack@5.90.3(esbuild@0.20.1): + webpack@5.90.3(esbuild@0.23.1): dependencies: '@types/eslint-scope': 3.7.7 '@types/estree': 1.0.5 @@ -17160,7 +17189,7 @@ snapshots: neo-async: 2.6.2 schema-utils: 3.3.0 tapable: 2.2.1 - terser-webpack-plugin: 5.3.10(esbuild@0.20.1)(webpack@5.90.3(esbuild@0.23.1)) + terser-webpack-plugin: 5.3.10(esbuild@0.23.1)(webpack@5.90.3(esbuild@0.20.1)) watchpack: 2.4.0 webpack-sources: 3.2.3 transitivePeerDependencies: -- 2.51.2 From fe743c2d41c23bf7e1706bceedd6319299131197 Mon Sep 17 00:00:00 2001 From: Lubos Date: Wed, 25 Sep 2024 16:55:49 +0800 Subject: [PATCH 27/49] fix: export client-facing types again --- .changeset/giant-deers-bathe.md | 5 +++++ .changeset/silver-frogs-shake.md | 5 +++++ packages/client-axios/package.json | 2 +- packages/client-axios/src/index.ts | 2 +- packages/client-axios/{src/__tests__ => test}/index.test.ts | 0 packages/client-fetch/package.json | 2 +- packages/client-fetch/src/index.ts | 3 ++- packages/client-fetch/{src/__tests__ => test}/index.test.ts | 0 .../v3-hey-api-client-axios-bundle/client/index.ts.snap | 2 +- .../client/index.ts.snap | 2 +- .../v3-hey-api-client-fetch-bundle/client/index.ts.snap | 3 ++- .../client/index.ts.snap | 3 ++- 12 files changed, 21 insertions(+), 8 deletions(-) create mode 100644 .changeset/giant-deers-bathe.md create mode 100644 .changeset/silver-frogs-shake.md rename packages/client-axios/{src/__tests__ => test}/index.test.ts (100%) rename packages/client-fetch/{src/__tests__ => test}/index.test.ts (100%) diff --git a/.changeset/giant-deers-bathe.md b/.changeset/giant-deers-bathe.md new file mode 100644 index 000000000..bb0d7a281 --- /dev/null +++ b/.changeset/giant-deers-bathe.md @@ -0,0 +1,5 @@ +--- +'@hey-api/client-fetch': patch +--- + +fix: export client-facing types again diff --git a/.changeset/silver-frogs-shake.md b/.changeset/silver-frogs-shake.md new file mode 100644 index 000000000..f8a1c729f --- /dev/null +++ b/.changeset/silver-frogs-shake.md @@ -0,0 +1,5 @@ +--- +'@hey-api/client-axios': patch +--- + +fix: export client-facing types again diff --git a/packages/client-axios/package.json b/packages/client-axios/package.json index 1d4495dfb..0f35c4304 100644 --- a/packages/client-axios/package.json +++ b/packages/client-axios/package.json @@ -56,7 +56,7 @@ "test:update": "vitest watch --update", "test:watch": "vitest watch", "test": "vitest run", - "typecheck": "tsc --noEmit" + "typecheck": "vitest --typecheck" }, "peerDependencies": { "axios": ">= 1.0.0 < 2" diff --git a/packages/client-axios/src/index.ts b/packages/client-axios/src/index.ts index d0890ea39..822dde564 100644 --- a/packages/client-axios/src/index.ts +++ b/packages/client-axios/src/index.ts @@ -85,7 +85,7 @@ export const createClient = (config: Config): Client => { } as Client; }; -export type { Config, Options } from './types'; +export type { Client, Config, Options, RequestOptionsBase } from './types'; export { createConfig, formDataBodySerializer, diff --git a/packages/client-axios/src/__tests__/index.test.ts b/packages/client-axios/test/index.test.ts similarity index 100% rename from packages/client-axios/src/__tests__/index.test.ts rename to packages/client-axios/test/index.test.ts diff --git a/packages/client-fetch/package.json b/packages/client-fetch/package.json index 603e90a98..c4c632724 100644 --- a/packages/client-fetch/package.json +++ b/packages/client-fetch/package.json @@ -56,6 +56,6 @@ "test:update": "vitest watch --update", "test:watch": "vitest watch", "test": "vitest run", - "typecheck": "tsc --noEmit" + "typecheck": "vitest --typecheck" } } diff --git a/packages/client-fetch/src/index.ts b/packages/client-fetch/src/index.ts index 46a8d73ad..6e249fd33 100644 --- a/packages/client-fetch/src/index.ts +++ b/packages/client-fetch/src/index.ts @@ -145,10 +145,11 @@ export const createClient = (config: Config = {}): Client => { }; }; -export type { Config, Options } from './types'; +export type { Client, Config, Options, RequestOptionsBase } from './types'; export { createConfig, formDataBodySerializer, jsonBodySerializer, + type QuerySerializerOptions, urlSearchParamsBodySerializer, } from './utils'; diff --git a/packages/client-fetch/src/__tests__/index.test.ts b/packages/client-fetch/test/index.test.ts similarity index 100% rename from packages/client-fetch/src/__tests__/index.test.ts rename to packages/client-fetch/test/index.test.ts diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle/client/index.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle/client/index.ts.snap index d0890ea39..822dde564 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle/client/index.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle/client/index.ts.snap @@ -85,7 +85,7 @@ export const createClient = (config: Config): Client => { } as Client; }; -export type { Config, Options } from './types'; +export type { Client, Config, Options, RequestOptionsBase } from './types'; export { createConfig, formDataBodySerializer, diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle_transform/client/index.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle_transform/client/index.ts.snap index d0890ea39..822dde564 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle_transform/client/index.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle_transform/client/index.ts.snap @@ -85,7 +85,7 @@ export const createClient = (config: Config): Client => { } as Client; }; -export type { Config, Options } from './types'; +export type { Client, Config, Options, RequestOptionsBase } from './types'; export { createConfig, formDataBodySerializer, diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle/client/index.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle/client/index.ts.snap index 46a8d73ad..6e249fd33 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle/client/index.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle/client/index.ts.snap @@ -145,10 +145,11 @@ export const createClient = (config: Config = {}): Client => { }; }; -export type { Config, Options } from './types'; +export type { Client, Config, Options, RequestOptionsBase } from './types'; export { createConfig, formDataBodySerializer, jsonBodySerializer, + type QuerySerializerOptions, urlSearchParamsBodySerializer, } from './utils'; diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle_transform/client/index.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle_transform/client/index.ts.snap index 46a8d73ad..6e249fd33 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle_transform/client/index.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle_transform/client/index.ts.snap @@ -145,10 +145,11 @@ export const createClient = (config: Config = {}): Client => { }; }; -export type { Config, Options } from './types'; +export type { Client, Config, Options, RequestOptionsBase } from './types'; export { createConfig, formDataBodySerializer, jsonBodySerializer, + type QuerySerializerOptions, urlSearchParamsBodySerializer, } from './utils'; -- 2.51.2 From 0bc1ebe318399d01296777746ce0bccc83c0e83d Mon Sep 17 00:00:00 2001 From: Lubos Date: Wed, 25 Sep 2024 17:58:01 +0800 Subject: [PATCH 28/49] fix: support dynamic require in child_process --- .changeset/moody-ears-talk.md | 5 + packages/openapi-ts/src/generate/client.ts | 24 ----- packages/openapi-ts/tsup.config.ts | 11 +++ pnpm-lock.yaml | 101 +++++++++++++-------- 4 files changed, 80 insertions(+), 61 deletions(-) create mode 100644 .changeset/moody-ears-talk.md diff --git a/.changeset/moody-ears-talk.md b/.changeset/moody-ears-talk.md new file mode 100644 index 000000000..eec1d6821 --- /dev/null +++ b/.changeset/moody-ears-talk.md @@ -0,0 +1,5 @@ +--- +'@hey-api/openapi-ts': patch +--- + +fix: support dynamic require in child_process diff --git a/packages/openapi-ts/src/generate/client.ts b/packages/openapi-ts/src/generate/client.ts index a818ad7f7..1a99b5086 100644 --- a/packages/openapi-ts/src/generate/client.ts +++ b/packages/openapi-ts/src/generate/client.ts @@ -4,29 +4,6 @@ import path from 'node:path'; import { getConfig, isStandaloneClient } from '../utils/config'; import { ensureDirSync } from './utils'; -const isESM = () => { - try { - return typeof import.meta.url === 'string'; - } catch (error) { - return false; - } -}; - -const getRequire = async (): Promise => { - try { - if (isESM()) { - const module: any = await import('node:module'); - const createRequire: (path: string | URL) => NodeRequire = - module.createRequire; - return createRequire(import.meta.url); - } - - return module.require; - } catch (error) { - return module.require; - } -}; - export const clientModulePath = () => { const config = getConfig(); return config.client.bundle ? './client' : config.client.name; @@ -54,7 +31,6 @@ export const generateClient = async ( const dirPath = path.resolve(outputPath, 'client'); ensureDirSync(dirPath); - const require = await getRequire(); const clientModulePath = path.normalize(require.resolve(moduleName)); const clientModulePathComponents = clientModulePath.split(path.sep); const clientSrcPath = [ diff --git a/packages/openapi-ts/tsup.config.ts b/packages/openapi-ts/tsup.config.ts index 77dfaf864..c101964ef 100644 --- a/packages/openapi-ts/tsup.config.ts +++ b/packages/openapi-ts/tsup.config.ts @@ -1,6 +1,17 @@ import { defineConfig } from 'tsup'; export default defineConfig((options) => ({ + banner(ctx) { + /** + * fix dynamic require in ESM + * @link https://github.com/hey-api/openapi-ts/issues/1079 + */ + if (ctx.format === 'esm') { + return { + js: "import { createRequire } from 'module'; const require = createRequire(import.meta.url);", + }; + } + }, clean: true, dts: true, entry: ['src/index.ts'], diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index a4a106686..7ea945702 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -58,7 +58,7 @@ importers: version: 3.3.2 tsup: specifier: 8.3.0 - version: 8.3.0(@microsoft/api-extractor@7.47.9(@types/node@20.14.10))(jiti@1.21.6)(postcss@8.4.47)(typescript@5.5.3)(yaml@2.4.5) + version: 8.3.0(@microsoft/api-extractor@7.47.9(@types/node@20.14.10))(jiti@1.21.6)(postcss@8.4.47)(tsx@4.19.1)(typescript@5.5.3)(yaml@2.4.5) typescript: specifier: 5.5.3 version: 5.5.3 @@ -5277,6 +5277,9 @@ packages: resolution: {integrity: sha512-VaUJspBffn/LMCJVoMvSAdmscJyS1auj5Zulnn5UoYcY531UWmdwhRWkcGKnGU93m5HSXP9LP2usOryrBtQowA==} engines: {node: '>=16'} + get-tsconfig@4.8.1: + resolution: {integrity: sha512-k9PN+cFBmaLWtVz29SkUoqU5O0slLuHJXt/2P+tMVFT+phsSGXGkp9t3rQIqdz0e+06EHNGs3oM6ZX1s2zHxRg==} + get-uri@6.0.3: resolution: {integrity: sha512-BzUrJBS9EcUb4cFol8r4W3v1cPsSyajLSthNkz5BxbpDcHN5tIrM10E2eNvfnvBn3DaT3DUgx0OpsBKkaOpanw==} engines: {node: '>= 14'} @@ -7002,6 +7005,9 @@ packages: resolution: {integrity: sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==} engines: {node: '>=8'} + resolve-pkg-maps@1.0.0: + resolution: {integrity: sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==} + resolve-url-loader@5.0.0: resolution: {integrity: sha512-uZtduh8/8srhBoMx//5bwqjQ+rfYOUq8zC9NrMUGtjBiGTtFJM42s58/36+hTqeqINcnYe08Nj3LkK9lW4N8Xg==} engines: {node: '>=12'} @@ -7735,6 +7741,11 @@ packages: 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' + tsx@4.19.1: + resolution: {integrity: sha512-0flMz1lh74BR4wOvBjuh9olbnwqCPc35OOlfyzHba0Dc+QNUeWX/Gq2YTbnwcWPO3BMd8fkzRVrHcsR+a7z7rA==} + engines: {node: '>=18.0.0'} + hasBin: true + tuf-js@2.2.1: resolution: {integrity: sha512-GwIJau9XaA8nLVbUXsN3IlFi7WmQ48gBUrl3FTkkL/XLu/POhBzfmX9hd33FNMX1qAsfl6ozO1iMmW9NC8YniA==} engines: {node: ^16.14.0 || >=18.0.0} @@ -8514,7 +8525,7 @@ snapshots: dependencies: '@ampproject/remapping': 2.3.0 '@angular-devkit/architect': 0.1703.7(chokidar@3.6.0) - '@angular-devkit/build-webpack': 0.1703.7(chokidar@3.6.0)(webpack-dev-server@4.15.1(webpack@5.90.3(esbuild@0.20.1)))(webpack@5.90.3(esbuild@0.20.1)) + '@angular-devkit/build-webpack': 0.1703.7(chokidar@3.6.0)(webpack-dev-server@4.15.1(webpack@5.90.3(esbuild@0.23.1)))(webpack@5.90.3(esbuild@0.20.1)) '@angular-devkit/core': 17.3.7(chokidar@3.6.0) '@angular/compiler-cli': 17.3.9(@angular/compiler@17.3.9(@angular/core@17.3.9(rxjs@7.8.1)(zone.js@0.14.7)))(typescript@5.5.3) '@babel/core': 7.24.0 @@ -8572,9 +8583,9 @@ snapshots: undici: 6.11.1 vite: 5.1.7(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.29.1) watchpack: 2.4.0 - webpack: 5.90.3(esbuild@0.23.1) + webpack: 5.90.3(esbuild@0.20.1) webpack-dev-middleware: 6.1.2(webpack@5.90.3(esbuild@0.20.1)) - webpack-dev-server: 4.15.1(webpack@5.90.3(esbuild@0.20.1)) + webpack-dev-server: 4.15.1(webpack@5.90.3(esbuild@0.23.1)) webpack-merge: 5.10.0 webpack-subresource-integrity: 5.1.0(webpack@5.90.3(esbuild@0.20.1)) optionalDependencies: @@ -8599,12 +8610,12 @@ snapshots: - utf-8-validate - webpack-cli - '@angular-devkit/build-webpack@0.1703.7(chokidar@3.6.0)(webpack-dev-server@4.15.1(webpack@5.90.3(esbuild@0.20.1)))(webpack@5.90.3(esbuild@0.20.1))': + '@angular-devkit/build-webpack@0.1703.7(chokidar@3.6.0)(webpack-dev-server@4.15.1(webpack@5.90.3(esbuild@0.23.1)))(webpack@5.90.3(esbuild@0.20.1))': dependencies: '@angular-devkit/architect': 0.1703.7(chokidar@3.6.0) rxjs: 7.8.1 - webpack: 5.90.3(esbuild@0.23.1) - webpack-dev-server: 4.15.1(webpack@5.90.3(esbuild@0.20.1)) + webpack: 5.90.3(esbuild@0.20.1) + webpack-dev-server: 4.15.1(webpack@5.90.3(esbuild@0.23.1)) transitivePeerDependencies: - chokidar @@ -10426,7 +10437,7 @@ snapshots: dependencies: '@angular/compiler-cli': 17.3.9(@angular/compiler@17.3.9(@angular/core@17.3.9(rxjs@7.8.1)(zone.js@0.14.7)))(typescript@5.5.3) typescript: 5.5.3 - webpack: 5.90.3(esbuild@0.23.1) + webpack: 5.90.3(esbuild@0.20.1) '@nodelib/fs.scandir@2.1.5': dependencies: @@ -12351,14 +12362,13 @@ snapshots: acorn-walk@8.3.3: dependencies: - acorn: 8.12.0 + acorn: 8.12.1 acorn@7.4.1: {} acorn@8.12.0: {} - acorn@8.12.1: - optional: true + acorn@8.12.1: {} adjust-sourcemap-loader@4.0.0: dependencies: @@ -12566,7 +12576,7 @@ snapshots: '@babel/core': 7.24.0 find-cache-dir: 4.0.0 schema-utils: 4.2.0 - webpack: 5.90.3(esbuild@0.23.1) + webpack: 5.90.3(esbuild@0.20.1) babel-plugin-istanbul@6.1.1: dependencies: @@ -13003,7 +13013,7 @@ snapshots: normalize-path: 3.0.0 schema-utils: 4.2.0 serialize-javascript: 6.0.2 - webpack: 5.90.3(esbuild@0.23.1) + webpack: 5.90.3(esbuild@0.20.1) core-js-compat@3.37.1: dependencies: @@ -13055,7 +13065,7 @@ snapshots: postcss-value-parser: 4.2.0 semver: 7.6.2 optionalDependencies: - webpack: 5.90.3(esbuild@0.23.1) + webpack: 5.90.3(esbuild@0.20.1) css-select@5.1.0: dependencies: @@ -13930,6 +13940,11 @@ snapshots: get-stream@8.0.1: {} + get-tsconfig@4.8.1: + dependencies: + resolve-pkg-maps: 1.0.0 + optional: true + get-uri@6.0.3: dependencies: basic-ftp: 5.0.5 @@ -14474,7 +14489,7 @@ snapshots: dependencies: klona: 2.0.6 less: 4.2.0 - webpack: 5.90.3(esbuild@0.23.1) + webpack: 5.90.3(esbuild@0.20.1) less@4.2.0: dependencies: @@ -14499,7 +14514,7 @@ snapshots: dependencies: webpack-sources: 3.2.3 optionalDependencies: - webpack: 5.90.3(esbuild@0.23.1) + webpack: 5.90.3(esbuild@0.20.1) lilconfig@2.1.0: {} @@ -14725,7 +14740,7 @@ snapshots: dependencies: schema-utils: 4.2.0 tapable: 2.2.1 - webpack: 5.90.3(esbuild@0.23.1) + webpack: 5.90.3(esbuild@0.20.1) minimalistic-assert@1.0.1: {} @@ -15311,12 +15326,13 @@ snapshots: postcss: 8.4.39 ts-node: 10.9.2(@types/node@20.14.5)(typescript@5.5.3) - postcss-load-config@6.0.1(jiti@1.21.6)(postcss@8.4.47)(yaml@2.4.5): + postcss-load-config@6.0.1(jiti@1.21.6)(postcss@8.4.47)(tsx@4.19.1)(yaml@2.4.5): dependencies: lilconfig: 3.1.2 optionalDependencies: jiti: 1.21.6 postcss: 8.4.47 + tsx: 4.19.1 yaml: 2.4.5 postcss-loader@8.1.1(postcss@8.4.35)(typescript@5.5.3)(webpack@5.90.3(esbuild@0.20.1)): @@ -15326,7 +15342,7 @@ snapshots: postcss: 8.4.35 semver: 7.6.2 optionalDependencies: - webpack: 5.90.3(esbuild@0.23.1) + webpack: 5.90.3(esbuild@0.20.1) transitivePeerDependencies: - typescript @@ -15666,6 +15682,9 @@ snapshots: resolve-from@5.0.0: {} + resolve-pkg-maps@1.0.0: + optional: true + resolve-url-loader@5.0.0: dependencies: adjust-sourcemap-loader: 4.0.0 @@ -15788,13 +15807,13 @@ snapshots: neo-async: 2.6.2 optionalDependencies: sass: 1.71.1 - webpack: 5.90.3(esbuild@0.23.1) + webpack: 5.90.3(esbuild@0.20.1) sass@1.71.1: dependencies: chokidar: 3.6.0 immutable: 4.3.6 - source-map-js: 1.2.0 + source-map-js: 1.2.1 sax@1.4.1: optional: true @@ -16022,7 +16041,7 @@ snapshots: dependencies: iconv-lite: 0.6.3 source-map-js: 1.2.0 - webpack: 5.90.3(esbuild@0.23.1) + webpack: 5.90.3(esbuild@0.20.1) source-map-support@0.5.21: dependencies: @@ -16379,16 +16398,16 @@ snapshots: term-size@2.2.1: {} - terser-webpack-plugin@5.3.10(esbuild@0.23.1)(webpack@5.90.3(esbuild@0.20.1)): + terser-webpack-plugin@5.3.10(esbuild@0.20.1)(webpack@5.90.3(esbuild@0.23.1)): dependencies: '@jridgewell/trace-mapping': 0.3.25 jest-worker: 27.5.1 schema-utils: 3.3.0 serialize-javascript: 6.0.2 terser: 5.29.1 - webpack: 5.90.3(esbuild@0.23.1) + webpack: 5.90.3(esbuild@0.20.1) optionalDependencies: - esbuild: 0.23.1 + esbuild: 0.20.1 terser@5.29.1: dependencies: @@ -16496,7 +16515,7 @@ snapshots: '@tsconfig/node14': 1.0.3 '@tsconfig/node16': 1.0.4 '@types/node': 20.14.10 - acorn: 8.12.0 + acorn: 8.12.1 acorn-walk: 8.3.3 arg: 4.1.3 create-require: 1.1.1 @@ -16531,7 +16550,7 @@ snapshots: tslib@2.6.3: {} - tsup@8.3.0(@microsoft/api-extractor@7.47.9(@types/node@20.14.10))(jiti@1.21.6)(postcss@8.4.47)(typescript@5.5.3)(yaml@2.4.5): + tsup@8.3.0(@microsoft/api-extractor@7.47.9(@types/node@20.14.10))(jiti@1.21.6)(postcss@8.4.47)(tsx@4.19.1)(typescript@5.5.3)(yaml@2.4.5): dependencies: bundle-require: 5.0.0(esbuild@0.23.1) cac: 6.7.14 @@ -16542,7 +16561,7 @@ snapshots: execa: 5.1.1 joycon: 3.1.1 picocolors: 1.0.1 - postcss-load-config: 6.0.1(jiti@1.21.6)(postcss@8.4.47)(yaml@2.4.5) + postcss-load-config: 6.0.1(jiti@1.21.6)(postcss@8.4.47)(tsx@4.19.1)(yaml@2.4.5) resolve-from: 5.0.0 rollup: 4.22.0 source-map: 0.8.0-beta.0 @@ -16564,6 +16583,14 @@ snapshots: tslib: 1.14.1 typescript: 5.5.3 + tsx@4.19.1: + dependencies: + esbuild: 0.23.1 + get-tsconfig: 4.8.1 + optionalDependencies: + fsevents: 2.3.3 + optional: true + tuf-js@2.2.1: dependencies: '@tufjs/models': 2.0.1 @@ -17094,14 +17121,14 @@ snapshots: webidl-conversions@7.0.0: {} - webpack-dev-middleware@5.3.4(webpack@5.90.3(esbuild@0.20.1)): + webpack-dev-middleware@5.3.4(webpack@5.90.3(esbuild@0.23.1)): dependencies: colorette: 2.0.20 memfs: 3.5.3 mime-types: 2.1.35 range-parser: 1.2.1 schema-utils: 4.2.0 - webpack: 5.90.3(esbuild@0.23.1) + webpack: 5.90.3(esbuild@0.20.1) webpack-dev-middleware@6.1.2(webpack@5.90.3(esbuild@0.20.1)): dependencies: @@ -17111,9 +17138,9 @@ snapshots: range-parser: 1.2.1 schema-utils: 4.2.0 optionalDependencies: - webpack: 5.90.3(esbuild@0.23.1) + webpack: 5.90.3(esbuild@0.20.1) - webpack-dev-server@4.15.1(webpack@5.90.3(esbuild@0.20.1)): + webpack-dev-server@4.15.1(webpack@5.90.3(esbuild@0.23.1)): dependencies: '@types/bonjour': 3.5.13 '@types/connect-history-api-fallback': 1.5.4 @@ -17143,10 +17170,10 @@ snapshots: serve-index: 1.9.1 sockjs: 0.3.24 spdy: 4.0.2 - webpack-dev-middleware: 5.3.4(webpack@5.90.3(esbuild@0.20.1)) + webpack-dev-middleware: 5.3.4(webpack@5.90.3(esbuild@0.23.1)) ws: 8.17.1 optionalDependencies: - webpack: 5.90.3(esbuild@0.23.1) + webpack: 5.90.3(esbuild@0.20.1) transitivePeerDependencies: - bufferutil - debug @@ -17164,9 +17191,9 @@ snapshots: webpack-subresource-integrity@5.1.0(webpack@5.90.3(esbuild@0.20.1)): dependencies: typed-assert: 1.0.9 - webpack: 5.90.3(esbuild@0.23.1) + webpack: 5.90.3(esbuild@0.20.1) - webpack@5.90.3(esbuild@0.23.1): + webpack@5.90.3(esbuild@0.20.1): dependencies: '@types/eslint-scope': 3.7.7 '@types/estree': 1.0.5 @@ -17189,7 +17216,7 @@ snapshots: neo-async: 2.6.2 schema-utils: 3.3.0 tapable: 2.2.1 - terser-webpack-plugin: 5.3.10(esbuild@0.23.1)(webpack@5.90.3(esbuild@0.20.1)) + terser-webpack-plugin: 5.3.10(esbuild@0.20.1)(webpack@5.90.3(esbuild@0.23.1)) watchpack: 2.4.0 webpack-sources: 3.2.3 transitivePeerDependencies: -- 2.51.2 From b528236b626d12d4ac03b98b8abecc425291c5e5 Mon Sep 17 00:00:00 2001 From: Lubos Date: Wed, 25 Sep 2024 18:11:33 +0800 Subject: [PATCH 29/49] fix: import handlebars instead of runtime --- .changeset/big-seals-count.md | 5 +++++ packages/openapi-ts/src/utils/__tests__/handlebars.spec.ts | 2 +- packages/openapi-ts/src/utils/handlebars.ts | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 .changeset/big-seals-count.md diff --git a/.changeset/big-seals-count.md b/.changeset/big-seals-count.md new file mode 100644 index 000000000..b73941d97 --- /dev/null +++ b/.changeset/big-seals-count.md @@ -0,0 +1,5 @@ +--- +'@hey-api/openapi-ts': patch +--- + +fix: import handlebars instead of runtime diff --git a/packages/openapi-ts/src/utils/__tests__/handlebars.spec.ts b/packages/openapi-ts/src/utils/__tests__/handlebars.spec.ts index 1af0f7e5d..7a0d60925 100644 --- a/packages/openapi-ts/src/utils/__tests__/handlebars.spec.ts +++ b/packages/openapi-ts/src/utils/__tests__/handlebars.spec.ts @@ -1,4 +1,4 @@ -import Handlebars from 'handlebars/runtime'; +import Handlebars from 'handlebars'; import { describe, expect, it } from 'vitest'; import { setConfig } from '../config'; diff --git a/packages/openapi-ts/src/utils/handlebars.ts b/packages/openapi-ts/src/utils/handlebars.ts index 1c435e46a..d1b92b72b 100644 --- a/packages/openapi-ts/src/utils/handlebars.ts +++ b/packages/openapi-ts/src/utils/handlebars.ts @@ -1,4 +1,4 @@ -import Handlebars from 'handlebars/runtime'; +import Handlebars from 'handlebars'; // @ts-ignore import templateClient from '../legacy/handlebars/compiled/client.js'; -- 2.51.2 From d33791c63ddb94effe0f90de732091ddb6eb87ff Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 25 Sep 2024 10:20:48 +0000 Subject: [PATCH 30/49] Version Packages --- .changeset/big-seals-count.md | 5 ----- .changeset/giant-deers-bathe.md | 5 ----- .changeset/moody-ears-talk.md | 5 ----- .changeset/silver-frogs-shake.md | 5 ----- examples/openapi-ts-axios/CHANGELOG.md | 7 +++++++ examples/openapi-ts-axios/package.json | 2 +- examples/openapi-ts-fetch/CHANGELOG.md | 7 +++++++ examples/openapi-ts-fetch/package.json | 2 +- examples/openapi-ts-tanstack-react-query/CHANGELOG.md | 7 +++++++ examples/openapi-ts-tanstack-react-query/package.json | 2 +- examples/openapi-ts-tanstack-svelte-query/CHANGELOG.md | 7 +++++++ examples/openapi-ts-tanstack-svelte-query/package.json | 2 +- examples/openapi-ts-tanstack-vue-query/CHANGELOG.md | 7 +++++++ examples/openapi-ts-tanstack-vue-query/package.json | 2 +- packages/client-axios/CHANGELOG.md | 6 ++++++ packages/client-axios/package.json | 2 +- packages/client-fetch/CHANGELOG.md | 6 ++++++ packages/client-fetch/package.json | 2 +- packages/openapi-ts/CHANGELOG.md | 8 ++++++++ packages/openapi-ts/package.json | 2 +- 20 files changed, 63 insertions(+), 28 deletions(-) delete mode 100644 .changeset/big-seals-count.md delete mode 100644 .changeset/giant-deers-bathe.md delete mode 100644 .changeset/moody-ears-talk.md delete mode 100644 .changeset/silver-frogs-shake.md diff --git a/.changeset/big-seals-count.md b/.changeset/big-seals-count.md deleted file mode 100644 index b73941d97..000000000 --- a/.changeset/big-seals-count.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@hey-api/openapi-ts': patch ---- - -fix: import handlebars instead of runtime diff --git a/.changeset/giant-deers-bathe.md b/.changeset/giant-deers-bathe.md deleted file mode 100644 index bb0d7a281..000000000 --- a/.changeset/giant-deers-bathe.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@hey-api/client-fetch': patch ---- - -fix: export client-facing types again diff --git a/.changeset/moody-ears-talk.md b/.changeset/moody-ears-talk.md deleted file mode 100644 index eec1d6821..000000000 --- a/.changeset/moody-ears-talk.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@hey-api/openapi-ts': patch ---- - -fix: support dynamic require in child_process diff --git a/.changeset/silver-frogs-shake.md b/.changeset/silver-frogs-shake.md deleted file mode 100644 index f8a1c729f..000000000 --- a/.changeset/silver-frogs-shake.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@hey-api/client-axios': patch ---- - -fix: export client-facing types again diff --git a/examples/openapi-ts-axios/CHANGELOG.md b/examples/openapi-ts-axios/CHANGELOG.md index ed1761486..f55df6aae 100644 --- a/examples/openapi-ts-axios/CHANGELOG.md +++ b/examples/openapi-ts-axios/CHANGELOG.md @@ -1,5 +1,12 @@ # @example/openapi-ts-axios +## 0.0.10 + +### Patch Changes + +- Updated dependencies [[`fe743c2`](https://github.com/hey-api/openapi-ts/commit/fe743c2d41c23bf7e1706bceedd6319299131197)]: + - @hey-api/client-axios@0.2.6 + ## 0.0.9 ### Patch Changes diff --git a/examples/openapi-ts-axios/package.json b/examples/openapi-ts-axios/package.json index d92cd416f..681d04fdb 100644 --- a/examples/openapi-ts-axios/package.json +++ b/examples/openapi-ts-axios/package.json @@ -1,7 +1,7 @@ { "name": "@example/openapi-ts-axios", "private": true, - "version": "0.0.9", + "version": "0.0.10", "type": "module", "scripts": { "build": "tsc && vite build", diff --git a/examples/openapi-ts-fetch/CHANGELOG.md b/examples/openapi-ts-fetch/CHANGELOG.md index 3ea88a9a9..b0ab431ed 100644 --- a/examples/openapi-ts-fetch/CHANGELOG.md +++ b/examples/openapi-ts-fetch/CHANGELOG.md @@ -1,5 +1,12 @@ # @example/openapi-ts-fetch +## 0.0.25 + +### Patch Changes + +- Updated dependencies [[`fe743c2`](https://github.com/hey-api/openapi-ts/commit/fe743c2d41c23bf7e1706bceedd6319299131197)]: + - @hey-api/client-fetch@0.3.3 + ## 0.0.24 ### Patch Changes diff --git a/examples/openapi-ts-fetch/package.json b/examples/openapi-ts-fetch/package.json index d34ea6f84..e58e86f1c 100644 --- a/examples/openapi-ts-fetch/package.json +++ b/examples/openapi-ts-fetch/package.json @@ -1,7 +1,7 @@ { "name": "@example/openapi-ts-fetch", "private": true, - "version": "0.0.24", + "version": "0.0.25", "type": "module", "scripts": { "build": "tsc && vite build", diff --git a/examples/openapi-ts-tanstack-react-query/CHANGELOG.md b/examples/openapi-ts-tanstack-react-query/CHANGELOG.md index 82fecb736..2273e32ba 100644 --- a/examples/openapi-ts-tanstack-react-query/CHANGELOG.md +++ b/examples/openapi-ts-tanstack-react-query/CHANGELOG.md @@ -1,5 +1,12 @@ # @example/openapi-ts-tanstack-react-query +## 0.0.7 + +### Patch Changes + +- Updated dependencies [[`fe743c2`](https://github.com/hey-api/openapi-ts/commit/fe743c2d41c23bf7e1706bceedd6319299131197)]: + - @hey-api/client-fetch@0.3.3 + ## 0.0.6 ### Patch Changes diff --git a/examples/openapi-ts-tanstack-react-query/package.json b/examples/openapi-ts-tanstack-react-query/package.json index 800ceaf5d..a99823088 100644 --- a/examples/openapi-ts-tanstack-react-query/package.json +++ b/examples/openapi-ts-tanstack-react-query/package.json @@ -1,7 +1,7 @@ { "name": "@example/openapi-ts-tanstack-react-query", "private": true, - "version": "0.0.6", + "version": "0.0.7", "type": "module", "scripts": { "build": "tsc && vite build", diff --git a/examples/openapi-ts-tanstack-svelte-query/CHANGELOG.md b/examples/openapi-ts-tanstack-svelte-query/CHANGELOG.md index 0083fb31d..b0e93500b 100644 --- a/examples/openapi-ts-tanstack-svelte-query/CHANGELOG.md +++ b/examples/openapi-ts-tanstack-svelte-query/CHANGELOG.md @@ -1,5 +1,12 @@ # @example/openapi-ts-tanstack-svelte-query +## 0.0.7 + +### Patch Changes + +- Updated dependencies [[`fe743c2`](https://github.com/hey-api/openapi-ts/commit/fe743c2d41c23bf7e1706bceedd6319299131197)]: + - @hey-api/client-fetch@0.3.3 + ## 0.0.6 ### Patch Changes diff --git a/examples/openapi-ts-tanstack-svelte-query/package.json b/examples/openapi-ts-tanstack-svelte-query/package.json index 84b807048..0818aeee2 100644 --- a/examples/openapi-ts-tanstack-svelte-query/package.json +++ b/examples/openapi-ts-tanstack-svelte-query/package.json @@ -1,7 +1,7 @@ { "name": "@example/openapi-ts-tanstack-svelte-query", "private": true, - "version": "0.0.6", + "version": "0.0.7", "type": "module", "scripts": { "build": "vite build", diff --git a/examples/openapi-ts-tanstack-vue-query/CHANGELOG.md b/examples/openapi-ts-tanstack-vue-query/CHANGELOG.md index 50d2abadb..f83064f08 100644 --- a/examples/openapi-ts-tanstack-vue-query/CHANGELOG.md +++ b/examples/openapi-ts-tanstack-vue-query/CHANGELOG.md @@ -1,5 +1,12 @@ # @example/openapi-ts-tanstack-vue-query +## 0.0.7 + +### Patch Changes + +- Updated dependencies [[`fe743c2`](https://github.com/hey-api/openapi-ts/commit/fe743c2d41c23bf7e1706bceedd6319299131197)]: + - @hey-api/client-fetch@0.3.3 + ## 0.0.6 ### Patch Changes diff --git a/examples/openapi-ts-tanstack-vue-query/package.json b/examples/openapi-ts-tanstack-vue-query/package.json index 09f28e509..3695df245 100644 --- a/examples/openapi-ts-tanstack-vue-query/package.json +++ b/examples/openapi-ts-tanstack-vue-query/package.json @@ -1,7 +1,7 @@ { "name": "@example/openapi-ts-tanstack-vue-query", "private": true, - "version": "0.0.6", + "version": "0.0.7", "type": "module", "scripts": { "build-only": "vite build", diff --git a/packages/client-axios/CHANGELOG.md b/packages/client-axios/CHANGELOG.md index bc479048b..1a8d6bde3 100644 --- a/packages/client-axios/CHANGELOG.md +++ b/packages/client-axios/CHANGELOG.md @@ -1,5 +1,11 @@ # @hey-api/client-axios +## 0.2.6 + +### Patch Changes + +- [#1083](https://github.com/hey-api/openapi-ts/pull/1083) [`fe743c2`](https://github.com/hey-api/openapi-ts/commit/fe743c2d41c23bf7e1706bceedd6319299131197) Thanks [@mrlubos](https://github.com/mrlubos)! - fix: export client-facing types again + ## 0.2.5 ### Patch Changes diff --git a/packages/client-axios/package.json b/packages/client-axios/package.json index 0f35c4304..b44aa119d 100644 --- a/packages/client-axios/package.json +++ b/packages/client-axios/package.json @@ -1,6 +1,6 @@ { "name": "@hey-api/client-axios", - "version": "0.2.5", + "version": "0.2.6", "description": "Type-safe Axios client for your @hey-api/openapi-ts types", "homepage": "https://heyapi.vercel.app/", "repository": { diff --git a/packages/client-fetch/CHANGELOG.md b/packages/client-fetch/CHANGELOG.md index 578ced6c9..758710c3d 100644 --- a/packages/client-fetch/CHANGELOG.md +++ b/packages/client-fetch/CHANGELOG.md @@ -1,5 +1,11 @@ # @hey-api/client-fetch +## 0.3.3 + +### Patch Changes + +- [#1083](https://github.com/hey-api/openapi-ts/pull/1083) [`fe743c2`](https://github.com/hey-api/openapi-ts/commit/fe743c2d41c23bf7e1706bceedd6319299131197) Thanks [@mrlubos](https://github.com/mrlubos)! - fix: export client-facing types again + ## 0.3.2 ### Patch Changes diff --git a/packages/client-fetch/package.json b/packages/client-fetch/package.json index c4c632724..16fbfc0fe 100644 --- a/packages/client-fetch/package.json +++ b/packages/client-fetch/package.json @@ -1,6 +1,6 @@ { "name": "@hey-api/client-fetch", - "version": "0.3.2", + "version": "0.3.3", "description": "Type-safe Fetch API client for your @hey-api/openapi-ts types", "homepage": "https://heyapi.vercel.app/", "repository": { diff --git a/packages/openapi-ts/CHANGELOG.md b/packages/openapi-ts/CHANGELOG.md index 46947eec5..917c76394 100644 --- a/packages/openapi-ts/CHANGELOG.md +++ b/packages/openapi-ts/CHANGELOG.md @@ -1,5 +1,13 @@ # @hey-api/openapi-ts +## 0.53.4 + +### Patch Changes + +- [#1087](https://github.com/hey-api/openapi-ts/pull/1087) [`b528236`](https://github.com/hey-api/openapi-ts/commit/b528236b626d12d4ac03b98b8abecc425291c5e5) Thanks [@mrlubos](https://github.com/mrlubos)! - fix: import handlebars instead of runtime + +- [#1086](https://github.com/hey-api/openapi-ts/pull/1086) [`0bc1ebe`](https://github.com/hey-api/openapi-ts/commit/0bc1ebe318399d01296777746ce0bccc83c0e83d) Thanks [@mrlubos](https://github.com/mrlubos)! - fix: support dynamic require in child_process + ## 0.53.3 ### Patch Changes diff --git a/packages/openapi-ts/package.json b/packages/openapi-ts/package.json index 92b413309..83a5cd470 100644 --- a/packages/openapi-ts/package.json +++ b/packages/openapi-ts/package.json @@ -1,6 +1,6 @@ { "name": "@hey-api/openapi-ts", - "version": "0.53.3", + "version": "0.53.4", "description": "Turn your OpenAPI specification into a beautiful TypeScript client", "homepage": "https://heyapi.vercel.app/", "repository": { -- 2.51.2 From 7f986c2c7726ed8fbf16f8b235b7769c7d990502 Mon Sep 17 00:00:00 2001 From: Lubos Date: Thu, 26 Sep 2024 20:29:43 +0800 Subject: [PATCH 31/49] fix: export RequestResult type --- .changeset/modern-queens-tan.md | 6 ++++++ packages/client-axios/src/index.ts | 8 +++++++- packages/client-fetch/src/index.ts | 8 +++++++- .../v3-hey-api-client-axios-bundle/client/index.ts.snap | 8 +++++++- .../client/index.ts.snap | 8 +++++++- .../v3-hey-api-client-fetch-bundle/client/index.ts.snap | 8 +++++++- .../client/index.ts.snap | 8 +++++++- 7 files changed, 48 insertions(+), 6 deletions(-) create mode 100644 .changeset/modern-queens-tan.md diff --git a/.changeset/modern-queens-tan.md b/.changeset/modern-queens-tan.md new file mode 100644 index 000000000..bba906df1 --- /dev/null +++ b/.changeset/modern-queens-tan.md @@ -0,0 +1,6 @@ +--- +'@hey-api/client-axios': patch +'@hey-api/client-fetch': patch +--- + +fix: export RequestResult type diff --git a/packages/client-axios/src/index.ts b/packages/client-axios/src/index.ts index 822dde564..e20d99f85 100644 --- a/packages/client-axios/src/index.ts +++ b/packages/client-axios/src/index.ts @@ -85,7 +85,13 @@ export const createClient = (config: Config): Client => { } as Client; }; -export type { Client, Config, Options, RequestOptionsBase } from './types'; +export type { + Client, + Config, + Options, + RequestOptionsBase, + RequestResult, +} from './types'; export { createConfig, formDataBodySerializer, diff --git a/packages/client-fetch/src/index.ts b/packages/client-fetch/src/index.ts index 6e249fd33..29cc066a6 100644 --- a/packages/client-fetch/src/index.ts +++ b/packages/client-fetch/src/index.ts @@ -145,7 +145,13 @@ export const createClient = (config: Config = {}): Client => { }; }; -export type { Client, Config, Options, RequestOptionsBase } from './types'; +export type { + Client, + Config, + Options, + RequestOptionsBase, + RequestResult, +} from './types'; export { createConfig, formDataBodySerializer, diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle/client/index.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle/client/index.ts.snap index 822dde564..e20d99f85 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle/client/index.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle/client/index.ts.snap @@ -85,7 +85,13 @@ export const createClient = (config: Config): Client => { } as Client; }; -export type { Client, Config, Options, RequestOptionsBase } from './types'; +export type { + Client, + Config, + Options, + RequestOptionsBase, + RequestResult, +} from './types'; export { createConfig, formDataBodySerializer, diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle_transform/client/index.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle_transform/client/index.ts.snap index 822dde564..e20d99f85 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle_transform/client/index.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle_transform/client/index.ts.snap @@ -85,7 +85,13 @@ export const createClient = (config: Config): Client => { } as Client; }; -export type { Client, Config, Options, RequestOptionsBase } from './types'; +export type { + Client, + Config, + Options, + RequestOptionsBase, + RequestResult, +} from './types'; export { createConfig, formDataBodySerializer, diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle/client/index.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle/client/index.ts.snap index 6e249fd33..29cc066a6 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle/client/index.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle/client/index.ts.snap @@ -145,7 +145,13 @@ export const createClient = (config: Config = {}): Client => { }; }; -export type { Client, Config, Options, RequestOptionsBase } from './types'; +export type { + Client, + Config, + Options, + RequestOptionsBase, + RequestResult, +} from './types'; export { createConfig, formDataBodySerializer, diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle_transform/client/index.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle_transform/client/index.ts.snap index 6e249fd33..29cc066a6 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle_transform/client/index.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle_transform/client/index.ts.snap @@ -145,7 +145,13 @@ export const createClient = (config: Config = {}): Client => { }; }; -export type { Client, Config, Options, RequestOptionsBase } from './types'; +export type { + Client, + Config, + Options, + RequestOptionsBase, + RequestResult, +} from './types'; export { createConfig, formDataBodySerializer, -- 2.51.2 From 713ccd5e5e250a14cacf96fd1dffad252cc4cc6a Mon Sep 17 00:00:00 2001 From: Lubos Date: Thu, 26 Sep 2024 21:01:43 +0800 Subject: [PATCH 32/49] fix: attach TanStack Query infinite page params only if they exist --- .changeset/tidy-maps-buy.md | 5 + .../plugins/@tanstack/query-core/plugin.ts | 194 +++++++++++++----- .../@tanstack/react-query.gen.ts.snap | 96 ++++++--- .../@tanstack/solid-query.gen.ts.snap | 96 ++++++--- .../@tanstack/svelte-query.gen.ts.snap | 96 ++++++--- .../@tanstack/vue-query.gen.ts.snap | 96 ++++++--- .../@tanstack/react-query.gen.ts.snap | 96 ++++++--- .../@tanstack/solid-query.gen.ts.snap | 96 ++++++--- .../@tanstack/svelte-query.gen.ts.snap | 96 ++++++--- .../@tanstack/vue-query.gen.ts.snap | 96 ++++++--- packages/openapi-ts/test/sample.cjs | 18 +- 11 files changed, 656 insertions(+), 329 deletions(-) create mode 100644 .changeset/tidy-maps-buy.md diff --git a/.changeset/tidy-maps-buy.md b/.changeset/tidy-maps-buy.md new file mode 100644 index 000000000..da555aae4 --- /dev/null +++ b/.changeset/tidy-maps-buy.md @@ -0,0 +1,5 @@ +--- +'@hey-api/openapi-ts': patch +--- + +fix: attach TanStack Query infinite page params only if they exist diff --git a/packages/openapi-ts/src/plugins/@tanstack/query-core/plugin.ts b/packages/openapi-ts/src/plugins/@tanstack/query-core/plugin.ts index 112680f5f..9026ddb67 100644 --- a/packages/openapi-ts/src/plugins/@tanstack/query-core/plugin.ts +++ b/packages/openapi-ts/src/plugins/@tanstack/query-core/plugin.ts @@ -827,6 +827,143 @@ export const handler: PluginDefinition['handler'] = ({ name: 'page', typeName: typePageObjectParam, }), + compiler.constVariable({ + expression: compiler.objectExpression({ + obj: [], + }), + name: 'params', + typeName: `Partial<${typeData}>`, + }), + compiler.ifStatement({ + expression: compiler.propertyAccessExpression({ + expression: compiler.identifier({ + text: 'page', + }), + name: compiler.identifier({ text: 'body' }), + }), + thenStatement: ts.factory.createBlock( + [ + compiler.expressionToStatement({ + expression: compiler.binaryExpression({ + left: compiler.propertyAccessExpression({ + expression: 'params', + name: 'body', + }), + right: compiler.objectExpression({ + multiLine: true, + obj: [ + { + assertion: 'any', + spread: 'queryKey[0].body', + }, + { + assertion: 'any', + spread: 'page.body', + }, + ], + }), + }), + }), + ], + true, + ), + }), + compiler.ifStatement({ + expression: compiler.propertyAccessExpression({ + expression: compiler.identifier({ + text: 'page', + }), + name: compiler.identifier({ text: 'headers' }), + }), + thenStatement: ts.factory.createBlock( + [ + compiler.expressionToStatement({ + expression: compiler.binaryExpression({ + left: compiler.propertyAccessExpression({ + expression: 'params', + name: 'headers', + }), + right: compiler.objectExpression({ + multiLine: true, + obj: [ + { + spread: 'queryKey[0].headers', + }, + { + spread: 'page.headers', + }, + ], + }), + }), + }), + ], + true, + ), + }), + compiler.ifStatement({ + expression: compiler.propertyAccessExpression({ + expression: compiler.identifier({ + text: 'page', + }), + name: compiler.identifier({ text: 'path' }), + }), + thenStatement: ts.factory.createBlock( + [ + compiler.expressionToStatement({ + expression: compiler.binaryExpression({ + left: compiler.propertyAccessExpression({ + expression: 'params', + name: 'path', + }), + right: compiler.objectExpression({ + multiLine: true, + obj: [ + { + spread: 'queryKey[0].path', + }, + { + spread: 'page.path', + }, + ], + }), + }), + }), + ], + true, + ), + }), + compiler.ifStatement({ + expression: compiler.propertyAccessExpression({ + expression: compiler.identifier({ + text: 'page', + }), + name: compiler.identifier({ text: 'query' }), + }), + thenStatement: ts.factory.createBlock( + [ + compiler.expressionToStatement({ + expression: compiler.binaryExpression({ + left: compiler.propertyAccessExpression({ + expression: 'params', + name: 'query', + }), + right: compiler.objectExpression({ + multiLine: true, + obj: [ + { + spread: 'queryKey[0].query', + }, + { + spread: 'page.query', + }, + ], + }), + }), + }), + ], + true, + ), + }), compiler.constVariable({ destructure: true, expression: compiler.awaitExpression({ @@ -843,62 +980,7 @@ export const handler: PluginDefinition['handler'] = ({ spread: 'queryKey[0]', }, { - key: 'body', - value: compiler.objectExpression({ - multiLine: true, - obj: [ - { - assertion: 'any', - spread: 'queryKey[0].body', - }, - { - assertion: 'any', - spread: 'page.body', - }, - ], - }), - }, - { - key: 'headers', - value: compiler.objectExpression({ - multiLine: true, - obj: [ - { - spread: 'queryKey[0].headers', - }, - { - spread: 'page.headers', - }, - ], - }), - }, - { - key: 'path', - value: compiler.objectExpression({ - multiLine: true, - obj: [ - { - spread: 'queryKey[0].path', - }, - { - spread: 'page.path', - }, - ], - }), - }, - { - key: 'query', - value: compiler.objectExpression({ - multiLine: true, - obj: [ - { - spread: 'queryKey[0].query', - }, - { - spread: 'page.query', - }, - ], - }), + spread: 'params', }, { key: 'throwOnError', diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-react-query/@tanstack/react-query.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-react-query/@tanstack/react-query.gen.ts.snap index 4e820baea..e1b7e20e4 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-react-query/@tanstack/react-query.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-react-query/@tanstack/react-query.gen.ts.snap @@ -271,25 +271,35 @@ export const callWithParametersInfiniteOptions = (options: Options> = {}; + if (page.body) { + params.body = { ...queryKey[0].body as any, ...page.body as any - }, - headers: { + }; + } + if (page.headers) { + params.headers = { ...queryKey[0].headers, ...page.headers - }, - path: { + }; + } + if (page.path) { + params.path = { ...queryKey[0].path, ...page.path - }, - query: { + }; + } + if (page.query) { + params.query = { ...queryKey[0].query, ...page.query - }, + }; + } + const { data } = await callWithParameters({ + ...options, + ...queryKey[0], + ...params, throwOnError: true }); return data; @@ -363,25 +373,35 @@ export const getCallWithOptionalParamInfiniteOptions = (options: Options> = {}; + if (page.body) { + params.body = { ...queryKey[0].body as any, ...page.body as any - }, - headers: { + }; + } + if (page.headers) { + params.headers = { ...queryKey[0].headers, ...page.headers - }, - path: { + }; + } + if (page.path) { + params.path = { ...queryKey[0].path, ...page.path - }, - query: { + }; + } + if (page.query) { + params.query = { ...queryKey[0].query, ...page.query - }, + }; + } + const { data } = await getCallWithOptionalParam({ + ...options, + ...queryKey[0], + ...params, throwOnError: true }); return data; @@ -419,25 +439,35 @@ export const postCallWithOptionalParamInfiniteOptions = (options: Options> = {}; + if (page.body) { + params.body = { ...queryKey[0].body as any, ...page.body as any - }, - headers: { + }; + } + if (page.headers) { + params.headers = { ...queryKey[0].headers, ...page.headers - }, - path: { + }; + } + if (page.path) { + params.path = { ...queryKey[0].path, ...page.path - }, - query: { + }; + } + if (page.query) { + params.query = { ...queryKey[0].query, ...page.query - }, + }; + } + const { data } = await postCallWithOptionalParam({ + ...options, + ...queryKey[0], + ...params, throwOnError: true }); return data; diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-solid-query/@tanstack/solid-query.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-solid-query/@tanstack/solid-query.gen.ts.snap index 58c790749..ef1fc054f 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-solid-query/@tanstack/solid-query.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-solid-query/@tanstack/solid-query.gen.ts.snap @@ -271,25 +271,35 @@ export const callWithParametersInfiniteOptions = (options: Options> = {}; + if (page.body) { + params.body = { ...queryKey[0].body as any, ...page.body as any - }, - headers: { + }; + } + if (page.headers) { + params.headers = { ...queryKey[0].headers, ...page.headers - }, - path: { + }; + } + if (page.path) { + params.path = { ...queryKey[0].path, ...page.path - }, - query: { + }; + } + if (page.query) { + params.query = { ...queryKey[0].query, ...page.query - }, + }; + } + const { data } = await callWithParameters({ + ...options, + ...queryKey[0], + ...params, throwOnError: true }); return data; @@ -363,25 +373,35 @@ export const getCallWithOptionalParamInfiniteOptions = (options: Options> = {}; + if (page.body) { + params.body = { ...queryKey[0].body as any, ...page.body as any - }, - headers: { + }; + } + if (page.headers) { + params.headers = { ...queryKey[0].headers, ...page.headers - }, - path: { + }; + } + if (page.path) { + params.path = { ...queryKey[0].path, ...page.path - }, - query: { + }; + } + if (page.query) { + params.query = { ...queryKey[0].query, ...page.query - }, + }; + } + const { data } = await getCallWithOptionalParam({ + ...options, + ...queryKey[0], + ...params, throwOnError: true }); return data; @@ -419,25 +439,35 @@ export const postCallWithOptionalParamInfiniteOptions = (options: Options> = {}; + if (page.body) { + params.body = { ...queryKey[0].body as any, ...page.body as any - }, - headers: { + }; + } + if (page.headers) { + params.headers = { ...queryKey[0].headers, ...page.headers - }, - path: { + }; + } + if (page.path) { + params.path = { ...queryKey[0].path, ...page.path - }, - query: { + }; + } + if (page.query) { + params.query = { ...queryKey[0].query, ...page.query - }, + }; + } + const { data } = await postCallWithOptionalParam({ + ...options, + ...queryKey[0], + ...params, throwOnError: true }); return data; diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-svelte-query/@tanstack/svelte-query.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-svelte-query/@tanstack/svelte-query.gen.ts.snap index 6b2d431be..7d2950de3 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-svelte-query/@tanstack/svelte-query.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-svelte-query/@tanstack/svelte-query.gen.ts.snap @@ -271,25 +271,35 @@ export const callWithParametersInfiniteOptions = (options: Options> = {}; + if (page.body) { + params.body = { ...queryKey[0].body as any, ...page.body as any - }, - headers: { + }; + } + if (page.headers) { + params.headers = { ...queryKey[0].headers, ...page.headers - }, - path: { + }; + } + if (page.path) { + params.path = { ...queryKey[0].path, ...page.path - }, - query: { + }; + } + if (page.query) { + params.query = { ...queryKey[0].query, ...page.query - }, + }; + } + const { data } = await callWithParameters({ + ...options, + ...queryKey[0], + ...params, throwOnError: true }); return data; @@ -363,25 +373,35 @@ export const getCallWithOptionalParamInfiniteOptions = (options: Options> = {}; + if (page.body) { + params.body = { ...queryKey[0].body as any, ...page.body as any - }, - headers: { + }; + } + if (page.headers) { + params.headers = { ...queryKey[0].headers, ...page.headers - }, - path: { + }; + } + if (page.path) { + params.path = { ...queryKey[0].path, ...page.path - }, - query: { + }; + } + if (page.query) { + params.query = { ...queryKey[0].query, ...page.query - }, + }; + } + const { data } = await getCallWithOptionalParam({ + ...options, + ...queryKey[0], + ...params, throwOnError: true }); return data; @@ -419,25 +439,35 @@ export const postCallWithOptionalParamInfiniteOptions = (options: Options> = {}; + if (page.body) { + params.body = { ...queryKey[0].body as any, ...page.body as any - }, - headers: { + }; + } + if (page.headers) { + params.headers = { ...queryKey[0].headers, ...page.headers - }, - path: { + }; + } + if (page.path) { + params.path = { ...queryKey[0].path, ...page.path - }, - query: { + }; + } + if (page.query) { + params.query = { ...queryKey[0].query, ...page.query - }, + }; + } + const { data } = await postCallWithOptionalParam({ + ...options, + ...queryKey[0], + ...params, throwOnError: true }); return data; diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-vue-query/@tanstack/vue-query.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-vue-query/@tanstack/vue-query.gen.ts.snap index f146b0451..43bec55b0 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-vue-query/@tanstack/vue-query.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-vue-query/@tanstack/vue-query.gen.ts.snap @@ -271,25 +271,35 @@ export const callWithParametersInfiniteOptions = (options: Options> = {}; + if (page.body) { + params.body = { ...queryKey[0].body as any, ...page.body as any - }, - headers: { + }; + } + if (page.headers) { + params.headers = { ...queryKey[0].headers, ...page.headers - }, - path: { + }; + } + if (page.path) { + params.path = { ...queryKey[0].path, ...page.path - }, - query: { + }; + } + if (page.query) { + params.query = { ...queryKey[0].query, ...page.query - }, + }; + } + const { data } = await callWithParameters({ + ...options, + ...queryKey[0], + ...params, throwOnError: true }); return data; @@ -363,25 +373,35 @@ export const getCallWithOptionalParamInfiniteOptions = (options: Options> = {}; + if (page.body) { + params.body = { ...queryKey[0].body as any, ...page.body as any - }, - headers: { + }; + } + if (page.headers) { + params.headers = { ...queryKey[0].headers, ...page.headers - }, - path: { + }; + } + if (page.path) { + params.path = { ...queryKey[0].path, ...page.path - }, - query: { + }; + } + if (page.query) { + params.query = { ...queryKey[0].query, ...page.query - }, + }; + } + const { data } = await getCallWithOptionalParam({ + ...options, + ...queryKey[0], + ...params, throwOnError: true }); return data; @@ -419,25 +439,35 @@ export const postCallWithOptionalParamInfiniteOptions = (options: Options> = {}; + if (page.body) { + params.body = { ...queryKey[0].body as any, ...page.body as any - }, - headers: { + }; + } + if (page.headers) { + params.headers = { ...queryKey[0].headers, ...page.headers - }, - path: { + }; + } + if (page.path) { + params.path = { ...queryKey[0].path, ...page.path - }, - query: { + }; + } + if (page.query) { + params.query = { ...queryKey[0].query, ...page.query - }, + }; + } + const { data } = await postCallWithOptionalParam({ + ...options, + ...queryKey[0], + ...params, throwOnError: true }); return data; diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-react-query/@tanstack/react-query.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-react-query/@tanstack/react-query.gen.ts.snap index aef9e65fa..59703f688 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-react-query/@tanstack/react-query.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-react-query/@tanstack/react-query.gen.ts.snap @@ -270,25 +270,35 @@ export const callWithParametersInfiniteOptions = (options: Options> = {}; + if (page.body) { + params.body = { ...queryKey[0].body as any, ...page.body as any - }, - headers: { + }; + } + if (page.headers) { + params.headers = { ...queryKey[0].headers, ...page.headers - }, - path: { + }; + } + if (page.path) { + params.path = { ...queryKey[0].path, ...page.path - }, - query: { + }; + } + if (page.query) { + params.query = { ...queryKey[0].query, ...page.query - }, + }; + } + const { data } = await callWithParameters({ + ...options, + ...queryKey[0], + ...params, throwOnError: true }); return data; @@ -362,25 +372,35 @@ export const getCallWithOptionalParamInfiniteOptions = (options: Options> = {}; + if (page.body) { + params.body = { ...queryKey[0].body as any, ...page.body as any - }, - headers: { + }; + } + if (page.headers) { + params.headers = { ...queryKey[0].headers, ...page.headers - }, - path: { + }; + } + if (page.path) { + params.path = { ...queryKey[0].path, ...page.path - }, - query: { + }; + } + if (page.query) { + params.query = { ...queryKey[0].query, ...page.query - }, + }; + } + const { data } = await getCallWithOptionalParam({ + ...options, + ...queryKey[0], + ...params, throwOnError: true }); return data; @@ -418,25 +438,35 @@ export const postCallWithOptionalParamInfiniteOptions = (options: Options> = {}; + if (page.body) { + params.body = { ...queryKey[0].body as any, ...page.body as any - }, - headers: { + }; + } + if (page.headers) { + params.headers = { ...queryKey[0].headers, ...page.headers - }, - path: { + }; + } + if (page.path) { + params.path = { ...queryKey[0].path, ...page.path - }, - query: { + }; + } + if (page.query) { + params.query = { ...queryKey[0].query, ...page.query - }, + }; + } + const { data } = await postCallWithOptionalParam({ + ...options, + ...queryKey[0], + ...params, throwOnError: true }); return data; diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-solid-query/@tanstack/solid-query.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-solid-query/@tanstack/solid-query.gen.ts.snap index 4b2ecf0fc..ceda75bee 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-solid-query/@tanstack/solid-query.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-solid-query/@tanstack/solid-query.gen.ts.snap @@ -270,25 +270,35 @@ export const callWithParametersInfiniteOptions = (options: Options> = {}; + if (page.body) { + params.body = { ...queryKey[0].body as any, ...page.body as any - }, - headers: { + }; + } + if (page.headers) { + params.headers = { ...queryKey[0].headers, ...page.headers - }, - path: { + }; + } + if (page.path) { + params.path = { ...queryKey[0].path, ...page.path - }, - query: { + }; + } + if (page.query) { + params.query = { ...queryKey[0].query, ...page.query - }, + }; + } + const { data } = await callWithParameters({ + ...options, + ...queryKey[0], + ...params, throwOnError: true }); return data; @@ -362,25 +372,35 @@ export const getCallWithOptionalParamInfiniteOptions = (options: Options> = {}; + if (page.body) { + params.body = { ...queryKey[0].body as any, ...page.body as any - }, - headers: { + }; + } + if (page.headers) { + params.headers = { ...queryKey[0].headers, ...page.headers - }, - path: { + }; + } + if (page.path) { + params.path = { ...queryKey[0].path, ...page.path - }, - query: { + }; + } + if (page.query) { + params.query = { ...queryKey[0].query, ...page.query - }, + }; + } + const { data } = await getCallWithOptionalParam({ + ...options, + ...queryKey[0], + ...params, throwOnError: true }); return data; @@ -418,25 +438,35 @@ export const postCallWithOptionalParamInfiniteOptions = (options: Options> = {}; + if (page.body) { + params.body = { ...queryKey[0].body as any, ...page.body as any - }, - headers: { + }; + } + if (page.headers) { + params.headers = { ...queryKey[0].headers, ...page.headers - }, - path: { + }; + } + if (page.path) { + params.path = { ...queryKey[0].path, ...page.path - }, - query: { + }; + } + if (page.query) { + params.query = { ...queryKey[0].query, ...page.query - }, + }; + } + const { data } = await postCallWithOptionalParam({ + ...options, + ...queryKey[0], + ...params, throwOnError: true }); return data; diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-svelte-query/@tanstack/svelte-query.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-svelte-query/@tanstack/svelte-query.gen.ts.snap index a20ed8feb..015e0fe49 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-svelte-query/@tanstack/svelte-query.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-svelte-query/@tanstack/svelte-query.gen.ts.snap @@ -270,25 +270,35 @@ export const callWithParametersInfiniteOptions = (options: Options> = {}; + if (page.body) { + params.body = { ...queryKey[0].body as any, ...page.body as any - }, - headers: { + }; + } + if (page.headers) { + params.headers = { ...queryKey[0].headers, ...page.headers - }, - path: { + }; + } + if (page.path) { + params.path = { ...queryKey[0].path, ...page.path - }, - query: { + }; + } + if (page.query) { + params.query = { ...queryKey[0].query, ...page.query - }, + }; + } + const { data } = await callWithParameters({ + ...options, + ...queryKey[0], + ...params, throwOnError: true }); return data; @@ -362,25 +372,35 @@ export const getCallWithOptionalParamInfiniteOptions = (options: Options> = {}; + if (page.body) { + params.body = { ...queryKey[0].body as any, ...page.body as any - }, - headers: { + }; + } + if (page.headers) { + params.headers = { ...queryKey[0].headers, ...page.headers - }, - path: { + }; + } + if (page.path) { + params.path = { ...queryKey[0].path, ...page.path - }, - query: { + }; + } + if (page.query) { + params.query = { ...queryKey[0].query, ...page.query - }, + }; + } + const { data } = await getCallWithOptionalParam({ + ...options, + ...queryKey[0], + ...params, throwOnError: true }); return data; @@ -418,25 +438,35 @@ export const postCallWithOptionalParamInfiniteOptions = (options: Options> = {}; + if (page.body) { + params.body = { ...queryKey[0].body as any, ...page.body as any - }, - headers: { + }; + } + if (page.headers) { + params.headers = { ...queryKey[0].headers, ...page.headers - }, - path: { + }; + } + if (page.path) { + params.path = { ...queryKey[0].path, ...page.path - }, - query: { + }; + } + if (page.query) { + params.query = { ...queryKey[0].query, ...page.query - }, + }; + } + const { data } = await postCallWithOptionalParam({ + ...options, + ...queryKey[0], + ...params, throwOnError: true }); return data; diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-vue-query/@tanstack/vue-query.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-vue-query/@tanstack/vue-query.gen.ts.snap index 041d3c50e..124d3cabe 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-vue-query/@tanstack/vue-query.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-vue-query/@tanstack/vue-query.gen.ts.snap @@ -270,25 +270,35 @@ export const callWithParametersInfiniteOptions = (options: Options> = {}; + if (page.body) { + params.body = { ...queryKey[0].body as any, ...page.body as any - }, - headers: { + }; + } + if (page.headers) { + params.headers = { ...queryKey[0].headers, ...page.headers - }, - path: { + }; + } + if (page.path) { + params.path = { ...queryKey[0].path, ...page.path - }, - query: { + }; + } + if (page.query) { + params.query = { ...queryKey[0].query, ...page.query - }, + }; + } + const { data } = await callWithParameters({ + ...options, + ...queryKey[0], + ...params, throwOnError: true }); return data; @@ -362,25 +372,35 @@ export const getCallWithOptionalParamInfiniteOptions = (options: Options> = {}; + if (page.body) { + params.body = { ...queryKey[0].body as any, ...page.body as any - }, - headers: { + }; + } + if (page.headers) { + params.headers = { ...queryKey[0].headers, ...page.headers - }, - path: { + }; + } + if (page.path) { + params.path = { ...queryKey[0].path, ...page.path - }, - query: { + }; + } + if (page.query) { + params.query = { ...queryKey[0].query, ...page.query - }, + }; + } + const { data } = await getCallWithOptionalParam({ + ...options, + ...queryKey[0], + ...params, throwOnError: true }); return data; @@ -418,25 +438,35 @@ export const postCallWithOptionalParamInfiniteOptions = (options: Options> = {}; + if (page.body) { + params.body = { ...queryKey[0].body as any, ...page.body as any - }, - headers: { + }; + } + if (page.headers) { + params.headers = { ...queryKey[0].headers, ...page.headers - }, - path: { + }; + } + if (page.path) { + params.path = { ...queryKey[0].path, ...page.path - }, - query: { + }; + } + if (page.query) { + params.query = { ...queryKey[0].query, ...page.query - }, + }; + } + const { data } = await postCallWithOptionalParam({ + ...options, + ...queryKey[0], + ...params, throwOnError: true }); return data; diff --git a/packages/openapi-ts/test/sample.cjs b/packages/openapi-ts/test/sample.cjs index 8c8397214..9049fc0e7 100644 --- a/packages/openapi-ts/test/sample.cjs +++ b/packages/openapi-ts/test/sample.cjs @@ -18,15 +18,15 @@ const main = async () => { output: { path: './test/generated/sample/', }, - // plugins: [ - // { - // // infiniteQueryOptions: false, - // // mutationOptions: false, - // name: '@tanstack/react-query', - // // queryOptions: false, - // }, - // // '@hey-api/services', - // ], + plugins: [ + { + // infiniteQueryOptions: false, + // mutationOptions: false, + name: '@tanstack/react-query', + // queryOptions: false, + }, + // '@hey-api/services', + ], schemas: { export: false, }, -- 2.51.2 From 11ee53f4f519643ae7e3f0997ce4fe9b6cb050a8 Mon Sep 17 00:00:00 2001 From: Lubos Date: Thu, 26 Sep 2024 22:28:18 +0800 Subject: [PATCH 33/49] fix: avoid printing duplicate null nodes --- .changeset/four-moose-love.md | 5 ++ .prettierignore | 1 + packages/openapi-ts/src/utils/type.ts | 5 +- packages/openapi-ts/test/3.1.0.spec.ts | 65 +++++++++++++++++++ .../test/__snapshots__/3.1.0/index.ts | 2 + .../test/__snapshots__/3.1.0/types.gen.ts | 18 +++++ packages/openapi-ts/test/sample.cjs | 23 +++---- .../test/spec/3.1.0/duplicate-null.json | 37 +++++++++++ packages/openapi-ts/test/utils.ts | 20 ++++++ 9 files changed, 164 insertions(+), 12 deletions(-) create mode 100644 .changeset/four-moose-love.md create mode 100644 packages/openapi-ts/test/3.1.0.spec.ts create mode 100644 packages/openapi-ts/test/__snapshots__/3.1.0/index.ts create mode 100644 packages/openapi-ts/test/__snapshots__/3.1.0/types.gen.ts create mode 100644 packages/openapi-ts/test/spec/3.1.0/duplicate-null.json create mode 100644 packages/openapi-ts/test/utils.ts diff --git a/.changeset/four-moose-love.md b/.changeset/four-moose-love.md new file mode 100644 index 000000000..1fc7a124e --- /dev/null +++ b/.changeset/four-moose-love.md @@ -0,0 +1,5 @@ +--- +'@hey-api/openapi-ts': patch +--- + +fix: avoid printing duplicate null nodes diff --git a/.prettierignore b/.prettierignore index f8b7cc177..26059e3e6 100644 --- a/.prettierignore +++ b/.prettierignore @@ -6,6 +6,7 @@ **/.vitepress/cache **/.vitepress/dist **/test/e2e +**/__snapshots__ **/CHANGELOG.md pnpm-lock.yaml diff --git a/packages/openapi-ts/src/utils/type.ts b/packages/openapi-ts/src/utils/type.ts index fd4fc77f9..fb0c2cbb0 100644 --- a/packages/openapi-ts/src/utils/type.ts +++ b/packages/openapi-ts/src/utils/type.ts @@ -121,7 +121,10 @@ const typeUnionOrIntersection = ({ const node = style === 'union' ? compiler.typeUnionNode({ - isNullable: model.isNullable, + // avoid printing duplicate null statements + isNullable: + model.isNullable && + !model.properties.find((property) => property.isNullable), types, }) : compiler.typeIntersectionNode({ diff --git a/packages/openapi-ts/test/3.1.0.spec.ts b/packages/openapi-ts/test/3.1.0.spec.ts new file mode 100644 index 000000000..da6df707b --- /dev/null +++ b/packages/openapi-ts/test/3.1.0.spec.ts @@ -0,0 +1,65 @@ +import { readFileSync } from 'node:fs'; +import path from 'node:path'; +import { fileURLToPath } from 'node:url'; + +import { describe, expect, it } from 'vitest'; + +import { createClient } from '../'; +import type { UserConfig } from '../src/types/config'; +import { getFilePaths } from './utils'; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); + +describe('OpenAPI 3.1.0', () => { + const createConfig = (userConfig: UserConfig): UserConfig => ({ + client: '@hey-api/client-fetch', + schemas: false, + ...userConfig, + input: path.join( + __dirname, + 'spec', + '3.1.0', + typeof userConfig.input === 'string' ? userConfig.input : '', + ), + output: path.join( + __dirname, + 'generated', + '3.1.0', + typeof userConfig.output === 'string' ? userConfig.output : '', + ), + }); + + const scenarios = [ + { + config: createConfig({ + input: 'duplicate-null.json', + output: 'duplicate-null', + services: { + export: false, + }, + }), + description: 'does not generate duplicate null', + }, + ]; + + it.each(scenarios)('$description', async ({ config }) => { + // @ts-ignore + await createClient(config); + + const outputPath = typeof config.output === 'string' ? config.output : ''; + const filePaths = getFilePaths(outputPath); + + filePaths.forEach((filePath) => { + const fileContent = readFileSync(filePath, 'utf-8'); + expect(fileContent).toMatchFileSnapshot( + path.join( + __dirname, + '__snapshots__', + '3.1.0', + filePath.slice(outputPath.length + 1), + ), + ); + }); + }); +}); diff --git a/packages/openapi-ts/test/__snapshots__/3.1.0/index.ts b/packages/openapi-ts/test/__snapshots__/3.1.0/index.ts new file mode 100644 index 000000000..343d3c8f7 --- /dev/null +++ b/packages/openapi-ts/test/__snapshots__/3.1.0/index.ts @@ -0,0 +1,2 @@ +// This file is auto-generated by @hey-api/openapi-ts +export * from './types.gen'; diff --git a/packages/openapi-ts/test/__snapshots__/3.1.0/types.gen.ts b/packages/openapi-ts/test/__snapshots__/3.1.0/types.gen.ts new file mode 100644 index 000000000..d4f186e88 --- /dev/null +++ b/packages/openapi-ts/test/__snapshots__/3.1.0/types.gen.ts @@ -0,0 +1,18 @@ +// This file is auto-generated by @hey-api/openapi-ts + +export type PostTestData = { + /** + * should not produce duplicate null + */ + body?: { + weirdEnum?: ('' | (string) | null); + }; +}; + +export type $OpenApiTs = { + '/test': { + post: { + req: PostTestData; + }; + }; +}; \ No newline at end of file diff --git a/packages/openapi-ts/test/sample.cjs b/packages/openapi-ts/test/sample.cjs index 9049fc0e7..c45a07fed 100644 --- a/packages/openapi-ts/test/sample.cjs +++ b/packages/openapi-ts/test/sample.cjs @@ -11,27 +11,28 @@ const main = async () => { // debug: true, // experimental_parser: true, // input: './test/spec/v3-transforms.json', - input: './test/spec/v3.json', + // input: './test/spec/v3.json', + input: './test/spec/3.1.0/duplicate-null.json', // input: './test/spec/v2.json', // input: 'https://mongodb-mms-prod-build-server.s3.amazonaws.com/openapi/2caffd88277a4e27c95dcefc7e3b6a63a3b03297-v2-2023-11-15.json', // name: 'foo', output: { path: './test/generated/sample/', }, - plugins: [ - { - // infiniteQueryOptions: false, - // mutationOptions: false, - name: '@tanstack/react-query', - // queryOptions: false, - }, - // '@hey-api/services', - ], + // plugins: [ + // { + // // infiniteQueryOptions: false, + // // mutationOptions: false, + // name: '@tanstack/react-query', + // // queryOptions: false, + // }, + // // '@hey-api/services', + // ], schemas: { export: false, }, services: { - // export: false, + export: false, // asClass: true, // filter: '^GET /api/v{api-version}/simple:operation$', // export: false, diff --git a/packages/openapi-ts/test/spec/3.1.0/duplicate-null.json b/packages/openapi-ts/test/spec/3.1.0/duplicate-null.json new file mode 100644 index 000000000..b35602a14 --- /dev/null +++ b/packages/openapi-ts/test/spec/3.1.0/duplicate-null.json @@ -0,0 +1,37 @@ +{ + "openapi": "3.1.0", + "info": { + "version": "1.0.0" + }, + "paths": { + "/test": { + "post": { + "requestBody": { + "description": "should not produce duplicate null", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "weirdEnum": { + "oneOf": [ + { + "type": "string", + "enum": [""] + }, + { + "type": "string", + "nullable": true + } + ], + "nullable": true + } + } + } + } + } + } + } + } + } +} diff --git a/packages/openapi-ts/test/utils.ts b/packages/openapi-ts/test/utils.ts new file mode 100644 index 000000000..de8ec5cbf --- /dev/null +++ b/packages/openapi-ts/test/utils.ts @@ -0,0 +1,20 @@ +import { readdirSync, statSync } from 'node:fs'; +import path from 'node:path'; + +export const getFilePaths = (dirPath: string): Array => { + let filePaths: Array = []; + const files = readdirSync(dirPath); + + for (const file of files) { + const filePath = path.join(dirPath, file); + const stat = statSync(filePath); + + if (stat.isDirectory()) { + filePaths = filePaths.concat(getFilePaths(filePath)); + } else { + filePaths.push(filePath); + } + } + + return filePaths; +}; -- 2.51.2 From b6e350a9cc2d82ac4496b7d57ec8b58978c951c2 Mon Sep 17 00:00:00 2001 From: Lubos Date: Thu, 26 Sep 2024 23:35:21 +0800 Subject: [PATCH 34/49] fix: make TanStack Query plugin work with class-based services --- .changeset/clean-badgers-heal.md | 5 + eslint.config.js | 1 + .../openapi-ts/src/generate/transformers.ts | 3 +- .../src/openApi/common/parser/operation.ts | 8 + .../src/openApi/v2/parser/getOperations.ts | 18 +- .../src/openApi/v3/parser/getOperations.ts | 18 +- .../plugins/@tanstack/query-core/plugin.ts | 21 +- .../test/__snapshots__/3.1.0/index.ts | 2 +- .../asClass/@tanstack/react-query.gen.ts | 997 ++++++++++ .../@tanstack/react-query/asClass/index.ts} | 0 .../react-query/asClass/services.gen.ts | 451 +++++ .../react-query/asClass/types.gen.ts} | 265 +-- .../axios/@tanstack/react-query.gen.ts} | 0 .../@tanstack/react-query/axios/index.ts} | 0 .../react-query/axios/services.gen.ts} | 0 .../@tanstack/react-query/axios/types.gen.ts} | 123 -- .../fetch/@tanstack/react-query.gen.ts} | 0 .../@tanstack/react-query/fetch/index.ts} | 0 .../react-query/fetch/services.gen.ts} | 0 .../@tanstack/react-query/fetch/types.gen.ts} | 123 -- .../asClass/@tanstack/solid-query.gen.ts | 997 ++++++++++ .../@tanstack/solid-query/asClass/index.ts} | 0 .../solid-query/asClass/services.gen.ts | 451 +++++ .../solid-query/asClass/types.gen.ts} | 265 +-- .../axios/@tanstack/solid-query.gen.ts} | 0 .../@tanstack/solid-query/axios/index.ts} | 0 .../solid-query/axios/services.gen.ts} | 0 .../@tanstack/solid-query/axios/types.gen.ts | 1507 +++++++++++++++ .../fetch/@tanstack/solid-query.gen.ts} | 0 .../@tanstack/solid-query/fetch/index.ts} | 0 .../solid-query/fetch/services.gen.ts} | 0 .../@tanstack/solid-query/fetch/types.gen.ts | 1507 +++++++++++++++ .../asClass/@tanstack/svelte-query.gen.ts | 997 ++++++++++ .../@tanstack/svelte-query/asClass/index.ts} | 0 .../svelte-query/asClass/services.gen.ts | 451 +++++ .../svelte-query/asClass/types.gen.ts | 1507 +++++++++++++++ .../axios/@tanstack/svelte-query.gen.ts} | 0 .../@tanstack/svelte-query/axios/index.ts} | 0 .../svelte-query/axios/services.gen.ts} | 0 .../@tanstack/svelte-query/axios/types.gen.ts | 1507 +++++++++++++++ .../fetch/@tanstack/svelte-query.gen.ts} | 0 .../@tanstack/svelte-query/fetch/index.ts} | 0 .../svelte-query/fetch/services.gen.ts} | 0 .../@tanstack/svelte-query/fetch/types.gen.ts | 1507 +++++++++++++++ .../asClass/@tanstack/vue-query.gen.ts | 997 ++++++++++ .../@tanstack/vue-query/asClass/index.ts} | 0 .../vue-query/asClass/services.gen.ts | 451 +++++ .../@tanstack/vue-query/asClass/types.gen.ts | 1507 +++++++++++++++ .../axios/@tanstack/vue-query.gen.ts} | 0 .../@tanstack/vue-query/axios/index.ts} | 0 .../vue-query/axios/services.gen.ts} | 0 .../@tanstack/vue-query/axios/types.gen.ts | 1507 +++++++++++++++ .../fetch/@tanstack/vue-query.gen.ts} | 0 .../@tanstack/vue-query/fetch/index.ts} | 0 .../vue-query/fetch/services.gen.ts} | 0 .../@tanstack/vue-query/fetch/types.gen.ts | 1507 +++++++++++++++ .../@tanstack/react-query.gen.ts.snap | 110 -- .../services.gen.ts.snap | 39 - .../types.gen.ts.snap | 118 -- .../@tanstack/solid-query.gen.ts.snap | 110 -- .../services.gen.ts.snap | 39 - .../types.gen.ts.snap | 118 -- .../@tanstack/svelte-query.gen.ts.snap | 110 -- .../services.gen.ts.snap | 39 - .../types.gen.ts.snap | 118 -- .../@tanstack/vue-query.gen.ts.snap | 110 -- .../services.gen.ts.snap | 39 - .../types.gen.ts.snap | 118 -- .../types.gen.ts.snap | 1630 ----------------- .../@tanstack/react-query.gen.ts.snap | 109 -- .../services.gen.ts.snap | 39 - .../types.gen.ts.snap | 118 -- .../types.gen.ts.snap | 1630 ----------------- .../@tanstack/solid-query.gen.ts.snap | 109 -- .../services.gen.ts.snap | 39 - .../types.gen.ts.snap | 118 -- .../index.ts.snap | 3 - .../types.gen.ts.snap | 1630 ----------------- .../@tanstack/svelte-query.gen.ts.snap | 109 -- .../index.ts.snap | 3 - .../services.gen.ts.snap | 39 - .../types.gen.ts.snap | 118 -- .../index.ts.snap | 3 - .../types.gen.ts.snap | 1630 ----------------- .../@tanstack/vue-query.gen.ts.snap | 109 -- .../index.ts.snap | 3 - .../services.gen.ts.snap | 39 - .../types.gen.ts.snap | 118 -- packages/openapi-ts/test/index.spec.ts | 65 - packages/openapi-ts/test/plugins.spec.ts | 161 ++ packages/openapi-ts/test/sample.cjs | 26 +- 91 files changed, 18222 insertions(+), 9394 deletions(-) create mode 100644 .changeset/clean-badgers-heal.md create mode 100644 packages/openapi-ts/test/__snapshots__/plugins/@tanstack/react-query/asClass/@tanstack/react-query.gen.ts rename packages/openapi-ts/test/__snapshots__/{test/generated/v3-hey-api-client-axios-plugin-tanstack-react-query/index.ts.snap => plugins/@tanstack/react-query/asClass/index.ts} (100%) create mode 100644 packages/openapi-ts/test/__snapshots__/plugins/@tanstack/react-query/asClass/services.gen.ts rename packages/openapi-ts/test/__snapshots__/{test/generated/v3-hey-api-client-axios-plugin-tanstack-react-query/types.gen.ts.snap => plugins/@tanstack/react-query/asClass/types.gen.ts} (93%) rename packages/openapi-ts/test/__snapshots__/{test/generated/v3-hey-api-client-axios-plugin-tanstack-react-query/@tanstack/react-query.gen.ts.snap => plugins/@tanstack/react-query/axios/@tanstack/react-query.gen.ts} (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated/v3-hey-api-client-axios-plugin-tanstack-react-query_transform/index.ts.snap => plugins/@tanstack/react-query/axios/index.ts} (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated/v3-hey-api-client-axios-plugin-tanstack-react-query/services.gen.ts.snap => plugins/@tanstack/react-query/axios/services.gen.ts} (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated/v3-hey-api-client-axios-plugin-tanstack-solid-query/types.gen.ts.snap => plugins/@tanstack/react-query/axios/types.gen.ts} (93%) rename packages/openapi-ts/test/__snapshots__/{test/generated/v3-hey-api-client-fetch-plugin-tanstack-react-query/@tanstack/react-query.gen.ts.snap => plugins/@tanstack/react-query/fetch/@tanstack/react-query.gen.ts} (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated/v3-hey-api-client-axios-plugin-tanstack-solid-query/index.ts.snap => plugins/@tanstack/react-query/fetch/index.ts} (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated/v3-hey-api-client-fetch-plugin-tanstack-react-query/services.gen.ts.snap => plugins/@tanstack/react-query/fetch/services.gen.ts} (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated/v3-hey-api-client-axios-plugin-tanstack-svelte-query/types.gen.ts.snap => plugins/@tanstack/react-query/fetch/types.gen.ts} (93%) create mode 100644 packages/openapi-ts/test/__snapshots__/plugins/@tanstack/solid-query/asClass/@tanstack/solid-query.gen.ts rename packages/openapi-ts/test/__snapshots__/{test/generated/v3-hey-api-client-axios-plugin-tanstack-solid-query_transform/index.ts.snap => plugins/@tanstack/solid-query/asClass/index.ts} (100%) create mode 100644 packages/openapi-ts/test/__snapshots__/plugins/@tanstack/solid-query/asClass/services.gen.ts rename packages/openapi-ts/test/__snapshots__/{test/generated/v3-hey-api-client-axios-plugin-tanstack-vue-query/types.gen.ts.snap => plugins/@tanstack/solid-query/asClass/types.gen.ts} (93%) rename packages/openapi-ts/test/__snapshots__/{test/generated/v3-hey-api-client-axios-plugin-tanstack-solid-query/@tanstack/solid-query.gen.ts.snap => plugins/@tanstack/solid-query/axios/@tanstack/solid-query.gen.ts} (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated/v3-hey-api-client-axios-plugin-tanstack-svelte-query/index.ts.snap => plugins/@tanstack/solid-query/axios/index.ts} (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated/v3-hey-api-client-axios-plugin-tanstack-solid-query/services.gen.ts.snap => plugins/@tanstack/solid-query/axios/services.gen.ts} (100%) create mode 100644 packages/openapi-ts/test/__snapshots__/plugins/@tanstack/solid-query/axios/types.gen.ts rename packages/openapi-ts/test/__snapshots__/{test/generated/v3-hey-api-client-fetch-plugin-tanstack-solid-query/@tanstack/solid-query.gen.ts.snap => plugins/@tanstack/solid-query/fetch/@tanstack/solid-query.gen.ts} (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated/v3-hey-api-client-axios-plugin-tanstack-svelte-query_transform/index.ts.snap => plugins/@tanstack/solid-query/fetch/index.ts} (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated/v3-hey-api-client-fetch-plugin-tanstack-solid-query/services.gen.ts.snap => plugins/@tanstack/solid-query/fetch/services.gen.ts} (100%) create mode 100644 packages/openapi-ts/test/__snapshots__/plugins/@tanstack/solid-query/fetch/types.gen.ts create mode 100644 packages/openapi-ts/test/__snapshots__/plugins/@tanstack/svelte-query/asClass/@tanstack/svelte-query.gen.ts rename packages/openapi-ts/test/__snapshots__/{test/generated/v3-hey-api-client-axios-plugin-tanstack-vue-query/index.ts.snap => plugins/@tanstack/svelte-query/asClass/index.ts} (100%) create mode 100644 packages/openapi-ts/test/__snapshots__/plugins/@tanstack/svelte-query/asClass/services.gen.ts create mode 100644 packages/openapi-ts/test/__snapshots__/plugins/@tanstack/svelte-query/asClass/types.gen.ts rename packages/openapi-ts/test/__snapshots__/{test/generated/v3-hey-api-client-axios-plugin-tanstack-svelte-query/@tanstack/svelte-query.gen.ts.snap => plugins/@tanstack/svelte-query/axios/@tanstack/svelte-query.gen.ts} (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated/v3-hey-api-client-axios-plugin-tanstack-vue-query_transform/index.ts.snap => plugins/@tanstack/svelte-query/axios/index.ts} (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated/v3-hey-api-client-axios-plugin-tanstack-svelte-query/services.gen.ts.snap => plugins/@tanstack/svelte-query/axios/services.gen.ts} (100%) create mode 100644 packages/openapi-ts/test/__snapshots__/plugins/@tanstack/svelte-query/axios/types.gen.ts rename packages/openapi-ts/test/__snapshots__/{test/generated/v3-hey-api-client-fetch-plugin-tanstack-svelte-query/@tanstack/svelte-query.gen.ts.snap => plugins/@tanstack/svelte-query/fetch/@tanstack/svelte-query.gen.ts} (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated/v3-hey-api-client-fetch-plugin-tanstack-react-query/index.ts.snap => plugins/@tanstack/svelte-query/fetch/index.ts} (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated/v3-hey-api-client-fetch-plugin-tanstack-svelte-query/services.gen.ts.snap => plugins/@tanstack/svelte-query/fetch/services.gen.ts} (100%) create mode 100644 packages/openapi-ts/test/__snapshots__/plugins/@tanstack/svelte-query/fetch/types.gen.ts create mode 100644 packages/openapi-ts/test/__snapshots__/plugins/@tanstack/vue-query/asClass/@tanstack/vue-query.gen.ts rename packages/openapi-ts/test/__snapshots__/{test/generated/v3-hey-api-client-fetch-plugin-tanstack-react-query_transform/index.ts.snap => plugins/@tanstack/vue-query/asClass/index.ts} (100%) create mode 100644 packages/openapi-ts/test/__snapshots__/plugins/@tanstack/vue-query/asClass/services.gen.ts create mode 100644 packages/openapi-ts/test/__snapshots__/plugins/@tanstack/vue-query/asClass/types.gen.ts rename packages/openapi-ts/test/__snapshots__/{test/generated/v3-hey-api-client-axios-plugin-tanstack-vue-query/@tanstack/vue-query.gen.ts.snap => plugins/@tanstack/vue-query/axios/@tanstack/vue-query.gen.ts} (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated/v3-hey-api-client-fetch-plugin-tanstack-solid-query/index.ts.snap => plugins/@tanstack/vue-query/axios/index.ts} (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated/v3-hey-api-client-axios-plugin-tanstack-vue-query/services.gen.ts.snap => plugins/@tanstack/vue-query/axios/services.gen.ts} (100%) create mode 100644 packages/openapi-ts/test/__snapshots__/plugins/@tanstack/vue-query/axios/types.gen.ts rename packages/openapi-ts/test/__snapshots__/{test/generated/v3-hey-api-client-fetch-plugin-tanstack-vue-query/@tanstack/vue-query.gen.ts.snap => plugins/@tanstack/vue-query/fetch/@tanstack/vue-query.gen.ts} (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated/v3-hey-api-client-fetch-plugin-tanstack-solid-query_transform/index.ts.snap => plugins/@tanstack/vue-query/fetch/index.ts} (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated/v3-hey-api-client-fetch-plugin-tanstack-vue-query/services.gen.ts.snap => plugins/@tanstack/vue-query/fetch/services.gen.ts} (100%) create mode 100644 packages/openapi-ts/test/__snapshots__/plugins/@tanstack/vue-query/fetch/types.gen.ts delete mode 100644 packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-react-query_transform/@tanstack/react-query.gen.ts.snap delete mode 100644 packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-react-query_transform/services.gen.ts.snap delete mode 100644 packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-react-query_transform/types.gen.ts.snap delete mode 100644 packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-solid-query_transform/@tanstack/solid-query.gen.ts.snap delete mode 100644 packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-solid-query_transform/services.gen.ts.snap delete mode 100644 packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-solid-query_transform/types.gen.ts.snap delete mode 100644 packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-svelte-query_transform/@tanstack/svelte-query.gen.ts.snap delete mode 100644 packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-svelte-query_transform/services.gen.ts.snap delete mode 100644 packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-svelte-query_transform/types.gen.ts.snap delete mode 100644 packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-vue-query_transform/@tanstack/vue-query.gen.ts.snap delete mode 100644 packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-vue-query_transform/services.gen.ts.snap delete mode 100644 packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-vue-query_transform/types.gen.ts.snap delete mode 100644 packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-react-query/types.gen.ts.snap delete mode 100644 packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-react-query_transform/@tanstack/react-query.gen.ts.snap delete mode 100644 packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-react-query_transform/services.gen.ts.snap delete mode 100644 packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-react-query_transform/types.gen.ts.snap delete mode 100644 packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-solid-query/types.gen.ts.snap delete mode 100644 packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-solid-query_transform/@tanstack/solid-query.gen.ts.snap delete mode 100644 packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-solid-query_transform/services.gen.ts.snap delete mode 100644 packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-solid-query_transform/types.gen.ts.snap delete mode 100644 packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-svelte-query/index.ts.snap delete mode 100644 packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-svelte-query/types.gen.ts.snap delete mode 100644 packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-svelte-query_transform/@tanstack/svelte-query.gen.ts.snap delete mode 100644 packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-svelte-query_transform/index.ts.snap delete mode 100644 packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-svelte-query_transform/services.gen.ts.snap delete mode 100644 packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-svelte-query_transform/types.gen.ts.snap delete mode 100644 packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-vue-query/index.ts.snap delete mode 100644 packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-vue-query/types.gen.ts.snap delete mode 100644 packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-vue-query_transform/@tanstack/vue-query.gen.ts.snap delete mode 100644 packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-vue-query_transform/index.ts.snap delete mode 100644 packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-vue-query_transform/services.gen.ts.snap delete mode 100644 packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-vue-query_transform/types.gen.ts.snap create mode 100644 packages/openapi-ts/test/plugins.spec.ts diff --git a/.changeset/clean-badgers-heal.md b/.changeset/clean-badgers-heal.md new file mode 100644 index 000000000..d738f86b2 --- /dev/null +++ b/.changeset/clean-badgers-heal.md @@ -0,0 +1,5 @@ +--- +'@hey-api/openapi-ts': patch +--- + +fix: make TanStack Query plugin work with class-based services diff --git a/eslint.config.js b/eslint.config.js index 2e8115f33..21f7b0d79 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -61,6 +61,7 @@ export default tseslint.config( 'packages/openapi-ts/src/legacy/handlebars/templates/**/*.hbs', '**/test/e2e/generated/', '**/test/generated/', + '**/__snapshots__/', '**/.svelte-kit/', '**/.vitepress/cache', '**/.vitepress/dist', diff --git a/packages/openapi-ts/src/generate/transformers.ts b/packages/openapi-ts/src/generate/transformers.ts index b5ad144da..805a207ec 100644 --- a/packages/openapi-ts/src/generate/transformers.ts +++ b/packages/openapi-ts/src/generate/transformers.ts @@ -1,6 +1,7 @@ import ts from 'typescript'; import { compiler } from '../compiler'; +import { getOperationKey } from '../openApi/common/parser/operation'; import type { ModelMeta, OperationResponse } from '../types/client'; import { getConfig } from '../utils/config'; import { isModelDate, unsetUniqueTypeName } from '../utils/type'; @@ -270,7 +271,7 @@ export const generateResponseTransformers = async ({ if (nonVoidResponses.length > 1) { if (config.debug) { console.warn( - `❗️ Transformers warning: route ${operation.method} ${operation.path} has ${nonVoidResponses.length} non-void success responses. This is currently not handled and we will not generate a response transformer. Please open an issue if you'd like this feature https://github.com/hey-api/openapi-ts/issues`, + `❗️ Transformers warning: route ${getOperationKey(operation)} has ${nonVoidResponses.length} non-void success responses. This is currently not handled and we will not generate a response transformer. Please open an issue if you'd like this feature https://github.com/hey-api/openapi-ts/issues`, ); } continue; diff --git a/packages/openapi-ts/src/openApi/common/parser/operation.ts b/packages/openapi-ts/src/openApi/common/parser/operation.ts index d634c2e8c..f6cf6f2ea 100644 --- a/packages/openapi-ts/src/openApi/common/parser/operation.ts +++ b/packages/openapi-ts/src/openApi/common/parser/operation.ts @@ -3,6 +3,14 @@ import type { OperationResponse, } from '../interfaces/client'; +export const getOperationKey = (operation: { + method: string; + path: string; +}) => { + const operationKey = `${operation.method} ${operation.path}`; + return operationKey; +}; + export const getOperationResponseHeader = ( operationResponses: OperationResponse[], ): string | null => { diff --git a/packages/openapi-ts/src/openApi/v2/parser/getOperations.ts b/packages/openapi-ts/src/openApi/v2/parser/getOperations.ts index 69f2cfb67..696eae6ff 100644 --- a/packages/openapi-ts/src/openApi/v2/parser/getOperations.ts +++ b/packages/openapi-ts/src/openApi/v2/parser/getOperations.ts @@ -1,4 +1,5 @@ import type { Client, Operation } from '../../common/interfaces/client'; +import { getOperationKey } from '../../common/parser/operation'; import { allowedServiceMethods } from '../../common/parser/service'; import { getConfig } from '../../config'; import type { OpenApi } from '../interfaces/OpenApi'; @@ -17,21 +18,24 @@ export const getOperations = ({ const operationIds = new Map(); const operations: Operation[] = []; - for (const url in openApi.paths) { - const path = openApi.paths[url]; + for (const path in openApi.paths) { + const pathItem = openApi.paths[path]; const pathParameters = getOperationParameters({ openApi, - parameters: path.parameters ?? [], + parameters: pathItem.parameters ?? [], types, }); - for (const key in path) { + for (const key in pathItem) { const method = key as Lowercase; - const operationKey = `${method.toUpperCase()} ${url}`; + const operationKey = getOperationKey({ + method: method.toUpperCase(), + path, + }); if (allowedServiceMethods.includes(method)) { - const op = path[method]!; + const op = pathItem[method]!; if (op.operationId) { if (operationIds.has(op.operationId)) { @@ -53,7 +57,7 @@ export const getOperations = ({ openApi, pathParams: pathParameters, types, - url, + url: path, }); operations.push(operation); } diff --git a/packages/openapi-ts/src/openApi/v3/parser/getOperations.ts b/packages/openapi-ts/src/openApi/v3/parser/getOperations.ts index 69f2cfb67..696eae6ff 100644 --- a/packages/openapi-ts/src/openApi/v3/parser/getOperations.ts +++ b/packages/openapi-ts/src/openApi/v3/parser/getOperations.ts @@ -1,4 +1,5 @@ import type { Client, Operation } from '../../common/interfaces/client'; +import { getOperationKey } from '../../common/parser/operation'; import { allowedServiceMethods } from '../../common/parser/service'; import { getConfig } from '../../config'; import type { OpenApi } from '../interfaces/OpenApi'; @@ -17,21 +18,24 @@ export const getOperations = ({ const operationIds = new Map(); const operations: Operation[] = []; - for (const url in openApi.paths) { - const path = openApi.paths[url]; + for (const path in openApi.paths) { + const pathItem = openApi.paths[path]; const pathParameters = getOperationParameters({ openApi, - parameters: path.parameters ?? [], + parameters: pathItem.parameters ?? [], types, }); - for (const key in path) { + for (const key in pathItem) { const method = key as Lowercase; - const operationKey = `${method.toUpperCase()} ${url}`; + const operationKey = getOperationKey({ + method: method.toUpperCase(), + path, + }); if (allowedServiceMethods.includes(method)) { - const op = path[method]!; + const op = pathItem[method]!; if (op.operationId) { if (operationIds.has(op.operationId)) { @@ -53,7 +57,7 @@ export const getOperations = ({ openApi, pathParams: pathParameters, types, - url, + url: path, }); operations.push(operation); } diff --git a/packages/openapi-ts/src/plugins/@tanstack/query-core/plugin.ts b/packages/openapi-ts/src/plugins/@tanstack/query-core/plugin.ts index 9026ddb67..d677d0d62 100644 --- a/packages/openapi-ts/src/plugins/@tanstack/query-core/plugin.ts +++ b/packages/openapi-ts/src/plugins/@tanstack/query-core/plugin.ts @@ -16,6 +16,7 @@ import { toOperationName, } from '../../../generate/services'; import { isOperationParameterRequired } from '../../../openApi'; +import { getOperationKey } from '../../../openApi/common/parser/operation'; import type { Client } from '../../../types/client'; import type { Method, @@ -25,6 +26,7 @@ import type { } from '../../../types/client'; import type { Files } from '../../../types/utils'; import { getConfig } from '../../../utils/config'; +import { transformServiceName } from '../../../utils/transform'; import type { PluginDefinition } from '../../types'; const toInfiniteQueryOptionsName = (operation: Operation) => @@ -471,6 +473,7 @@ export const handler: PluginDefinition['handler'] = ({ checkPrerequisites({ files }); + const config = getConfig(); const file = files[plugin.name]; file.import({ @@ -495,9 +498,23 @@ export const handler: PluginDefinition['handler'] = ({ let hasMutations = false; let hasQueries = false; + const processedOperations = new Map(); + for (const service of client.services) { for (const operation of service.operations) { - const queryFn = toOperationName(operation, true); + // track processed operations to avoid creating duplicates + const operationKey = getOperationKey(operation); + if (processedOperations.has(operationKey)) { + continue; + } + processedOperations.set(operationKey, true); + + const queryFn = [ + config.services.asClass && transformServiceName(service.name), + toOperationName(operation, !config.services.asClass), + ] + .filter(Boolean) + .join('.'); let hasUsedQueryFn = false; // queries @@ -1149,7 +1166,7 @@ export const handler: PluginDefinition['handler'] = ({ if (hasUsedQueryFn) { file.import({ module: servicesModulePath, - name: queryFn, + name: queryFn.split('.')[0], }); } } diff --git a/packages/openapi-ts/test/__snapshots__/3.1.0/index.ts b/packages/openapi-ts/test/__snapshots__/3.1.0/index.ts index 343d3c8f7..56bade120 100644 --- a/packages/openapi-ts/test/__snapshots__/3.1.0/index.ts +++ b/packages/openapi-ts/test/__snapshots__/3.1.0/index.ts @@ -1,2 +1,2 @@ // This file is auto-generated by @hey-api/openapi-ts -export * from './types.gen'; +export * from './types.gen'; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/react-query/asClass/@tanstack/react-query.gen.ts b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/react-query/asClass/@tanstack/react-query.gen.ts new file mode 100644 index 000000000..9cac1815e --- /dev/null +++ b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/react-query/asClass/@tanstack/react-query.gen.ts @@ -0,0 +1,997 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import type { Options } from '@hey-api/client-fetch'; +import { queryOptions, type UseMutationOptions, type DefaultError, infiniteQueryOptions, type InfiniteData } from '@tanstack/react-query'; +import type { CollectionFormatData, ComplexTypesData, ComplexParamsData, ComplexParamsError, ComplexParamsResponse, ImportData, ImportError, ImportResponse, GetApiVbyApiVersionSimpleOperationData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, DeprecatedCallData, CallWithDescriptionsData, TestErrorCodeData, TestErrorCodeError, TestErrorCodeResponse, FileResponseData, PostApiVbyApiVersionFormDataData, CallWithResultFromHeaderError, CallWithResultFromHeaderResponse, MultipartRequestData, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Error, NonAsciiæøåÆøÅöôêÊ字符串Response, PutWithFormUrlEncodedData, DeleteFooData3, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamData, PostCallWithOptionalParamError, PostCallWithOptionalParamResponse, PostApiVbyApiVersionRequestBodyData, CallWithDuplicateResponsesError, CallWithDuplicateResponsesResponse, CallWithResponsesError, CallWithResponsesResponse, TypesData, UploadFileData, UploadFileError, UploadFileResponse } from '../types.gen'; +import { client, CollectionFormatService, ComplexService, DefaultService, DefaultsService, DeprecatedService, DescriptionsService, DuplicateService, ErrorService, FileResponseService, FormDataService, HeaderService, MultipartService, MultipleTags1Service, NoContentService, NonAsciiÆøåÆøÅöôêÊService, ParametersService, RequestBodyService, ResponseService, SimpleService, TypesService, UploadService } from '../services.gen'; + +type QueryKey = [ + Pick & { + _id: string; + _infinite?: boolean; + } +]; + +const createQueryKey = (id: string, options?: TOptions, infinite?: boolean): QueryKey[0] => { + const params: QueryKey[0] = { _id: id, baseUrl: (options?.client ?? client).getConfig().baseUrl } as QueryKey[0]; + if (infinite) { + params._infinite = infinite; + } + if (options?.body) { + params.body = options.body; + } + if (options?.headers) { + params.headers = options.headers; + } + if (options?.path) { + params.path = options.path; + } + if (options?.query) { + params.query = options.query; + } + return params; +}; + +export const collectionFormatQueryKey = (options: Options) => [ + createQueryKey("collectionFormat", options) +]; + +export const collectionFormatOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await CollectionFormatService.collectionFormat({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: collectionFormatQueryKey(options) +}); }; + +export const complexTypesQueryKey = (options: Options) => [ + createQueryKey("complexTypes", options) +]; + +export const complexTypesOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await ComplexService.complexTypes({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: complexTypesQueryKey(options) +}); }; + +export const complexParamsMutation = () => { const mutationOptions: UseMutationOptions> = { + mutationFn: async (options) => { + const { data } = await ComplexService.complexParams({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const exportQueryKey = (options?: Options) => [ + createQueryKey("export", options) +]; + +export const exportOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await DefaultService.export({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: exportQueryKey(options) +}); }; + +export const importQueryKey = (options: Options) => [ + createQueryKey("import", options) +]; + +export const importOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await DefaultService.import({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: importQueryKey(options) +}); }; + +export const importMutation = () => { const mutationOptions: UseMutationOptions> = { + mutationFn: async (options) => { + const { data } = await DefaultService.import({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const getApiVbyApiVersionSimpleOperationQueryKey = (options: Options) => [ + createQueryKey("getApiVbyApiVersionSimpleOperation", options) +]; + +export const getApiVbyApiVersionSimpleOperationOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await DefaultService.getApiVbyApiVersionSimpleOperation({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: getApiVbyApiVersionSimpleOperationQueryKey(options) +}); }; + +export const callWithDefaultParametersQueryKey = (options?: Options) => [ + createQueryKey("callWithDefaultParameters", options) +]; + +export const callWithDefaultParametersOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await DefaultsService.callWithDefaultParameters({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: callWithDefaultParametersQueryKey(options) +}); }; + +export const callWithDefaultOptionalParametersQueryKey = (options?: Options) => [ + createQueryKey("callWithDefaultOptionalParameters", options) +]; + +export const callWithDefaultOptionalParametersOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await DefaultsService.callWithDefaultOptionalParameters({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: callWithDefaultOptionalParametersQueryKey(options) +}); }; + +export const callWithDefaultOptionalParametersMutation = () => { const mutationOptions: UseMutationOptions> = { + mutationFn: async (options) => { + const { data } = await DefaultsService.callWithDefaultOptionalParameters({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const callToTestOrderOfParamsMutation = () => { const mutationOptions: UseMutationOptions> = { + mutationFn: async (options) => { + const { data } = await DefaultsService.callToTestOrderOfParams({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const deprecatedCallQueryKey = (options: Options) => [ + createQueryKey("deprecatedCall", options) +]; + +export const deprecatedCallOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await DeprecatedService.deprecatedCall({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: deprecatedCallQueryKey(options) +}); }; + +export const deprecatedCallMutation = () => { const mutationOptions: UseMutationOptions> = { + mutationFn: async (options) => { + const { data } = await DeprecatedService.deprecatedCall({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const callWithDescriptionsQueryKey = (options?: Options) => [ + createQueryKey("callWithDescriptions", options) +]; + +export const callWithDescriptionsOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await DescriptionsService.callWithDescriptions({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: callWithDescriptionsQueryKey(options) +}); }; + +export const callWithDescriptionsMutation = () => { const mutationOptions: UseMutationOptions> = { + mutationFn: async (options) => { + const { data } = await DescriptionsService.callWithDescriptions({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const duplicateNameQueryKey = (options?: Options) => [ + createQueryKey("duplicateName", options) +]; + +export const duplicateNameOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await DuplicateService.duplicateName({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: duplicateNameQueryKey(options) +}); }; + +export const duplicateName1QueryKey = (options?: Options) => [ + createQueryKey("duplicateName1", options) +]; + +export const duplicateName1Options = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await DuplicateService.duplicateName1({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: duplicateName1QueryKey(options) +}); }; + +export const duplicateName1Mutation = () => { const mutationOptions: UseMutationOptions = { + mutationFn: async (options) => { + const { data } = await DuplicateService.duplicateName1({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const duplicateName2Mutation = () => { const mutationOptions: UseMutationOptions = { + mutationFn: async (options) => { + const { data } = await DuplicateService.duplicateName2({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const duplicateName3Mutation = () => { const mutationOptions: UseMutationOptions = { + mutationFn: async (options) => { + const { data } = await DuplicateService.duplicateName3({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const testErrorCodeQueryKey = (options: Options) => [ + createQueryKey("testErrorCode", options) +]; + +export const testErrorCodeOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await ErrorService.testErrorCode({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: testErrorCodeQueryKey(options) +}); }; + +export const testErrorCodeMutation = () => { const mutationOptions: UseMutationOptions> = { + mutationFn: async (options) => { + const { data } = await ErrorService.testErrorCode({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const fileResponseQueryKey = (options: Options) => [ + createQueryKey("fileResponse", options) +]; + +export const fileResponseOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await FileResponseService.fileResponse({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: fileResponseQueryKey(options) +}); }; + +export const postApiVbyApiVersionFormDataQueryKey = (options?: Options) => [ + createQueryKey("postApiVbyApiVersionFormData", options) +]; + +export const postApiVbyApiVersionFormDataOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await FormDataService.postApiVbyApiVersionFormData({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: postApiVbyApiVersionFormDataQueryKey(options) +}); }; + +export const postApiVbyApiVersionFormDataMutation = () => { const mutationOptions: UseMutationOptions> = { + mutationFn: async (options) => { + const { data } = await FormDataService.postApiVbyApiVersionFormData({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const callWithResultFromHeaderQueryKey = (options?: Options) => [ + createQueryKey("callWithResultFromHeader", options) +]; + +export const callWithResultFromHeaderOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await HeaderService.callWithResultFromHeader({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: callWithResultFromHeaderQueryKey(options) +}); }; + +export const callWithResultFromHeaderMutation = () => { const mutationOptions: UseMutationOptions = { + mutationFn: async (options) => { + const { data } = await HeaderService.callWithResultFromHeader({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const multipartRequestQueryKey = (options?: Options) => [ + createQueryKey("multipartRequest", options) +]; + +export const multipartRequestOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await MultipartService.multipartRequest({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: multipartRequestQueryKey(options) +}); }; + +export const multipartRequestMutation = () => { const mutationOptions: UseMutationOptions> = { + mutationFn: async (options) => { + const { data } = await MultipartService.multipartRequest({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const multipartResponseQueryKey = (options?: Options) => [ + createQueryKey("multipartResponse", options) +]; + +export const multipartResponseOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await MultipartService.multipartResponse({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: multipartResponseQueryKey(options) +}); }; + +export const dummyAQueryKey = (options?: Options) => [ + createQueryKey("dummyA", options) +]; + +export const dummyAOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await MultipleTags1Service.dummyA({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: dummyAQueryKey(options) +}); }; + +export const dummyBQueryKey = (options?: Options) => [ + createQueryKey("dummyB", options) +]; + +export const dummyBOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await MultipleTags1Service.dummyB({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: dummyBQueryKey(options) +}); }; + +export const callWithNoContentResponseQueryKey = (options?: Options) => [ + createQueryKey("callWithNoContentResponse", options) +]; + +export const callWithNoContentResponseOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await NoContentService.callWithNoContentResponse({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: callWithNoContentResponseQueryKey(options) +}); }; + +export const callWithResponseAndNoContentResponseQueryKey = (options?: Options) => [ + createQueryKey("callWithResponseAndNoContentResponse", options) +]; + +export const callWithResponseAndNoContentResponseOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await NoContentService.callWithResponseAndNoContentResponse({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: callWithResponseAndNoContentResponseQueryKey(options) +}); }; + +export const nonAsciiæøåÆøÅöôêÊ字符串QueryKey = (options: Options) => [ + createQueryKey("nonAsciiæøåÆøÅöôêÊ字符串", options) +]; + +export const nonAsciiæøåÆøÅöôêÊ字符串Options = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await NonAsciiÆøåÆøÅöôêÊService.nonAsciiæøåÆøÅöôêÊ字符串({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: nonAsciiæøåÆøÅöôêÊ字符串QueryKey(options) +}); }; + +export const nonAsciiæøåÆøÅöôêÊ字符串Mutation = () => { const mutationOptions: UseMutationOptions> = { + mutationFn: async (options) => { + const { data } = await NonAsciiÆøåÆøÅöôêÊService.nonAsciiæøåÆøÅöôêÊ字符串({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const putWithFormUrlEncodedMutation = () => { const mutationOptions: UseMutationOptions> = { + mutationFn: async (options) => { + const { data } = await NonAsciiÆøåÆøÅöôêÊService.putWithFormUrlEncoded({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const deleteFooMutation = () => { const mutationOptions: UseMutationOptions> = { + mutationFn: async (options) => { + const { data } = await ParametersService.deleteFoo({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const callWithParametersQueryKey = (options: Options) => [ + createQueryKey("callWithParameters", options) +]; + +export const callWithParametersOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await ParametersService.callWithParameters({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: callWithParametersQueryKey(options) +}); }; + +export const callWithParametersInfiniteQueryKey = (options: Options): QueryKey> => [ + createQueryKey("callWithParameters", options, true) +]; + +export const callWithParametersInfiniteOptions = (options: Options) => { return infiniteQueryOptions, QueryKey>, string | Pick>[0], 'body' | 'headers' | 'path' | 'query'>>( +// @ts-ignore +{ + queryFn: async ({ pageParam, queryKey }) => { + // @ts-ignore + const page: Pick>[0], 'body' | 'headers' | 'path' | 'query'> = typeof pageParam === "object" ? pageParam : { + query: { + cursor: pageParam + } + }; + const params: Partial> = {}; + if (page.body) { + params.body = { + ...queryKey[0].body as any, + ...page.body as any + }; + } + if (page.headers) { + params.headers = { + ...queryKey[0].headers, + ...page.headers + }; + } + if (page.path) { + params.path = { + ...queryKey[0].path, + ...page.path + }; + } + if (page.query) { + params.query = { + ...queryKey[0].query, + ...page.query + }; + } + const { data } = await ParametersService.callWithParameters({ + ...options, + ...queryKey[0], + ...params, + throwOnError: true + }); + return data; + }, + queryKey: callWithParametersInfiniteQueryKey(options) +}); }; + +export const callWithParametersMutation = () => { const mutationOptions: UseMutationOptions> = { + mutationFn: async (options) => { + const { data } = await ParametersService.callWithParameters({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const callWithWeirdParameterNamesQueryKey = (options: Options) => [ + createQueryKey("callWithWeirdParameterNames", options) +]; + +export const callWithWeirdParameterNamesOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await ParametersService.callWithWeirdParameterNames({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: callWithWeirdParameterNamesQueryKey(options) +}); }; + +export const callWithWeirdParameterNamesMutation = () => { const mutationOptions: UseMutationOptions> = { + mutationFn: async (options) => { + const { data } = await ParametersService.callWithWeirdParameterNames({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const getCallWithOptionalParamQueryKey = (options: Options) => [ + createQueryKey("getCallWithOptionalParam", options) +]; + +export const getCallWithOptionalParamOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await ParametersService.getCallWithOptionalParam({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: getCallWithOptionalParamQueryKey(options) +}); }; + +export const getCallWithOptionalParamInfiniteQueryKey = (options: Options): QueryKey> => [ + createQueryKey("getCallWithOptionalParam", options, true) +]; + +export const getCallWithOptionalParamInfiniteOptions = (options: Options) => { return infiniteQueryOptions, QueryKey>, number | Pick>[0], 'body' | 'headers' | 'path' | 'query'>>( +// @ts-ignore +{ + queryFn: async ({ pageParam, queryKey }) => { + // @ts-ignore + const page: Pick>[0], 'body' | 'headers' | 'path' | 'query'> = typeof pageParam === "object" ? pageParam : { + query: { + page: pageParam + } + }; + const params: Partial> = {}; + if (page.body) { + params.body = { + ...queryKey[0].body as any, + ...page.body as any + }; + } + if (page.headers) { + params.headers = { + ...queryKey[0].headers, + ...page.headers + }; + } + if (page.path) { + params.path = { + ...queryKey[0].path, + ...page.path + }; + } + if (page.query) { + params.query = { + ...queryKey[0].query, + ...page.query + }; + } + const { data } = await ParametersService.getCallWithOptionalParam({ + ...options, + ...queryKey[0], + ...params, + throwOnError: true + }); + return data; + }, + queryKey: getCallWithOptionalParamInfiniteQueryKey(options) +}); }; + +export const postCallWithOptionalParamQueryKey = (options: Options) => [ + createQueryKey("postCallWithOptionalParam", options) +]; + +export const postCallWithOptionalParamOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await ParametersService.postCallWithOptionalParam({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: postCallWithOptionalParamQueryKey(options) +}); }; + +export const postCallWithOptionalParamInfiniteQueryKey = (options: Options): QueryKey> => [ + createQueryKey("postCallWithOptionalParam", options, true) +]; + +export const postCallWithOptionalParamInfiniteOptions = (options: Options) => { return infiniteQueryOptions, QueryKey>, number | Pick>[0], 'body' | 'headers' | 'path' | 'query'>>( +// @ts-ignore +{ + queryFn: async ({ pageParam, queryKey }) => { + // @ts-ignore + const page: Pick>[0], 'body' | 'headers' | 'path' | 'query'> = typeof pageParam === "object" ? pageParam : { + body: { + offset: pageParam + } + }; + const params: Partial> = {}; + if (page.body) { + params.body = { + ...queryKey[0].body as any, + ...page.body as any + }; + } + if (page.headers) { + params.headers = { + ...queryKey[0].headers, + ...page.headers + }; + } + if (page.path) { + params.path = { + ...queryKey[0].path, + ...page.path + }; + } + if (page.query) { + params.query = { + ...queryKey[0].query, + ...page.query + }; + } + const { data } = await ParametersService.postCallWithOptionalParam({ + ...options, + ...queryKey[0], + ...params, + throwOnError: true + }); + return data; + }, + queryKey: postCallWithOptionalParamInfiniteQueryKey(options) +}); }; + +export const postCallWithOptionalParamMutation = () => { const mutationOptions: UseMutationOptions> = { + mutationFn: async (options) => { + const { data } = await ParametersService.postCallWithOptionalParam({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const postApiVbyApiVersionRequestBodyQueryKey = (options?: Options) => [ + createQueryKey("postApiVbyApiVersionRequestBody", options) +]; + +export const postApiVbyApiVersionRequestBodyOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await RequestBodyService.postApiVbyApiVersionRequestBody({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: postApiVbyApiVersionRequestBodyQueryKey(options) +}); }; + +export const postApiVbyApiVersionRequestBodyMutation = () => { const mutationOptions: UseMutationOptions> = { + mutationFn: async (options) => { + const { data } = await RequestBodyService.postApiVbyApiVersionRequestBody({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const callWithResponseQueryKey = (options?: Options) => [ + createQueryKey("callWithResponse", options) +]; + +export const callWithResponseOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await ResponseService.callWithResponse({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: callWithResponseQueryKey(options) +}); }; + +export const callWithDuplicateResponsesQueryKey = (options?: Options) => [ + createQueryKey("callWithDuplicateResponses", options) +]; + +export const callWithDuplicateResponsesOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await ResponseService.callWithDuplicateResponses({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: callWithDuplicateResponsesQueryKey(options) +}); }; + +export const callWithDuplicateResponsesMutation = () => { const mutationOptions: UseMutationOptions = { + mutationFn: async (options) => { + const { data } = await ResponseService.callWithDuplicateResponses({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const callWithResponsesMutation = () => { const mutationOptions: UseMutationOptions = { + mutationFn: async (options) => { + const { data } = await ResponseService.callWithResponses({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const apiVVersionOdataControllerCountQueryKey = (options?: Options) => [ + createQueryKey("apiVVersionOdataControllerCount", options) +]; + +export const apiVVersionOdataControllerCountOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await SimpleService.apiVVersionOdataControllerCount({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: apiVVersionOdataControllerCountQueryKey(options) +}); }; + +export const getCallWithoutParametersAndResponseQueryKey = (options?: Options) => [ + createQueryKey("getCallWithoutParametersAndResponse", options) +]; + +export const getCallWithoutParametersAndResponseOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await SimpleService.getCallWithoutParametersAndResponse({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: getCallWithoutParametersAndResponseQueryKey(options) +}); }; + +export const putCallWithoutParametersAndResponseMutation = () => { const mutationOptions: UseMutationOptions = { + mutationFn: async (options) => { + const { data } = await SimpleService.putCallWithoutParametersAndResponse({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const postCallWithoutParametersAndResponseQueryKey = (options?: Options) => [ + createQueryKey("postCallWithoutParametersAndResponse", options) +]; + +export const postCallWithoutParametersAndResponseOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await SimpleService.postCallWithoutParametersAndResponse({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: postCallWithoutParametersAndResponseQueryKey(options) +}); }; + +export const postCallWithoutParametersAndResponseMutation = () => { const mutationOptions: UseMutationOptions = { + mutationFn: async (options) => { + const { data } = await SimpleService.postCallWithoutParametersAndResponse({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const deleteCallWithoutParametersAndResponseMutation = () => { const mutationOptions: UseMutationOptions = { + mutationFn: async (options) => { + const { data } = await SimpleService.deleteCallWithoutParametersAndResponse({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const patchCallWithoutParametersAndResponseMutation = () => { const mutationOptions: UseMutationOptions = { + mutationFn: async (options) => { + const { data } = await SimpleService.patchCallWithoutParametersAndResponse({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const typesQueryKey = (options: Options) => [ + createQueryKey("types", options) +]; + +export const typesOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await TypesService.types({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: typesQueryKey(options) +}); }; + +export const uploadFileQueryKey = (options: Options) => [ + createQueryKey("uploadFile", options) +]; + +export const uploadFileOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await UploadService.uploadFile({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: uploadFileQueryKey(options) +}); }; + +export const uploadFileMutation = () => { const mutationOptions: UseMutationOptions> = { + mutationFn: async (options) => { + const { data } = await UploadService.uploadFile({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-react-query/index.ts.snap b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/react-query/asClass/index.ts similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-react-query/index.ts.snap rename to packages/openapi-ts/test/__snapshots__/plugins/@tanstack/react-query/asClass/index.ts diff --git a/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/react-query/asClass/services.gen.ts b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/react-query/asClass/services.gen.ts new file mode 100644 index 000000000..2b3087c92 --- /dev/null +++ b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/react-query/asClass/services.gen.ts @@ -0,0 +1,451 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { createClient, createConfig, type Options, formDataBodySerializer, urlSearchParamsBodySerializer } from '@hey-api/client-fetch'; +import type { ImportData, ImportError, ImportResponse, GetApiVbyApiVersionSimpleOperationData, GetApiVbyApiVersionSimpleOperationError, GetApiVbyApiVersionSimpleOperationResponse, ApiVversionOdataControllerCountError, ApiVversionOdataControllerCountResponse, DeleteFooData3, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamData, PostCallWithOptionalParamError, PostCallWithOptionalParamResponse, CallWithDescriptionsData, DeprecatedCallData, PostApiVbyApiVersionRequestBodyData, PostApiVbyApiVersionFormDataData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, CallWithNoContentResponseError, CallWithNoContentResponseResponse, CallWithResponseAndNoContentResponseError, CallWithResponseAndNoContentResponseResponse, CallWithResponseError, CallWithResponseResponse, CallWithDuplicateResponsesError, CallWithDuplicateResponsesResponse, CallWithResponsesError, CallWithResponsesResponse, DummyAError, DummyAResponse, DummyBError, DummyBResponse, CollectionFormatData, TypesData, TypesError, TypesResponse, UploadFileData, UploadFileError, UploadFileResponse, FileResponseData, FileResponseError, FileResponseResponse, ComplexTypesData, ComplexTypesError, ComplexTypesResponse, ComplexParamsData, ComplexParamsError, ComplexParamsResponse, MultipartRequestData, MultipartResponseError, MultipartResponseResponse, CallWithResultFromHeaderError, CallWithResultFromHeaderResponse, TestErrorCodeData, TestErrorCodeError, TestErrorCodeResponse, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Error, NonAsciiæøåÆøÅöôêÊ字符串Response, PutWithFormUrlEncodedData } from './types.gen'; + +export const client = createClient(createConfig()); + +export class DefaultService { + public static export(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/no-tag' + }); + } + + public static import(options: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/no-tag' + }); + } + + public static getApiVbyApiVersionSimpleOperation(options: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/simple:operation' + }); + } + +} + +export class SimpleService { + public static apiVVersionOdataControllerCount(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/simple/$count' + }); + } + + public static getCallWithoutParametersAndResponse(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/simple' + }); + } + + public static putCallWithoutParametersAndResponse(options?: Options) { + return (options?.client ?? client).put({ + ...options, + url: '/api/v{api-version}/simple' + }); + } + + public static postCallWithoutParametersAndResponse(options?: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/simple' + }); + } + + public static deleteCallWithoutParametersAndResponse(options?: Options) { + return (options?.client ?? client).delete({ + ...options, + url: '/api/v{api-version}/simple' + }); + } + + public static optionsCallWithoutParametersAndResponse(options?: Options) { + return (options?.client ?? client).options({ + ...options, + url: '/api/v{api-version}/simple' + }); + } + + public static headCallWithoutParametersAndResponse(options?: Options) { + return (options?.client ?? client).head({ + ...options, + url: '/api/v{api-version}/simple' + }); + } + + public static patchCallWithoutParametersAndResponse(options?: Options) { + return (options?.client ?? client).patch({ + ...options, + url: '/api/v{api-version}/simple' + }); + } + +} + +export class ParametersService { + public static deleteFoo(options: Options) { + return (options?.client ?? client).delete({ + ...options, + url: '/api/v{api-version}/foo/{foo_param}/bar/{BarParam}' + }); + } + + public static callWithParameters(options: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/parameters/{parameterPath}' + }); + } + + public static callWithWeirdParameterNames(options: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/parameters/{parameter.path.1}/{parameter-path-2}/{PARAMETER-PATH-3}' + }); + } + + public static getCallWithOptionalParam(options: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/parameters/' + }); + } + + public static postCallWithOptionalParam(options: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/parameters/' + }); + } + +} + +export class DescriptionsService { + public static callWithDescriptions(options?: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/descriptions/' + }); + } + +} + +export class DeprecatedService { + /** + * @deprecated + */ + public static deprecatedCall(options: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/parameters/deprecated' + }); + } + +} + +export class RequestBodyService { + public static postApiVbyApiVersionRequestBody(options?: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/requestBody/' + }); + } + +} + +export class FormDataService { + public static postApiVbyApiVersionFormData(options?: Options) { + return (options?.client ?? client).post({ + ...options, + ...formDataBodySerializer, + headers: { + 'Content-Type': null, + ...options?.headers + }, + url: '/api/v{api-version}/formData/' + }); + } + +} + +export class DefaultsService { + public static callWithDefaultParameters(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/defaults' + }); + } + + public static callWithDefaultOptionalParameters(options?: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/defaults' + }); + } + + public static callToTestOrderOfParams(options: Options) { + return (options?.client ?? client).put({ + ...options, + url: '/api/v{api-version}/defaults' + }); + } + +} + +export class DuplicateService { + public static duplicateName(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/duplicate' + }); + } + + public static duplicateName1(options?: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/duplicate' + }); + } + + public static duplicateName2(options?: Options) { + return (options?.client ?? client).put({ + ...options, + url: '/api/v{api-version}/duplicate' + }); + } + + public static duplicateName3(options?: Options) { + return (options?.client ?? client).delete({ + ...options, + url: '/api/v{api-version}/duplicate' + }); + } + +} + +export class NoContentService { + public static callWithNoContentResponse(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/no-content' + }); + } + + public static callWithResponseAndNoContentResponse(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/multiple-tags/response-and-no-content' + }); + } + +} + +export class ResponseService { + public static callWithResponseAndNoContentResponse(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/multiple-tags/response-and-no-content' + }); + } + + public static callWithResponse(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/response' + }); + } + + public static callWithDuplicateResponses(options?: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/response' + }); + } + + public static callWithResponses(options?: Options) { + return (options?.client ?? client).put({ + ...options, + url: '/api/v{api-version}/response' + }); + } + +} + +export class MultipleTags1Service { + public static dummyA(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/multiple-tags/a' + }); + } + + public static dummyB(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/multiple-tags/b' + }); + } + +} + +export class MultipleTags2Service { + public static dummyA(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/multiple-tags/a' + }); + } + + public static dummyB(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/multiple-tags/b' + }); + } + +} + +export class MultipleTags3Service { + public static dummyB(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/multiple-tags/b' + }); + } + +} + +export class CollectionFormatService { + public static collectionFormat(options: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/collectionFormat' + }); + } + +} + +export class TypesService { + public static types(options: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/types' + }); + } + +} + +export class UploadService { + public static uploadFile(options: Options) { + return (options?.client ?? client).post({ + ...options, + ...urlSearchParamsBodySerializer, + headers: { + 'Content-Type': 'application/x-www-form-urlencoded', + ...options?.headers + }, + url: '/api/v{api-version}/upload' + }); + } + +} + +export class FileResponseService { + public static fileResponse(options: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/file/{id}' + }); + } + +} + +export class ComplexService { + public static complexTypes(options: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/complex' + }); + } + + public static complexParams(options: Options) { + return (options?.client ?? client).put({ + ...options, + url: '/api/v{api-version}/complex/{id}' + }); + } + +} + +export class MultipartService { + public static multipartRequest(options?: Options) { + return (options?.client ?? client).post({ + ...options, + ...formDataBodySerializer, + headers: { + 'Content-Type': null, + ...options?.headers + }, + url: '/api/v{api-version}/multipart' + }); + } + + public static multipartResponse(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/multipart' + }); + } + +} + +export class HeaderService { + public static callWithResultFromHeader(options?: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/header' + }); + } + +} + +export class ErrorService { + public static testErrorCode(options: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/error' + }); + } + +} + +export class NonAsciiÆøåÆøÅöôêÊService { + public static nonAsciiæøåÆøÅöôêÊ字符串(options: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串' + }); + } + + /** + * Login User + */ + public static putWithFormUrlEncoded(options: Options) { + return (options?.client ?? client).put({ + ...options, + ...urlSearchParamsBodySerializer, + headers: { + 'Content-Type': 'application/x-www-form-urlencoded', + ...options?.headers + }, + url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串' + }); + } + +} \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-react-query/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/react-query/asClass/types.gen.ts similarity index 93% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-react-query/types.gen.ts.snap rename to packages/openapi-ts/test/__snapshots__/plugins/@tanstack/react-query/asClass/types.gen.ts index c0c16d891..a48ba3ea4 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-react-query/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/react-query/asClass/types.gen.ts @@ -91,54 +91,13 @@ export type SimpleStringWithPattern = (string) | null; */ export type EnumWithStrings = 'Success' | 'Warning' | 'Error' | "'Single Quote'" | '"Double Quotes"' | 'Non-ascii: øæåôöØÆÅÔÖ字符串'; -/** - * This is a simple enum with strings - */ -export const EnumWithStrings = { - SUCCESS: 'Success', - WARNING: 'Warning', - ERROR: 'Error', - _SINGLE_QUOTE_: "'Single Quote'", - _DOUBLE_QUOTES_: '"Double Quotes"', - 'NON_ASCII__ØÆÅÔÖ_ØÆÅÔÖ字符串': 'Non-ascii: øæåôöØÆÅÔÖ字符串' -} as const; - export type EnumWithReplacedCharacters = "'Single Quote'" | '"Double Quotes"' | 'øæåôöØÆÅÔÖ字符串' | 3.1 | ''; -export const EnumWithReplacedCharacters = { - _SINGLE_QUOTE_: "'Single Quote'", - _DOUBLE_QUOTES_: '"Double Quotes"', - 'ØÆÅÔÖ_ØÆÅÔÖ字符串': 'øæåôöØÆÅÔÖ字符串', - '_3.1': 3.1, - EMPTY_STRING: '' -} as const; - /** * This is a simple enum with numbers */ export type EnumWithNumbers = 1 | 2 | 3 | 1.1 | 1.2 | 1.3 | 100 | 200 | 300 | -100 | -200 | -300 | -1.1 | -1.2 | -1.3; -/** - * This is a simple enum with numbers - */ -export const EnumWithNumbers = { - '_1': 1, - '_2': 2, - '_3': 3, - '_1.1': 1.1, - '_1.2': 1.2, - '_1.3': 1.3, - '_100': 100, - '_200': 200, - '_300': 300, - '_-100': -100, - '_-200': -200, - '_-300': -300, - '_-1.1': -1.1, - '_-1.2': -1.2, - '_-1.3': -1.3 -} as const; - /** * Success=1,Warning=2,Error=3 */ @@ -149,32 +108,8 @@ export type EnumFromDescription = number; */ export type EnumWithExtensions = 200 | 400 | 500; -/** - * This is a simple enum with numbers - */ -export const EnumWithExtensions = { - /** - * Used when the status of something is successful - */ - CUSTOM_SUCCESS: 200, - /** - * Used when the status of something has a warning - */ - CUSTOM_WARNING: 400, - /** - * Used when the status of something has an error - */ - CUSTOM_ERROR: 500 -} as const; - export type EnumWithXEnumNames = 0 | 1 | 2; -export const EnumWithXEnumNames = { - zero: 0, - one: 1, - two: 2 -} as const; - /** * This is a simple array with numbers */ @@ -354,16 +289,6 @@ export type ModelWithNullableString = { */ export type foo_bar_enum = 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; -/** - * This is a simple enum with strings - */ -export const foo_bar_enum = { - SUCCESS: 'Success', - WARNING: 'Warning', - ERROR: 'Error', - 'ØÆÅ字符串': 'ØÆÅ字符串' -} as const; - /** * This is a model with one enum */ @@ -387,18 +312,6 @@ export type ModelWithEnum = { */ export type statusCode = '100' | '200 FOO' | '300 FOO_BAR' | '400 foo-bar' | '500 foo.bar' | '600 foo&bar'; -/** - * These are the HTTP error code enums - */ -export const statusCode = { - _100: '100', - _200_FOO: '200 FOO', - _300_FOO_BAR: '300 FOO_BAR', - _400_FOO_BAR: '400 foo-bar', - _500_FOO_BAR: '500 foo.bar', - _600_FOO_BAR: '600 foo&bar' -} as const; - /** * This is a model with one enum with escaped name */ @@ -408,10 +321,6 @@ export type ModelWithEnumWithHyphen = { export type foo_bar_baz_qux = '3.0'; -export const foo_bar_baz_qux = { - _3_0: '3.0' -} as const; - /** * This is a model with one enum */ @@ -555,11 +464,6 @@ export type CompositionWithNestedAnyAndTypeNull = { export type _3e_num_1Период = 'Bird' | 'Dog'; -export const _3e_num_1Период = { - BIRD: 'Bird', - DOG: 'Dog' -} as const; - export type ConstValue = "ConstValue"; /** @@ -830,24 +734,10 @@ export type ModelWithOneOfEnum = { export type foo = 'Bar'; -export const foo = { - BAR: 'Bar' -} as const; - export type ModelWithNestedArrayEnumsDataFoo = 'foo' | 'bar'; -export const ModelWithNestedArrayEnumsDataFoo = { - FOO: 'foo', - BAR: 'bar' -} as const; - export type ModelWithNestedArrayEnumsDataBar = 'baz' | 'qux'; -export const ModelWithNestedArrayEnumsDataBar = { - BAZ: 'baz', - QUX: 'qux' -} as const; - export type ModelWithNestedArrayEnumsData = { foo?: Array; bar?: Array; @@ -913,19 +803,6 @@ export type ModelWithNumericEnumUnion = { */ export type value = -10 | -1 | 0 | 1 | 3 | 6 | 12; -/** - * Период - */ -export const value = { - '_-10': -10, - '_-1': -1, - '_0': 0, - '_1': 1, - '_3': 3, - '_6': 6, - '_12': 12 -} as const; - /** * Some description with `back ticks` */ @@ -1097,10 +974,6 @@ export type ImportResponse = (Model_From_Zendesk | ModelWithReadOnlyAndWriteOnly export type ImportError = unknown; -export type ApiVversionOdataControllerCountResponse = (Model_From_Zendesk); - -export type ApiVversionOdataControllerCountError = unknown; - export type GetApiVbyApiVersionSimpleOperationData = { path: { /** @@ -1114,6 +987,10 @@ export type GetApiVbyApiVersionSimpleOperationResponse = (number); export type GetApiVbyApiVersionSimpleOperationError = (ModelWithBoolean); +export type ApiVversionOdataControllerCountResponse = (Model_From_Zendesk); + +export type ApiVversionOdataControllerCountError = unknown; + export type DeleteFooData3 = { headers: { /** @@ -1133,48 +1010,6 @@ export type DeleteFooData3 = { }; }; -export type CallWithDescriptionsData = { - query?: { - /** - * Testing backticks in string: `backticks` and ```multiple backticks``` should work - */ - parameterWithBackticks?: unknown; - /** - * Testing multiline comments in string: First line - * Second line - * - * Fourth line - */ - parameterWithBreaks?: unknown; - /** - * Testing expression placeholders in string: ${expression} should work - */ - parameterWithExpressionPlaceholders?: unknown; - /** - * Testing quotes in string: 'single quote''' and "double quotes""" should work - */ - parameterWithQuotes?: unknown; - /** - * Testing reserved characters in string: * inline * and ** inline ** should work - */ - parameterWithReservedCharacters?: unknown; - /** - * Testing slashes in string: \backwards\\\ and /forwards/// should work - */ - parameterWithSlashes?: unknown; - }; -}; - -export type DeprecatedCallData = { - headers: { - /** - * This parameter is deprecated - * @deprecated - */ - parameter: (DeprecatedModel) | null; - }; -}; - export type CallWithParametersData = { /** * This is the parameter that goes into the body @@ -1281,6 +1116,48 @@ export type PostCallWithOptionalParamResponse = (number | void); export type PostCallWithOptionalParamError = unknown; +export type CallWithDescriptionsData = { + query?: { + /** + * Testing backticks in string: `backticks` and ```multiple backticks``` should work + */ + parameterWithBackticks?: unknown; + /** + * Testing multiline comments in string: First line + * Second line + * + * Fourth line + */ + parameterWithBreaks?: unknown; + /** + * Testing expression placeholders in string: ${expression} should work + */ + parameterWithExpressionPlaceholders?: unknown; + /** + * Testing quotes in string: 'single quote''' and "double quotes""" should work + */ + parameterWithQuotes?: unknown; + /** + * Testing reserved characters in string: * inline * and ** inline ** should work + */ + parameterWithReservedCharacters?: unknown; + /** + * Testing slashes in string: \backwards\\\ and /forwards/// should work + */ + parameterWithSlashes?: unknown; + }; +}; + +export type DeprecatedCallData = { + headers: { + /** + * This parameter is deprecated + * @deprecated + */ + parameter: (DeprecatedModel) | null; + }; +}; + export type PostApiVbyApiVersionRequestBodyData = { /** * A reusable request body @@ -1402,14 +1279,6 @@ export type CallWithResponseAndNoContentResponseResponse = (number | void); export type CallWithResponseAndNoContentResponseError = unknown; -export type DummyAResponse = (_400); - -export type DummyAError = unknown; - -export type DummyBResponse = (void); - -export type DummyBError = unknown; - export type CallWithResponseResponse = (_import); export type CallWithResponseError = unknown; @@ -1426,6 +1295,14 @@ export type CallWithResponsesResponse = ({ export type CallWithResponsesError = (ModelWithStringError); +export type DummyAResponse = (_400); + +export type DummyAError = unknown; + +export type DummyBResponse = (void); + +export type DummyBError = unknown; + export type CollectionFormatData = { query: { /** @@ -1551,23 +1428,6 @@ export type ComplexTypesResponse = (Array); export type ComplexTypesError = (unknown); -export type MultipartRequestData = { - body?: { - content?: (Blob | File); - data?: ((ModelWithString) | null); - }; -}; - -export type MultipartResponseResponse = ({ - file?: (Blob | File); - metadata?: { - foo?: string; - bar?: string; - }; -}); - -export type MultipartResponseError = unknown; - export type ComplexParamsData = { body?: { readonly key: (string) | null; @@ -1595,6 +1455,23 @@ export type ComplexParamsResponse = (ModelWithString); export type ComplexParamsError = unknown; +export type MultipartRequestData = { + body?: { + content?: (Blob | File); + data?: ((ModelWithString) | null); + }; +}; + +export type MultipartResponseResponse = ({ + file?: (Blob | File); + metadata?: { + foo?: string; + bar?: string; + }; +}); + +export type MultipartResponseError = unknown; + export type CallWithResultFromHeaderResponse = (string); export type CallWithResultFromHeaderError = (unknown); diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-react-query/@tanstack/react-query.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/react-query/axios/@tanstack/react-query.gen.ts similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-react-query/@tanstack/react-query.gen.ts.snap rename to packages/openapi-ts/test/__snapshots__/plugins/@tanstack/react-query/axios/@tanstack/react-query.gen.ts diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-react-query_transform/index.ts.snap b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/react-query/axios/index.ts similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-react-query_transform/index.ts.snap rename to packages/openapi-ts/test/__snapshots__/plugins/@tanstack/react-query/axios/index.ts diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-react-query/services.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/react-query/axios/services.gen.ts similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-react-query/services.gen.ts.snap rename to packages/openapi-ts/test/__snapshots__/plugins/@tanstack/react-query/axios/services.gen.ts diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-solid-query/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/react-query/axios/types.gen.ts similarity index 93% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-solid-query/types.gen.ts.snap rename to packages/openapi-ts/test/__snapshots__/plugins/@tanstack/react-query/axios/types.gen.ts index c0c16d891..1989b3f22 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-solid-query/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/react-query/axios/types.gen.ts @@ -91,54 +91,13 @@ export type SimpleStringWithPattern = (string) | null; */ export type EnumWithStrings = 'Success' | 'Warning' | 'Error' | "'Single Quote'" | '"Double Quotes"' | 'Non-ascii: øæåôöØÆÅÔÖ字符串'; -/** - * This is a simple enum with strings - */ -export const EnumWithStrings = { - SUCCESS: 'Success', - WARNING: 'Warning', - ERROR: 'Error', - _SINGLE_QUOTE_: "'Single Quote'", - _DOUBLE_QUOTES_: '"Double Quotes"', - 'NON_ASCII__ØÆÅÔÖ_ØÆÅÔÖ字符串': 'Non-ascii: øæåôöØÆÅÔÖ字符串' -} as const; - export type EnumWithReplacedCharacters = "'Single Quote'" | '"Double Quotes"' | 'øæåôöØÆÅÔÖ字符串' | 3.1 | ''; -export const EnumWithReplacedCharacters = { - _SINGLE_QUOTE_: "'Single Quote'", - _DOUBLE_QUOTES_: '"Double Quotes"', - 'ØÆÅÔÖ_ØÆÅÔÖ字符串': 'øæåôöØÆÅÔÖ字符串', - '_3.1': 3.1, - EMPTY_STRING: '' -} as const; - /** * This is a simple enum with numbers */ export type EnumWithNumbers = 1 | 2 | 3 | 1.1 | 1.2 | 1.3 | 100 | 200 | 300 | -100 | -200 | -300 | -1.1 | -1.2 | -1.3; -/** - * This is a simple enum with numbers - */ -export const EnumWithNumbers = { - '_1': 1, - '_2': 2, - '_3': 3, - '_1.1': 1.1, - '_1.2': 1.2, - '_1.3': 1.3, - '_100': 100, - '_200': 200, - '_300': 300, - '_-100': -100, - '_-200': -200, - '_-300': -300, - '_-1.1': -1.1, - '_-1.2': -1.2, - '_-1.3': -1.3 -} as const; - /** * Success=1,Warning=2,Error=3 */ @@ -149,32 +108,8 @@ export type EnumFromDescription = number; */ export type EnumWithExtensions = 200 | 400 | 500; -/** - * This is a simple enum with numbers - */ -export const EnumWithExtensions = { - /** - * Used when the status of something is successful - */ - CUSTOM_SUCCESS: 200, - /** - * Used when the status of something has a warning - */ - CUSTOM_WARNING: 400, - /** - * Used when the status of something has an error - */ - CUSTOM_ERROR: 500 -} as const; - export type EnumWithXEnumNames = 0 | 1 | 2; -export const EnumWithXEnumNames = { - zero: 0, - one: 1, - two: 2 -} as const; - /** * This is a simple array with numbers */ @@ -354,16 +289,6 @@ export type ModelWithNullableString = { */ export type foo_bar_enum = 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; -/** - * This is a simple enum with strings - */ -export const foo_bar_enum = { - SUCCESS: 'Success', - WARNING: 'Warning', - ERROR: 'Error', - 'ØÆÅ字符串': 'ØÆÅ字符串' -} as const; - /** * This is a model with one enum */ @@ -387,18 +312,6 @@ export type ModelWithEnum = { */ export type statusCode = '100' | '200 FOO' | '300 FOO_BAR' | '400 foo-bar' | '500 foo.bar' | '600 foo&bar'; -/** - * These are the HTTP error code enums - */ -export const statusCode = { - _100: '100', - _200_FOO: '200 FOO', - _300_FOO_BAR: '300 FOO_BAR', - _400_FOO_BAR: '400 foo-bar', - _500_FOO_BAR: '500 foo.bar', - _600_FOO_BAR: '600 foo&bar' -} as const; - /** * This is a model with one enum with escaped name */ @@ -408,10 +321,6 @@ export type ModelWithEnumWithHyphen = { export type foo_bar_baz_qux = '3.0'; -export const foo_bar_baz_qux = { - _3_0: '3.0' -} as const; - /** * This is a model with one enum */ @@ -555,11 +464,6 @@ export type CompositionWithNestedAnyAndTypeNull = { export type _3e_num_1Период = 'Bird' | 'Dog'; -export const _3e_num_1Период = { - BIRD: 'Bird', - DOG: 'Dog' -} as const; - export type ConstValue = "ConstValue"; /** @@ -830,24 +734,10 @@ export type ModelWithOneOfEnum = { export type foo = 'Bar'; -export const foo = { - BAR: 'Bar' -} as const; - export type ModelWithNestedArrayEnumsDataFoo = 'foo' | 'bar'; -export const ModelWithNestedArrayEnumsDataFoo = { - FOO: 'foo', - BAR: 'bar' -} as const; - export type ModelWithNestedArrayEnumsDataBar = 'baz' | 'qux'; -export const ModelWithNestedArrayEnumsDataBar = { - BAZ: 'baz', - QUX: 'qux' -} as const; - export type ModelWithNestedArrayEnumsData = { foo?: Array; bar?: Array; @@ -913,19 +803,6 @@ export type ModelWithNumericEnumUnion = { */ export type value = -10 | -1 | 0 | 1 | 3 | 6 | 12; -/** - * Период - */ -export const value = { - '_-10': -10, - '_-1': -1, - '_0': 0, - '_1': 1, - '_3': 3, - '_6': 6, - '_12': 12 -} as const; - /** * Some description with `back ticks` */ diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-react-query/@tanstack/react-query.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/react-query/fetch/@tanstack/react-query.gen.ts similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-react-query/@tanstack/react-query.gen.ts.snap rename to packages/openapi-ts/test/__snapshots__/plugins/@tanstack/react-query/fetch/@tanstack/react-query.gen.ts diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-solid-query/index.ts.snap b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/react-query/fetch/index.ts similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-solid-query/index.ts.snap rename to packages/openapi-ts/test/__snapshots__/plugins/@tanstack/react-query/fetch/index.ts diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-react-query/services.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/react-query/fetch/services.gen.ts similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-react-query/services.gen.ts.snap rename to packages/openapi-ts/test/__snapshots__/plugins/@tanstack/react-query/fetch/services.gen.ts diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-svelte-query/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/react-query/fetch/types.gen.ts similarity index 93% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-svelte-query/types.gen.ts.snap rename to packages/openapi-ts/test/__snapshots__/plugins/@tanstack/react-query/fetch/types.gen.ts index c0c16d891..1989b3f22 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-svelte-query/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/react-query/fetch/types.gen.ts @@ -91,54 +91,13 @@ export type SimpleStringWithPattern = (string) | null; */ export type EnumWithStrings = 'Success' | 'Warning' | 'Error' | "'Single Quote'" | '"Double Quotes"' | 'Non-ascii: øæåôöØÆÅÔÖ字符串'; -/** - * This is a simple enum with strings - */ -export const EnumWithStrings = { - SUCCESS: 'Success', - WARNING: 'Warning', - ERROR: 'Error', - _SINGLE_QUOTE_: "'Single Quote'", - _DOUBLE_QUOTES_: '"Double Quotes"', - 'NON_ASCII__ØÆÅÔÖ_ØÆÅÔÖ字符串': 'Non-ascii: øæåôöØÆÅÔÖ字符串' -} as const; - export type EnumWithReplacedCharacters = "'Single Quote'" | '"Double Quotes"' | 'øæåôöØÆÅÔÖ字符串' | 3.1 | ''; -export const EnumWithReplacedCharacters = { - _SINGLE_QUOTE_: "'Single Quote'", - _DOUBLE_QUOTES_: '"Double Quotes"', - 'ØÆÅÔÖ_ØÆÅÔÖ字符串': 'øæåôöØÆÅÔÖ字符串', - '_3.1': 3.1, - EMPTY_STRING: '' -} as const; - /** * This is a simple enum with numbers */ export type EnumWithNumbers = 1 | 2 | 3 | 1.1 | 1.2 | 1.3 | 100 | 200 | 300 | -100 | -200 | -300 | -1.1 | -1.2 | -1.3; -/** - * This is a simple enum with numbers - */ -export const EnumWithNumbers = { - '_1': 1, - '_2': 2, - '_3': 3, - '_1.1': 1.1, - '_1.2': 1.2, - '_1.3': 1.3, - '_100': 100, - '_200': 200, - '_300': 300, - '_-100': -100, - '_-200': -200, - '_-300': -300, - '_-1.1': -1.1, - '_-1.2': -1.2, - '_-1.3': -1.3 -} as const; - /** * Success=1,Warning=2,Error=3 */ @@ -149,32 +108,8 @@ export type EnumFromDescription = number; */ export type EnumWithExtensions = 200 | 400 | 500; -/** - * This is a simple enum with numbers - */ -export const EnumWithExtensions = { - /** - * Used when the status of something is successful - */ - CUSTOM_SUCCESS: 200, - /** - * Used when the status of something has a warning - */ - CUSTOM_WARNING: 400, - /** - * Used when the status of something has an error - */ - CUSTOM_ERROR: 500 -} as const; - export type EnumWithXEnumNames = 0 | 1 | 2; -export const EnumWithXEnumNames = { - zero: 0, - one: 1, - two: 2 -} as const; - /** * This is a simple array with numbers */ @@ -354,16 +289,6 @@ export type ModelWithNullableString = { */ export type foo_bar_enum = 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; -/** - * This is a simple enum with strings - */ -export const foo_bar_enum = { - SUCCESS: 'Success', - WARNING: 'Warning', - ERROR: 'Error', - 'ØÆÅ字符串': 'ØÆÅ字符串' -} as const; - /** * This is a model with one enum */ @@ -387,18 +312,6 @@ export type ModelWithEnum = { */ export type statusCode = '100' | '200 FOO' | '300 FOO_BAR' | '400 foo-bar' | '500 foo.bar' | '600 foo&bar'; -/** - * These are the HTTP error code enums - */ -export const statusCode = { - _100: '100', - _200_FOO: '200 FOO', - _300_FOO_BAR: '300 FOO_BAR', - _400_FOO_BAR: '400 foo-bar', - _500_FOO_BAR: '500 foo.bar', - _600_FOO_BAR: '600 foo&bar' -} as const; - /** * This is a model with one enum with escaped name */ @@ -408,10 +321,6 @@ export type ModelWithEnumWithHyphen = { export type foo_bar_baz_qux = '3.0'; -export const foo_bar_baz_qux = { - _3_0: '3.0' -} as const; - /** * This is a model with one enum */ @@ -555,11 +464,6 @@ export type CompositionWithNestedAnyAndTypeNull = { export type _3e_num_1Период = 'Bird' | 'Dog'; -export const _3e_num_1Период = { - BIRD: 'Bird', - DOG: 'Dog' -} as const; - export type ConstValue = "ConstValue"; /** @@ -830,24 +734,10 @@ export type ModelWithOneOfEnum = { export type foo = 'Bar'; -export const foo = { - BAR: 'Bar' -} as const; - export type ModelWithNestedArrayEnumsDataFoo = 'foo' | 'bar'; -export const ModelWithNestedArrayEnumsDataFoo = { - FOO: 'foo', - BAR: 'bar' -} as const; - export type ModelWithNestedArrayEnumsDataBar = 'baz' | 'qux'; -export const ModelWithNestedArrayEnumsDataBar = { - BAZ: 'baz', - QUX: 'qux' -} as const; - export type ModelWithNestedArrayEnumsData = { foo?: Array; bar?: Array; @@ -913,19 +803,6 @@ export type ModelWithNumericEnumUnion = { */ export type value = -10 | -1 | 0 | 1 | 3 | 6 | 12; -/** - * Период - */ -export const value = { - '_-10': -10, - '_-1': -1, - '_0': 0, - '_1': 1, - '_3': 3, - '_6': 6, - '_12': 12 -} as const; - /** * Some description with `back ticks` */ diff --git a/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/solid-query/asClass/@tanstack/solid-query.gen.ts b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/solid-query/asClass/@tanstack/solid-query.gen.ts new file mode 100644 index 000000000..c746f7155 --- /dev/null +++ b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/solid-query/asClass/@tanstack/solid-query.gen.ts @@ -0,0 +1,997 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import type { Options } from '@hey-api/client-fetch'; +import { queryOptions, type MutationOptions, type DefaultError, infiniteQueryOptions, type InfiniteData } from '@tanstack/solid-query'; +import type { CollectionFormatData, ComplexTypesData, ComplexParamsData, ComplexParamsError, ComplexParamsResponse, ImportData, ImportError, ImportResponse, GetApiVbyApiVersionSimpleOperationData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, DeprecatedCallData, CallWithDescriptionsData, TestErrorCodeData, TestErrorCodeError, TestErrorCodeResponse, FileResponseData, PostApiVbyApiVersionFormDataData, CallWithResultFromHeaderError, CallWithResultFromHeaderResponse, MultipartRequestData, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Error, NonAsciiæøåÆøÅöôêÊ字符串Response, PutWithFormUrlEncodedData, DeleteFooData3, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamData, PostCallWithOptionalParamError, PostCallWithOptionalParamResponse, PostApiVbyApiVersionRequestBodyData, CallWithDuplicateResponsesError, CallWithDuplicateResponsesResponse, CallWithResponsesError, CallWithResponsesResponse, TypesData, UploadFileData, UploadFileError, UploadFileResponse } from '../types.gen'; +import { client, CollectionFormatService, ComplexService, DefaultService, DefaultsService, DeprecatedService, DescriptionsService, DuplicateService, ErrorService, FileResponseService, FormDataService, HeaderService, MultipartService, MultipleTags1Service, NoContentService, NonAsciiÆøåÆøÅöôêÊService, ParametersService, RequestBodyService, ResponseService, SimpleService, TypesService, UploadService } from '../services.gen'; + +type QueryKey = [ + Pick & { + _id: string; + _infinite?: boolean; + } +]; + +const createQueryKey = (id: string, options?: TOptions, infinite?: boolean): QueryKey[0] => { + const params: QueryKey[0] = { _id: id, baseUrl: (options?.client ?? client).getConfig().baseUrl } as QueryKey[0]; + if (infinite) { + params._infinite = infinite; + } + if (options?.body) { + params.body = options.body; + } + if (options?.headers) { + params.headers = options.headers; + } + if (options?.path) { + params.path = options.path; + } + if (options?.query) { + params.query = options.query; + } + return params; +}; + +export const collectionFormatQueryKey = (options: Options) => [ + createQueryKey("collectionFormat", options) +]; + +export const collectionFormatOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await CollectionFormatService.collectionFormat({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: collectionFormatQueryKey(options) +}); }; + +export const complexTypesQueryKey = (options: Options) => [ + createQueryKey("complexTypes", options) +]; + +export const complexTypesOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await ComplexService.complexTypes({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: complexTypesQueryKey(options) +}); }; + +export const complexParamsMutation = () => { const mutationOptions: MutationOptions> = { + mutationFn: async (options) => { + const { data } = await ComplexService.complexParams({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const exportQueryKey = (options?: Options) => [ + createQueryKey("export", options) +]; + +export const exportOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await DefaultService.export({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: exportQueryKey(options) +}); }; + +export const importQueryKey = (options: Options) => [ + createQueryKey("import", options) +]; + +export const importOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await DefaultService.import({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: importQueryKey(options) +}); }; + +export const importMutation = () => { const mutationOptions: MutationOptions> = { + mutationFn: async (options) => { + const { data } = await DefaultService.import({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const getApiVbyApiVersionSimpleOperationQueryKey = (options: Options) => [ + createQueryKey("getApiVbyApiVersionSimpleOperation", options) +]; + +export const getApiVbyApiVersionSimpleOperationOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await DefaultService.getApiVbyApiVersionSimpleOperation({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: getApiVbyApiVersionSimpleOperationQueryKey(options) +}); }; + +export const callWithDefaultParametersQueryKey = (options?: Options) => [ + createQueryKey("callWithDefaultParameters", options) +]; + +export const callWithDefaultParametersOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await DefaultsService.callWithDefaultParameters({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: callWithDefaultParametersQueryKey(options) +}); }; + +export const callWithDefaultOptionalParametersQueryKey = (options?: Options) => [ + createQueryKey("callWithDefaultOptionalParameters", options) +]; + +export const callWithDefaultOptionalParametersOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await DefaultsService.callWithDefaultOptionalParameters({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: callWithDefaultOptionalParametersQueryKey(options) +}); }; + +export const callWithDefaultOptionalParametersMutation = () => { const mutationOptions: MutationOptions> = { + mutationFn: async (options) => { + const { data } = await DefaultsService.callWithDefaultOptionalParameters({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const callToTestOrderOfParamsMutation = () => { const mutationOptions: MutationOptions> = { + mutationFn: async (options) => { + const { data } = await DefaultsService.callToTestOrderOfParams({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const deprecatedCallQueryKey = (options: Options) => [ + createQueryKey("deprecatedCall", options) +]; + +export const deprecatedCallOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await DeprecatedService.deprecatedCall({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: deprecatedCallQueryKey(options) +}); }; + +export const deprecatedCallMutation = () => { const mutationOptions: MutationOptions> = { + mutationFn: async (options) => { + const { data } = await DeprecatedService.deprecatedCall({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const callWithDescriptionsQueryKey = (options?: Options) => [ + createQueryKey("callWithDescriptions", options) +]; + +export const callWithDescriptionsOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await DescriptionsService.callWithDescriptions({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: callWithDescriptionsQueryKey(options) +}); }; + +export const callWithDescriptionsMutation = () => { const mutationOptions: MutationOptions> = { + mutationFn: async (options) => { + const { data } = await DescriptionsService.callWithDescriptions({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const duplicateNameQueryKey = (options?: Options) => [ + createQueryKey("duplicateName", options) +]; + +export const duplicateNameOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await DuplicateService.duplicateName({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: duplicateNameQueryKey(options) +}); }; + +export const duplicateName1QueryKey = (options?: Options) => [ + createQueryKey("duplicateName1", options) +]; + +export const duplicateName1Options = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await DuplicateService.duplicateName1({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: duplicateName1QueryKey(options) +}); }; + +export const duplicateName1Mutation = () => { const mutationOptions: MutationOptions = { + mutationFn: async (options) => { + const { data } = await DuplicateService.duplicateName1({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const duplicateName2Mutation = () => { const mutationOptions: MutationOptions = { + mutationFn: async (options) => { + const { data } = await DuplicateService.duplicateName2({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const duplicateName3Mutation = () => { const mutationOptions: MutationOptions = { + mutationFn: async (options) => { + const { data } = await DuplicateService.duplicateName3({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const testErrorCodeQueryKey = (options: Options) => [ + createQueryKey("testErrorCode", options) +]; + +export const testErrorCodeOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await ErrorService.testErrorCode({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: testErrorCodeQueryKey(options) +}); }; + +export const testErrorCodeMutation = () => { const mutationOptions: MutationOptions> = { + mutationFn: async (options) => { + const { data } = await ErrorService.testErrorCode({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const fileResponseQueryKey = (options: Options) => [ + createQueryKey("fileResponse", options) +]; + +export const fileResponseOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await FileResponseService.fileResponse({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: fileResponseQueryKey(options) +}); }; + +export const postApiVbyApiVersionFormDataQueryKey = (options?: Options) => [ + createQueryKey("postApiVbyApiVersionFormData", options) +]; + +export const postApiVbyApiVersionFormDataOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await FormDataService.postApiVbyApiVersionFormData({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: postApiVbyApiVersionFormDataQueryKey(options) +}); }; + +export const postApiVbyApiVersionFormDataMutation = () => { const mutationOptions: MutationOptions> = { + mutationFn: async (options) => { + const { data } = await FormDataService.postApiVbyApiVersionFormData({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const callWithResultFromHeaderQueryKey = (options?: Options) => [ + createQueryKey("callWithResultFromHeader", options) +]; + +export const callWithResultFromHeaderOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await HeaderService.callWithResultFromHeader({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: callWithResultFromHeaderQueryKey(options) +}); }; + +export const callWithResultFromHeaderMutation = () => { const mutationOptions: MutationOptions = { + mutationFn: async (options) => { + const { data } = await HeaderService.callWithResultFromHeader({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const multipartRequestQueryKey = (options?: Options) => [ + createQueryKey("multipartRequest", options) +]; + +export const multipartRequestOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await MultipartService.multipartRequest({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: multipartRequestQueryKey(options) +}); }; + +export const multipartRequestMutation = () => { const mutationOptions: MutationOptions> = { + mutationFn: async (options) => { + const { data } = await MultipartService.multipartRequest({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const multipartResponseQueryKey = (options?: Options) => [ + createQueryKey("multipartResponse", options) +]; + +export const multipartResponseOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await MultipartService.multipartResponse({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: multipartResponseQueryKey(options) +}); }; + +export const dummyAQueryKey = (options?: Options) => [ + createQueryKey("dummyA", options) +]; + +export const dummyAOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await MultipleTags1Service.dummyA({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: dummyAQueryKey(options) +}); }; + +export const dummyBQueryKey = (options?: Options) => [ + createQueryKey("dummyB", options) +]; + +export const dummyBOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await MultipleTags1Service.dummyB({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: dummyBQueryKey(options) +}); }; + +export const callWithNoContentResponseQueryKey = (options?: Options) => [ + createQueryKey("callWithNoContentResponse", options) +]; + +export const callWithNoContentResponseOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await NoContentService.callWithNoContentResponse({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: callWithNoContentResponseQueryKey(options) +}); }; + +export const callWithResponseAndNoContentResponseQueryKey = (options?: Options) => [ + createQueryKey("callWithResponseAndNoContentResponse", options) +]; + +export const callWithResponseAndNoContentResponseOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await NoContentService.callWithResponseAndNoContentResponse({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: callWithResponseAndNoContentResponseQueryKey(options) +}); }; + +export const nonAsciiæøåÆøÅöôêÊ字符串QueryKey = (options: Options) => [ + createQueryKey("nonAsciiæøåÆøÅöôêÊ字符串", options) +]; + +export const nonAsciiæøåÆøÅöôêÊ字符串Options = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await NonAsciiÆøåÆøÅöôêÊService.nonAsciiæøåÆøÅöôêÊ字符串({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: nonAsciiæøåÆøÅöôêÊ字符串QueryKey(options) +}); }; + +export const nonAsciiæøåÆøÅöôêÊ字符串Mutation = () => { const mutationOptions: MutationOptions> = { + mutationFn: async (options) => { + const { data } = await NonAsciiÆøåÆøÅöôêÊService.nonAsciiæøåÆøÅöôêÊ字符串({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const putWithFormUrlEncodedMutation = () => { const mutationOptions: MutationOptions> = { + mutationFn: async (options) => { + const { data } = await NonAsciiÆøåÆøÅöôêÊService.putWithFormUrlEncoded({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const deleteFooMutation = () => { const mutationOptions: MutationOptions> = { + mutationFn: async (options) => { + const { data } = await ParametersService.deleteFoo({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const callWithParametersQueryKey = (options: Options) => [ + createQueryKey("callWithParameters", options) +]; + +export const callWithParametersOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await ParametersService.callWithParameters({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: callWithParametersQueryKey(options) +}); }; + +export const callWithParametersInfiniteQueryKey = (options: Options): QueryKey> => [ + createQueryKey("callWithParameters", options, true) +]; + +export const callWithParametersInfiniteOptions = (options: Options) => { return infiniteQueryOptions, QueryKey>, string | Pick>[0], 'body' | 'headers' | 'path' | 'query'>>( +// @ts-ignore +{ + queryFn: async ({ pageParam, queryKey }) => { + // @ts-ignore + const page: Pick>[0], 'body' | 'headers' | 'path' | 'query'> = typeof pageParam === "object" ? pageParam : { + query: { + cursor: pageParam + } + }; + const params: Partial> = {}; + if (page.body) { + params.body = { + ...queryKey[0].body as any, + ...page.body as any + }; + } + if (page.headers) { + params.headers = { + ...queryKey[0].headers, + ...page.headers + }; + } + if (page.path) { + params.path = { + ...queryKey[0].path, + ...page.path + }; + } + if (page.query) { + params.query = { + ...queryKey[0].query, + ...page.query + }; + } + const { data } = await ParametersService.callWithParameters({ + ...options, + ...queryKey[0], + ...params, + throwOnError: true + }); + return data; + }, + queryKey: callWithParametersInfiniteQueryKey(options) +}); }; + +export const callWithParametersMutation = () => { const mutationOptions: MutationOptions> = { + mutationFn: async (options) => { + const { data } = await ParametersService.callWithParameters({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const callWithWeirdParameterNamesQueryKey = (options: Options) => [ + createQueryKey("callWithWeirdParameterNames", options) +]; + +export const callWithWeirdParameterNamesOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await ParametersService.callWithWeirdParameterNames({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: callWithWeirdParameterNamesQueryKey(options) +}); }; + +export const callWithWeirdParameterNamesMutation = () => { const mutationOptions: MutationOptions> = { + mutationFn: async (options) => { + const { data } = await ParametersService.callWithWeirdParameterNames({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const getCallWithOptionalParamQueryKey = (options: Options) => [ + createQueryKey("getCallWithOptionalParam", options) +]; + +export const getCallWithOptionalParamOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await ParametersService.getCallWithOptionalParam({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: getCallWithOptionalParamQueryKey(options) +}); }; + +export const getCallWithOptionalParamInfiniteQueryKey = (options: Options): QueryKey> => [ + createQueryKey("getCallWithOptionalParam", options, true) +]; + +export const getCallWithOptionalParamInfiniteOptions = (options: Options) => { return infiniteQueryOptions, QueryKey>, number | Pick>[0], 'body' | 'headers' | 'path' | 'query'>>( +// @ts-ignore +{ + queryFn: async ({ pageParam, queryKey }) => { + // @ts-ignore + const page: Pick>[0], 'body' | 'headers' | 'path' | 'query'> = typeof pageParam === "object" ? pageParam : { + query: { + page: pageParam + } + }; + const params: Partial> = {}; + if (page.body) { + params.body = { + ...queryKey[0].body as any, + ...page.body as any + }; + } + if (page.headers) { + params.headers = { + ...queryKey[0].headers, + ...page.headers + }; + } + if (page.path) { + params.path = { + ...queryKey[0].path, + ...page.path + }; + } + if (page.query) { + params.query = { + ...queryKey[0].query, + ...page.query + }; + } + const { data } = await ParametersService.getCallWithOptionalParam({ + ...options, + ...queryKey[0], + ...params, + throwOnError: true + }); + return data; + }, + queryKey: getCallWithOptionalParamInfiniteQueryKey(options) +}); }; + +export const postCallWithOptionalParamQueryKey = (options: Options) => [ + createQueryKey("postCallWithOptionalParam", options) +]; + +export const postCallWithOptionalParamOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await ParametersService.postCallWithOptionalParam({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: postCallWithOptionalParamQueryKey(options) +}); }; + +export const postCallWithOptionalParamInfiniteQueryKey = (options: Options): QueryKey> => [ + createQueryKey("postCallWithOptionalParam", options, true) +]; + +export const postCallWithOptionalParamInfiniteOptions = (options: Options) => { return infiniteQueryOptions, QueryKey>, number | Pick>[0], 'body' | 'headers' | 'path' | 'query'>>( +// @ts-ignore +{ + queryFn: async ({ pageParam, queryKey }) => { + // @ts-ignore + const page: Pick>[0], 'body' | 'headers' | 'path' | 'query'> = typeof pageParam === "object" ? pageParam : { + body: { + offset: pageParam + } + }; + const params: Partial> = {}; + if (page.body) { + params.body = { + ...queryKey[0].body as any, + ...page.body as any + }; + } + if (page.headers) { + params.headers = { + ...queryKey[0].headers, + ...page.headers + }; + } + if (page.path) { + params.path = { + ...queryKey[0].path, + ...page.path + }; + } + if (page.query) { + params.query = { + ...queryKey[0].query, + ...page.query + }; + } + const { data } = await ParametersService.postCallWithOptionalParam({ + ...options, + ...queryKey[0], + ...params, + throwOnError: true + }); + return data; + }, + queryKey: postCallWithOptionalParamInfiniteQueryKey(options) +}); }; + +export const postCallWithOptionalParamMutation = () => { const mutationOptions: MutationOptions> = { + mutationFn: async (options) => { + const { data } = await ParametersService.postCallWithOptionalParam({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const postApiVbyApiVersionRequestBodyQueryKey = (options?: Options) => [ + createQueryKey("postApiVbyApiVersionRequestBody", options) +]; + +export const postApiVbyApiVersionRequestBodyOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await RequestBodyService.postApiVbyApiVersionRequestBody({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: postApiVbyApiVersionRequestBodyQueryKey(options) +}); }; + +export const postApiVbyApiVersionRequestBodyMutation = () => { const mutationOptions: MutationOptions> = { + mutationFn: async (options) => { + const { data } = await RequestBodyService.postApiVbyApiVersionRequestBody({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const callWithResponseQueryKey = (options?: Options) => [ + createQueryKey("callWithResponse", options) +]; + +export const callWithResponseOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await ResponseService.callWithResponse({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: callWithResponseQueryKey(options) +}); }; + +export const callWithDuplicateResponsesQueryKey = (options?: Options) => [ + createQueryKey("callWithDuplicateResponses", options) +]; + +export const callWithDuplicateResponsesOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await ResponseService.callWithDuplicateResponses({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: callWithDuplicateResponsesQueryKey(options) +}); }; + +export const callWithDuplicateResponsesMutation = () => { const mutationOptions: MutationOptions = { + mutationFn: async (options) => { + const { data } = await ResponseService.callWithDuplicateResponses({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const callWithResponsesMutation = () => { const mutationOptions: MutationOptions = { + mutationFn: async (options) => { + const { data } = await ResponseService.callWithResponses({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const apiVVersionOdataControllerCountQueryKey = (options?: Options) => [ + createQueryKey("apiVVersionOdataControllerCount", options) +]; + +export const apiVVersionOdataControllerCountOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await SimpleService.apiVVersionOdataControllerCount({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: apiVVersionOdataControllerCountQueryKey(options) +}); }; + +export const getCallWithoutParametersAndResponseQueryKey = (options?: Options) => [ + createQueryKey("getCallWithoutParametersAndResponse", options) +]; + +export const getCallWithoutParametersAndResponseOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await SimpleService.getCallWithoutParametersAndResponse({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: getCallWithoutParametersAndResponseQueryKey(options) +}); }; + +export const putCallWithoutParametersAndResponseMutation = () => { const mutationOptions: MutationOptions = { + mutationFn: async (options) => { + const { data } = await SimpleService.putCallWithoutParametersAndResponse({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const postCallWithoutParametersAndResponseQueryKey = (options?: Options) => [ + createQueryKey("postCallWithoutParametersAndResponse", options) +]; + +export const postCallWithoutParametersAndResponseOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await SimpleService.postCallWithoutParametersAndResponse({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: postCallWithoutParametersAndResponseQueryKey(options) +}); }; + +export const postCallWithoutParametersAndResponseMutation = () => { const mutationOptions: MutationOptions = { + mutationFn: async (options) => { + const { data } = await SimpleService.postCallWithoutParametersAndResponse({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const deleteCallWithoutParametersAndResponseMutation = () => { const mutationOptions: MutationOptions = { + mutationFn: async (options) => { + const { data } = await SimpleService.deleteCallWithoutParametersAndResponse({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const patchCallWithoutParametersAndResponseMutation = () => { const mutationOptions: MutationOptions = { + mutationFn: async (options) => { + const { data } = await SimpleService.patchCallWithoutParametersAndResponse({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const typesQueryKey = (options: Options) => [ + createQueryKey("types", options) +]; + +export const typesOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await TypesService.types({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: typesQueryKey(options) +}); }; + +export const uploadFileQueryKey = (options: Options) => [ + createQueryKey("uploadFile", options) +]; + +export const uploadFileOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await UploadService.uploadFile({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: uploadFileQueryKey(options) +}); }; + +export const uploadFileMutation = () => { const mutationOptions: MutationOptions> = { + mutationFn: async (options) => { + const { data } = await UploadService.uploadFile({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-solid-query_transform/index.ts.snap b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/solid-query/asClass/index.ts similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-solid-query_transform/index.ts.snap rename to packages/openapi-ts/test/__snapshots__/plugins/@tanstack/solid-query/asClass/index.ts diff --git a/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/solid-query/asClass/services.gen.ts b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/solid-query/asClass/services.gen.ts new file mode 100644 index 000000000..2b3087c92 --- /dev/null +++ b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/solid-query/asClass/services.gen.ts @@ -0,0 +1,451 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { createClient, createConfig, type Options, formDataBodySerializer, urlSearchParamsBodySerializer } from '@hey-api/client-fetch'; +import type { ImportData, ImportError, ImportResponse, GetApiVbyApiVersionSimpleOperationData, GetApiVbyApiVersionSimpleOperationError, GetApiVbyApiVersionSimpleOperationResponse, ApiVversionOdataControllerCountError, ApiVversionOdataControllerCountResponse, DeleteFooData3, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamData, PostCallWithOptionalParamError, PostCallWithOptionalParamResponse, CallWithDescriptionsData, DeprecatedCallData, PostApiVbyApiVersionRequestBodyData, PostApiVbyApiVersionFormDataData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, CallWithNoContentResponseError, CallWithNoContentResponseResponse, CallWithResponseAndNoContentResponseError, CallWithResponseAndNoContentResponseResponse, CallWithResponseError, CallWithResponseResponse, CallWithDuplicateResponsesError, CallWithDuplicateResponsesResponse, CallWithResponsesError, CallWithResponsesResponse, DummyAError, DummyAResponse, DummyBError, DummyBResponse, CollectionFormatData, TypesData, TypesError, TypesResponse, UploadFileData, UploadFileError, UploadFileResponse, FileResponseData, FileResponseError, FileResponseResponse, ComplexTypesData, ComplexTypesError, ComplexTypesResponse, ComplexParamsData, ComplexParamsError, ComplexParamsResponse, MultipartRequestData, MultipartResponseError, MultipartResponseResponse, CallWithResultFromHeaderError, CallWithResultFromHeaderResponse, TestErrorCodeData, TestErrorCodeError, TestErrorCodeResponse, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Error, NonAsciiæøåÆøÅöôêÊ字符串Response, PutWithFormUrlEncodedData } from './types.gen'; + +export const client = createClient(createConfig()); + +export class DefaultService { + public static export(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/no-tag' + }); + } + + public static import(options: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/no-tag' + }); + } + + public static getApiVbyApiVersionSimpleOperation(options: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/simple:operation' + }); + } + +} + +export class SimpleService { + public static apiVVersionOdataControllerCount(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/simple/$count' + }); + } + + public static getCallWithoutParametersAndResponse(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/simple' + }); + } + + public static putCallWithoutParametersAndResponse(options?: Options) { + return (options?.client ?? client).put({ + ...options, + url: '/api/v{api-version}/simple' + }); + } + + public static postCallWithoutParametersAndResponse(options?: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/simple' + }); + } + + public static deleteCallWithoutParametersAndResponse(options?: Options) { + return (options?.client ?? client).delete({ + ...options, + url: '/api/v{api-version}/simple' + }); + } + + public static optionsCallWithoutParametersAndResponse(options?: Options) { + return (options?.client ?? client).options({ + ...options, + url: '/api/v{api-version}/simple' + }); + } + + public static headCallWithoutParametersAndResponse(options?: Options) { + return (options?.client ?? client).head({ + ...options, + url: '/api/v{api-version}/simple' + }); + } + + public static patchCallWithoutParametersAndResponse(options?: Options) { + return (options?.client ?? client).patch({ + ...options, + url: '/api/v{api-version}/simple' + }); + } + +} + +export class ParametersService { + public static deleteFoo(options: Options) { + return (options?.client ?? client).delete({ + ...options, + url: '/api/v{api-version}/foo/{foo_param}/bar/{BarParam}' + }); + } + + public static callWithParameters(options: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/parameters/{parameterPath}' + }); + } + + public static callWithWeirdParameterNames(options: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/parameters/{parameter.path.1}/{parameter-path-2}/{PARAMETER-PATH-3}' + }); + } + + public static getCallWithOptionalParam(options: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/parameters/' + }); + } + + public static postCallWithOptionalParam(options: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/parameters/' + }); + } + +} + +export class DescriptionsService { + public static callWithDescriptions(options?: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/descriptions/' + }); + } + +} + +export class DeprecatedService { + /** + * @deprecated + */ + public static deprecatedCall(options: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/parameters/deprecated' + }); + } + +} + +export class RequestBodyService { + public static postApiVbyApiVersionRequestBody(options?: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/requestBody/' + }); + } + +} + +export class FormDataService { + public static postApiVbyApiVersionFormData(options?: Options) { + return (options?.client ?? client).post({ + ...options, + ...formDataBodySerializer, + headers: { + 'Content-Type': null, + ...options?.headers + }, + url: '/api/v{api-version}/formData/' + }); + } + +} + +export class DefaultsService { + public static callWithDefaultParameters(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/defaults' + }); + } + + public static callWithDefaultOptionalParameters(options?: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/defaults' + }); + } + + public static callToTestOrderOfParams(options: Options) { + return (options?.client ?? client).put({ + ...options, + url: '/api/v{api-version}/defaults' + }); + } + +} + +export class DuplicateService { + public static duplicateName(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/duplicate' + }); + } + + public static duplicateName1(options?: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/duplicate' + }); + } + + public static duplicateName2(options?: Options) { + return (options?.client ?? client).put({ + ...options, + url: '/api/v{api-version}/duplicate' + }); + } + + public static duplicateName3(options?: Options) { + return (options?.client ?? client).delete({ + ...options, + url: '/api/v{api-version}/duplicate' + }); + } + +} + +export class NoContentService { + public static callWithNoContentResponse(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/no-content' + }); + } + + public static callWithResponseAndNoContentResponse(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/multiple-tags/response-and-no-content' + }); + } + +} + +export class ResponseService { + public static callWithResponseAndNoContentResponse(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/multiple-tags/response-and-no-content' + }); + } + + public static callWithResponse(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/response' + }); + } + + public static callWithDuplicateResponses(options?: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/response' + }); + } + + public static callWithResponses(options?: Options) { + return (options?.client ?? client).put({ + ...options, + url: '/api/v{api-version}/response' + }); + } + +} + +export class MultipleTags1Service { + public static dummyA(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/multiple-tags/a' + }); + } + + public static dummyB(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/multiple-tags/b' + }); + } + +} + +export class MultipleTags2Service { + public static dummyA(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/multiple-tags/a' + }); + } + + public static dummyB(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/multiple-tags/b' + }); + } + +} + +export class MultipleTags3Service { + public static dummyB(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/multiple-tags/b' + }); + } + +} + +export class CollectionFormatService { + public static collectionFormat(options: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/collectionFormat' + }); + } + +} + +export class TypesService { + public static types(options: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/types' + }); + } + +} + +export class UploadService { + public static uploadFile(options: Options) { + return (options?.client ?? client).post({ + ...options, + ...urlSearchParamsBodySerializer, + headers: { + 'Content-Type': 'application/x-www-form-urlencoded', + ...options?.headers + }, + url: '/api/v{api-version}/upload' + }); + } + +} + +export class FileResponseService { + public static fileResponse(options: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/file/{id}' + }); + } + +} + +export class ComplexService { + public static complexTypes(options: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/complex' + }); + } + + public static complexParams(options: Options) { + return (options?.client ?? client).put({ + ...options, + url: '/api/v{api-version}/complex/{id}' + }); + } + +} + +export class MultipartService { + public static multipartRequest(options?: Options) { + return (options?.client ?? client).post({ + ...options, + ...formDataBodySerializer, + headers: { + 'Content-Type': null, + ...options?.headers + }, + url: '/api/v{api-version}/multipart' + }); + } + + public static multipartResponse(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/multipart' + }); + } + +} + +export class HeaderService { + public static callWithResultFromHeader(options?: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/header' + }); + } + +} + +export class ErrorService { + public static testErrorCode(options: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/error' + }); + } + +} + +export class NonAsciiÆøåÆøÅöôêÊService { + public static nonAsciiæøåÆøÅöôêÊ字符串(options: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串' + }); + } + + /** + * Login User + */ + public static putWithFormUrlEncoded(options: Options) { + return (options?.client ?? client).put({ + ...options, + ...urlSearchParamsBodySerializer, + headers: { + 'Content-Type': 'application/x-www-form-urlencoded', + ...options?.headers + }, + url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串' + }); + } + +} \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-vue-query/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/solid-query/asClass/types.gen.ts similarity index 93% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-vue-query/types.gen.ts.snap rename to packages/openapi-ts/test/__snapshots__/plugins/@tanstack/solid-query/asClass/types.gen.ts index c0c16d891..a48ba3ea4 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-vue-query/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/solid-query/asClass/types.gen.ts @@ -91,54 +91,13 @@ export type SimpleStringWithPattern = (string) | null; */ export type EnumWithStrings = 'Success' | 'Warning' | 'Error' | "'Single Quote'" | '"Double Quotes"' | 'Non-ascii: øæåôöØÆÅÔÖ字符串'; -/** - * This is a simple enum with strings - */ -export const EnumWithStrings = { - SUCCESS: 'Success', - WARNING: 'Warning', - ERROR: 'Error', - _SINGLE_QUOTE_: "'Single Quote'", - _DOUBLE_QUOTES_: '"Double Quotes"', - 'NON_ASCII__ØÆÅÔÖ_ØÆÅÔÖ字符串': 'Non-ascii: øæåôöØÆÅÔÖ字符串' -} as const; - export type EnumWithReplacedCharacters = "'Single Quote'" | '"Double Quotes"' | 'øæåôöØÆÅÔÖ字符串' | 3.1 | ''; -export const EnumWithReplacedCharacters = { - _SINGLE_QUOTE_: "'Single Quote'", - _DOUBLE_QUOTES_: '"Double Quotes"', - 'ØÆÅÔÖ_ØÆÅÔÖ字符串': 'øæåôöØÆÅÔÖ字符串', - '_3.1': 3.1, - EMPTY_STRING: '' -} as const; - /** * This is a simple enum with numbers */ export type EnumWithNumbers = 1 | 2 | 3 | 1.1 | 1.2 | 1.3 | 100 | 200 | 300 | -100 | -200 | -300 | -1.1 | -1.2 | -1.3; -/** - * This is a simple enum with numbers - */ -export const EnumWithNumbers = { - '_1': 1, - '_2': 2, - '_3': 3, - '_1.1': 1.1, - '_1.2': 1.2, - '_1.3': 1.3, - '_100': 100, - '_200': 200, - '_300': 300, - '_-100': -100, - '_-200': -200, - '_-300': -300, - '_-1.1': -1.1, - '_-1.2': -1.2, - '_-1.3': -1.3 -} as const; - /** * Success=1,Warning=2,Error=3 */ @@ -149,32 +108,8 @@ export type EnumFromDescription = number; */ export type EnumWithExtensions = 200 | 400 | 500; -/** - * This is a simple enum with numbers - */ -export const EnumWithExtensions = { - /** - * Used when the status of something is successful - */ - CUSTOM_SUCCESS: 200, - /** - * Used when the status of something has a warning - */ - CUSTOM_WARNING: 400, - /** - * Used when the status of something has an error - */ - CUSTOM_ERROR: 500 -} as const; - export type EnumWithXEnumNames = 0 | 1 | 2; -export const EnumWithXEnumNames = { - zero: 0, - one: 1, - two: 2 -} as const; - /** * This is a simple array with numbers */ @@ -354,16 +289,6 @@ export type ModelWithNullableString = { */ export type foo_bar_enum = 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; -/** - * This is a simple enum with strings - */ -export const foo_bar_enum = { - SUCCESS: 'Success', - WARNING: 'Warning', - ERROR: 'Error', - 'ØÆÅ字符串': 'ØÆÅ字符串' -} as const; - /** * This is a model with one enum */ @@ -387,18 +312,6 @@ export type ModelWithEnum = { */ export type statusCode = '100' | '200 FOO' | '300 FOO_BAR' | '400 foo-bar' | '500 foo.bar' | '600 foo&bar'; -/** - * These are the HTTP error code enums - */ -export const statusCode = { - _100: '100', - _200_FOO: '200 FOO', - _300_FOO_BAR: '300 FOO_BAR', - _400_FOO_BAR: '400 foo-bar', - _500_FOO_BAR: '500 foo.bar', - _600_FOO_BAR: '600 foo&bar' -} as const; - /** * This is a model with one enum with escaped name */ @@ -408,10 +321,6 @@ export type ModelWithEnumWithHyphen = { export type foo_bar_baz_qux = '3.0'; -export const foo_bar_baz_qux = { - _3_0: '3.0' -} as const; - /** * This is a model with one enum */ @@ -555,11 +464,6 @@ export type CompositionWithNestedAnyAndTypeNull = { export type _3e_num_1Период = 'Bird' | 'Dog'; -export const _3e_num_1Период = { - BIRD: 'Bird', - DOG: 'Dog' -} as const; - export type ConstValue = "ConstValue"; /** @@ -830,24 +734,10 @@ export type ModelWithOneOfEnum = { export type foo = 'Bar'; -export const foo = { - BAR: 'Bar' -} as const; - export type ModelWithNestedArrayEnumsDataFoo = 'foo' | 'bar'; -export const ModelWithNestedArrayEnumsDataFoo = { - FOO: 'foo', - BAR: 'bar' -} as const; - export type ModelWithNestedArrayEnumsDataBar = 'baz' | 'qux'; -export const ModelWithNestedArrayEnumsDataBar = { - BAZ: 'baz', - QUX: 'qux' -} as const; - export type ModelWithNestedArrayEnumsData = { foo?: Array; bar?: Array; @@ -913,19 +803,6 @@ export type ModelWithNumericEnumUnion = { */ export type value = -10 | -1 | 0 | 1 | 3 | 6 | 12; -/** - * Период - */ -export const value = { - '_-10': -10, - '_-1': -1, - '_0': 0, - '_1': 1, - '_3': 3, - '_6': 6, - '_12': 12 -} as const; - /** * Some description with `back ticks` */ @@ -1097,10 +974,6 @@ export type ImportResponse = (Model_From_Zendesk | ModelWithReadOnlyAndWriteOnly export type ImportError = unknown; -export type ApiVversionOdataControllerCountResponse = (Model_From_Zendesk); - -export type ApiVversionOdataControllerCountError = unknown; - export type GetApiVbyApiVersionSimpleOperationData = { path: { /** @@ -1114,6 +987,10 @@ export type GetApiVbyApiVersionSimpleOperationResponse = (number); export type GetApiVbyApiVersionSimpleOperationError = (ModelWithBoolean); +export type ApiVversionOdataControllerCountResponse = (Model_From_Zendesk); + +export type ApiVversionOdataControllerCountError = unknown; + export type DeleteFooData3 = { headers: { /** @@ -1133,48 +1010,6 @@ export type DeleteFooData3 = { }; }; -export type CallWithDescriptionsData = { - query?: { - /** - * Testing backticks in string: `backticks` and ```multiple backticks``` should work - */ - parameterWithBackticks?: unknown; - /** - * Testing multiline comments in string: First line - * Second line - * - * Fourth line - */ - parameterWithBreaks?: unknown; - /** - * Testing expression placeholders in string: ${expression} should work - */ - parameterWithExpressionPlaceholders?: unknown; - /** - * Testing quotes in string: 'single quote''' and "double quotes""" should work - */ - parameterWithQuotes?: unknown; - /** - * Testing reserved characters in string: * inline * and ** inline ** should work - */ - parameterWithReservedCharacters?: unknown; - /** - * Testing slashes in string: \backwards\\\ and /forwards/// should work - */ - parameterWithSlashes?: unknown; - }; -}; - -export type DeprecatedCallData = { - headers: { - /** - * This parameter is deprecated - * @deprecated - */ - parameter: (DeprecatedModel) | null; - }; -}; - export type CallWithParametersData = { /** * This is the parameter that goes into the body @@ -1281,6 +1116,48 @@ export type PostCallWithOptionalParamResponse = (number | void); export type PostCallWithOptionalParamError = unknown; +export type CallWithDescriptionsData = { + query?: { + /** + * Testing backticks in string: `backticks` and ```multiple backticks``` should work + */ + parameterWithBackticks?: unknown; + /** + * Testing multiline comments in string: First line + * Second line + * + * Fourth line + */ + parameterWithBreaks?: unknown; + /** + * Testing expression placeholders in string: ${expression} should work + */ + parameterWithExpressionPlaceholders?: unknown; + /** + * Testing quotes in string: 'single quote''' and "double quotes""" should work + */ + parameterWithQuotes?: unknown; + /** + * Testing reserved characters in string: * inline * and ** inline ** should work + */ + parameterWithReservedCharacters?: unknown; + /** + * Testing slashes in string: \backwards\\\ and /forwards/// should work + */ + parameterWithSlashes?: unknown; + }; +}; + +export type DeprecatedCallData = { + headers: { + /** + * This parameter is deprecated + * @deprecated + */ + parameter: (DeprecatedModel) | null; + }; +}; + export type PostApiVbyApiVersionRequestBodyData = { /** * A reusable request body @@ -1402,14 +1279,6 @@ export type CallWithResponseAndNoContentResponseResponse = (number | void); export type CallWithResponseAndNoContentResponseError = unknown; -export type DummyAResponse = (_400); - -export type DummyAError = unknown; - -export type DummyBResponse = (void); - -export type DummyBError = unknown; - export type CallWithResponseResponse = (_import); export type CallWithResponseError = unknown; @@ -1426,6 +1295,14 @@ export type CallWithResponsesResponse = ({ export type CallWithResponsesError = (ModelWithStringError); +export type DummyAResponse = (_400); + +export type DummyAError = unknown; + +export type DummyBResponse = (void); + +export type DummyBError = unknown; + export type CollectionFormatData = { query: { /** @@ -1551,23 +1428,6 @@ export type ComplexTypesResponse = (Array); export type ComplexTypesError = (unknown); -export type MultipartRequestData = { - body?: { - content?: (Blob | File); - data?: ((ModelWithString) | null); - }; -}; - -export type MultipartResponseResponse = ({ - file?: (Blob | File); - metadata?: { - foo?: string; - bar?: string; - }; -}); - -export type MultipartResponseError = unknown; - export type ComplexParamsData = { body?: { readonly key: (string) | null; @@ -1595,6 +1455,23 @@ export type ComplexParamsResponse = (ModelWithString); export type ComplexParamsError = unknown; +export type MultipartRequestData = { + body?: { + content?: (Blob | File); + data?: ((ModelWithString) | null); + }; +}; + +export type MultipartResponseResponse = ({ + file?: (Blob | File); + metadata?: { + foo?: string; + bar?: string; + }; +}); + +export type MultipartResponseError = unknown; + export type CallWithResultFromHeaderResponse = (string); export type CallWithResultFromHeaderError = (unknown); diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-solid-query/@tanstack/solid-query.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/solid-query/axios/@tanstack/solid-query.gen.ts similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-solid-query/@tanstack/solid-query.gen.ts.snap rename to packages/openapi-ts/test/__snapshots__/plugins/@tanstack/solid-query/axios/@tanstack/solid-query.gen.ts diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-svelte-query/index.ts.snap b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/solid-query/axios/index.ts similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-svelte-query/index.ts.snap rename to packages/openapi-ts/test/__snapshots__/plugins/@tanstack/solid-query/axios/index.ts diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-solid-query/services.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/solid-query/axios/services.gen.ts similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-solid-query/services.gen.ts.snap rename to packages/openapi-ts/test/__snapshots__/plugins/@tanstack/solid-query/axios/services.gen.ts diff --git a/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/solid-query/axios/types.gen.ts b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/solid-query/axios/types.gen.ts new file mode 100644 index 000000000..1989b3f22 --- /dev/null +++ b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/solid-query/axios/types.gen.ts @@ -0,0 +1,1507 @@ +// This file is auto-generated by @hey-api/openapi-ts + +/** + * Model with number-only name + */ +export type _400 = string; + +/** + * Testing multiline comments in string: First line + * Second line + * + * Fourth line + */ +export type camelCaseCommentWithBreaks = number; + +/** + * Testing multiline comments in string: First line + * Second line + * + * Fourth line + */ +export type CommentWithBreaks = number; + +/** + * Testing backticks in string: `backticks` and ```multiple backticks``` should work + */ +export type CommentWithBackticks = number; + +/** + * Testing backticks and quotes in string: `backticks`, 'quotes', "double quotes" and ```multiple backticks``` should work + */ +export type CommentWithBackticksAndQuotes = number; + +/** + * Testing slashes in string: \backwards\\\ and /forwards/// should work + */ +export type CommentWithSlashes = number; + +/** + * Testing expression placeholders in string: ${expression} should work + */ +export type CommentWithExpressionPlaceholders = number; + +/** + * Testing quotes in string: 'single quote''' and "double quotes""" should work + */ +export type CommentWithQuotes = number; + +/** + * Testing reserved characters in string: * inline * and ** inline ** should work + */ +export type CommentWithReservedCharacters = number; + +/** + * This is a simple number + */ +export type SimpleInteger = number; + +/** + * This is a simple boolean + */ +export type SimpleBoolean = boolean; + +/** + * This is a simple string + */ +export type SimpleString = string; + +/** + * A string with non-ascii (unicode) characters valid in typescript identifiers (æøåÆØÅöÔèÈ字符串) + */ +export type NonAsciiStringæøåÆØÅöôêÊ字符串 = string; + +/** + * This is a simple file + */ +export type SimpleFile = (Blob | File); + +/** + * This is a simple reference + */ +export type SimpleReference = ModelWithString; + +/** + * This is a simple string + */ +export type SimpleStringWithPattern = (string) | null; + +/** + * This is a simple enum with strings + */ +export type EnumWithStrings = 'Success' | 'Warning' | 'Error' | "'Single Quote'" | '"Double Quotes"' | 'Non-ascii: øæåôöØÆÅÔÖ字符串'; + +export type EnumWithReplacedCharacters = "'Single Quote'" | '"Double Quotes"' | 'øæåôöØÆÅÔÖ字符串' | 3.1 | ''; + +/** + * This is a simple enum with numbers + */ +export type EnumWithNumbers = 1 | 2 | 3 | 1.1 | 1.2 | 1.3 | 100 | 200 | 300 | -100 | -200 | -300 | -1.1 | -1.2 | -1.3; + +/** + * Success=1,Warning=2,Error=3 + */ +export type EnumFromDescription = number; + +/** + * This is a simple enum with numbers + */ +export type EnumWithExtensions = 200 | 400 | 500; + +export type EnumWithXEnumNames = 0 | 1 | 2; + +/** + * This is a simple array with numbers + */ +export type ArrayWithNumbers = Array<(number)>; + +/** + * This is a simple array with booleans + */ +export type ArrayWithBooleans = Array<(boolean)>; + +/** + * This is a simple array with strings + */ +export type ArrayWithStrings = Array<(string)>; + +/** + * This is a simple array with references + */ +export type ArrayWithReferences = Array; + +/** + * This is a simple array containing an array + */ +export type ArrayWithArray = Array>; + +/** + * This is a simple array with properties + */ +export type ArrayWithProperties = Array<{ + '16x16'?: camelCaseCommentWithBreaks; + bar?: string; +}>; + +/** + * This is a simple array with any of properties + */ +export type ArrayWithAnyOfProperties = Array<({ + foo?: string; +} | { + bar?: string; +})>; + +export type AnyOfAnyAndNull = { + data?: (unknown | null); +}; + +/** + * This is a simple array with any of properties + */ +export type AnyOfArrays = { + results?: Array<({ + foo?: string; +} | { + bar?: string; +})>; +}; + +/** + * This is a string dictionary + */ +export type DictionaryWithString = { + [key: string]: (string); +}; + +export type DictionaryWithPropertiesAndAdditionalProperties = { + foo?: number; + bar?: boolean; + [key: string]: (string | number | boolean) | undefined; +}; + +/** + * This is a string reference + */ +export type DictionaryWithReference = { + [key: string]: ModelWithString; +}; + +/** + * This is a complex dictionary + */ +export type DictionaryWithArray = { + [key: string]: Array; +}; + +/** + * This is a string dictionary + */ +export type DictionaryWithDictionary = { + [key: string]: { + [key: string]: (string); + }; +}; + +/** + * This is a complex dictionary + */ +export type DictionaryWithProperties = { + [key: string]: { + foo?: string; + bar?: string; + }; +}; + +/** + * This is a model with one number property + */ +export type ModelWithInteger = { + /** + * This is a simple number property + */ + prop?: number; +}; + +/** + * This is a model with one boolean property + */ +export type ModelWithBoolean = { + /** + * This is a simple boolean property + */ + prop?: boolean; +}; + +/** + * This is a model with one string property + */ +export type ModelWithString = { + /** + * This is a simple string property + */ + prop?: string; +}; + +/** + * This is a model with one string property + */ +export type ModelWithStringError = { + /** + * This is a simple string property + */ + prop?: string; +}; + +/** + * `Comment` or `VoiceComment`. The JSON object for adding voice comments to tickets is different. See [Adding voice comments to tickets](/documentation/ticketing/managing-tickets/adding-voice-comments-to-tickets) + */ +export type Model_From_Zendesk = string; + +/** + * This is a model with one string property + */ +export type ModelWithNullableString = { + /** + * This is a simple string property + */ + nullableProp1?: (string) | null; + /** + * This is a simple string property + */ + nullableRequiredProp1: (string) | null; + /** + * This is a simple string property + */ + nullableProp2?: (string) | null; + /** + * This is a simple string property + */ + nullableRequiredProp2: (string) | null; + /** + * This is a simple enum with strings + */ + 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; +}; + +/** + * This is a simple enum with strings + */ +export type foo_bar_enum = 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; + +/** + * This is a model with one enum + */ +export type ModelWithEnum = { + /** + * This is a simple enum with strings + */ + 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; + /** + * These are the HTTP error code enums + */ + statusCode?: '100' | '200 FOO' | '300 FOO_BAR' | '400 foo-bar' | '500 foo.bar' | '600 foo&bar'; + /** + * Simple boolean enum + */ + bool?: boolean; +}; + +/** + * These are the HTTP error code enums + */ +export type statusCode = '100' | '200 FOO' | '300 FOO_BAR' | '400 foo-bar' | '500 foo.bar' | '600 foo&bar'; + +/** + * This is a model with one enum with escaped name + */ +export type ModelWithEnumWithHyphen = { + 'foo-bar-baz-qux'?: '3.0'; +}; + +export type foo_bar_baz_qux = '3.0'; + +/** + * This is a model with one enum + */ +export type ModelWithEnumFromDescription = { + /** + * Success=1,Warning=2,Error=3 + */ + test?: number; +}; + +/** + * This is a model with nested enums + */ +export type ModelWithNestedEnums = { + dictionaryWithEnum?: { + [key: string]: ('Success' | 'Warning' | 'Error'); + }; + dictionaryWithEnumFromDescription?: { + [key: string]: (number); + }; + arrayWithEnum?: Array<('Success' | 'Warning' | 'Error')>; + arrayWithDescription?: Array<(number)>; + /** + * This is a simple enum with strings + */ + 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; +}; + +/** + * This is a model with one property containing a reference + */ +export type ModelWithReference = { + prop?: ModelWithProperties; +}; + +/** + * This is a model with one property containing an array + */ +export type ModelWithArrayReadOnlyAndWriteOnly = { + prop?: Array; + propWithFile?: Array<((Blob | File))>; + propWithNumber?: Array<(number)>; +}; + +/** + * This is a model with one property containing an array + */ +export type ModelWithArray = { + prop?: Array; + propWithFile?: Array<((Blob | File))>; + propWithNumber?: Array<(number)>; +}; + +/** + * This is a model with one property containing a dictionary + */ +export type ModelWithDictionary = { + prop?: { + [key: string]: (string); + }; +}; + +/** + * This is a deprecated model with a deprecated property + * @deprecated + */ +export type DeprecatedModel = { + /** + * This is a deprecated property + * @deprecated + */ + prop?: string; +}; + +/** + * This is a model with one property containing a circular reference + */ +export type ModelWithCircularReference = { + prop?: ModelWithCircularReference; +}; + +/** + * This is a model with one property with a 'one of' relationship + */ +export type CompositionWithOneOf = { + propA?: (ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary); +}; + +/** + * This is a model with one property with a 'one of' relationship where the options are not $ref + */ +export type CompositionWithOneOfAnonymous = { + propA?: ({ + propA?: string; +} | string | number); +}; + +/** + * Circle + */ +export type ModelCircle = { + kind: 'circle'; + radius?: number; +}; + +/** + * Square + */ +export type ModelSquare = { + kind: 'square'; + sideLength?: number; +}; + +/** + * This is a model with one property with a 'one of' relationship where the options are not $ref + */ +export type CompositionWithOneOfDiscriminator = ModelCircle | ModelSquare; + +/** + * This is a model with one property with a 'any of' relationship + */ +export type CompositionWithAnyOf = { + propA?: (ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary); +}; + +/** + * This is a model with one property with a 'any of' relationship where the options are not $ref + */ +export type CompositionWithAnyOfAnonymous = { + propA?: ({ + propA?: string; +} | string | number); +}; + +/** + * This is a model with nested 'any of' property with a type null + */ +export type CompositionWithNestedAnyAndTypeNull = { + propA?: (Array<(ModelWithDictionary | null)> | Array<(ModelWithArray | null)>); +}; + +export type _3e_num_1Период = 'Bird' | 'Dog'; + +export type ConstValue = "ConstValue"; + +/** + * This is a model with one property with a 'any of' relationship where the options are not $ref + */ +export type CompositionWithNestedAnyOfAndNull = { + propA?: (Array<(_3e_num_1Период | ConstValue)> | null); +}; + +/** + * This is a model with one property with a 'one of' relationship + */ +export type CompositionWithOneOfAndNullable = { + propA?: (({ + boolean?: boolean; +} | ModelWithEnum | ModelWithArray | ModelWithDictionary) | null); +}; + +/** + * This is a model that contains a simple dictionary within composition + */ +export type CompositionWithOneOfAndSimpleDictionary = { + propA?: (boolean | { + [key: string]: (number); +}); +}; + +/** + * This is a model that contains a dictionary of simple arrays within composition + */ +export type CompositionWithOneOfAndSimpleArrayDictionary = { + propA?: (boolean | { + [key: string]: Array<(boolean)>; +}); +}; + +/** + * This is a model that contains a dictionary of complex arrays (composited) within composition + */ +export type CompositionWithOneOfAndComplexArrayDictionary = { + propA?: (boolean | { + [key: string]: Array<(number | string)>; +}); +}; + +/** + * This is a model with one property with a 'all of' relationship + */ +export type CompositionWithAllOfAndNullable = { + propA?: (({ + boolean?: boolean; +} & ModelWithEnum & ModelWithArray & ModelWithDictionary) | null); +}; + +/** + * This is a model with one property with a 'any of' relationship + */ +export type CompositionWithAnyOfAndNullable = { + propA?: (({ + boolean?: boolean; +} | ModelWithEnum | ModelWithArray | ModelWithDictionary) | null); +}; + +/** + * This is a base model with two simple optional properties + */ +export type CompositionBaseModel = { + firstName?: string; + lastname?: string; +}; + +/** + * This is a model that extends the base model + */ +export type CompositionExtendedModel = CompositionBaseModel & { + firstName: string; + lastname: string; + age: number; +}; + +/** + * This is a model with one nested property + */ +export type ModelWithProperties = { + required: string; + readonly requiredAndReadOnly: string; + requiredAndNullable: (string) | null; + string?: string; + number?: number; + boolean?: boolean; + reference?: ModelWithString; + 'property with space'?: string; + default?: string; + try?: string; + readonly '@namespace.string'?: string; + readonly '@namespace.integer'?: number; +}; + +/** + * This is a model with one nested property + */ +export type ModelWithNestedProperties = { + readonly first: { + readonly second: { + readonly third: (string) | null; + } | null; + } | null; +}; + +/** + * This is a model with duplicated properties + */ +export type ModelWithDuplicateProperties = { + prop?: ModelWithString; +}; + +/** + * This is a model with ordered properties + */ +export type ModelWithOrderedProperties = { + zebra?: string; + apple?: string; + hawaii?: string; +}; + +/** + * This is a model with duplicated imports + */ +export type ModelWithDuplicateImports = { + propA?: ModelWithString; + propB?: ModelWithString; + propC?: ModelWithString; +}; + +/** + * This is a model that extends another model + */ +export type ModelThatExtends = ModelWithString & { + propExtendsA?: string; + propExtendsB?: ModelWithString; +}; + +/** + * This is a model that extends another model + */ +export type ModelThatExtendsExtends = ModelWithString & ModelThatExtends & { + propExtendsC?: string; + propExtendsD?: ModelWithString; +}; + +/** + * This is a model that contains a some patterns + */ +export type ModelWithPattern = { + key: string; + name: string; + readonly enabled?: boolean; + readonly modified?: string; + id?: string; + text?: string; + patternWithSingleQuotes?: string; + patternWithNewline?: string; + patternWithBacktick?: string; +}; + +export type File = { + readonly id?: string; + readonly updated_at?: string; + readonly created_at?: string; + mime: string; + readonly file?: string; +}; + +export type _default = { + name?: string; +}; + +export type Pageable = { + page?: number; + size?: number; + sort?: Array<(string)>; +}; + +/** + * This is a free-form object without additionalProperties. + */ +export type FreeFormObjectWithoutAdditionalProperties = { + [key: string]: unknown; +}; + +/** + * This is a free-form object with additionalProperties: true. + */ +export type FreeFormObjectWithAdditionalPropertiesEqTrue = { + [key: string]: unknown; +}; + +/** + * This is a free-form object with additionalProperties: {}. + */ +export type FreeFormObjectWithAdditionalPropertiesEqEmptyObject = { + [key: string]: unknown; +}; + +export type ModelWithConst = { + String?: "String"; + number?: 0; + null?: null; + withType?: "Some string"; +}; + +/** + * This is a model with one property and additionalProperties: true + */ +export type ModelWithAdditionalPropertiesEqTrue = { + /** + * This is a simple string property + */ + prop?: string; + [key: string]: unknown | string; +}; + +export type NestedAnyOfArraysNullable = { + nullableArray?: (Array<(string | boolean)> | null); +}; + +export type CompositionWithOneOfAndProperties = ({ + foo: ParameterSimpleParameter; +} | { + bar: NonAsciiStringæøåÆØÅöôêÊ字符串; +}) & { + baz: (number) | null; + qux: number; +}; + +/** + * An object that can be null + */ +export type NullableObject = { + foo?: string; +} | null; + +/** + * Some % character + */ +export type CharactersInDescription = string; + +export type ModelWithNullableObject = { + data?: NullableObject; +}; + +export type ModelWithOneOfEnum = { + foo: 'Bar'; +} | { + foo: 'Baz'; +} | { + foo: 'Qux'; +} | { + content: string; + foo: 'Quux'; +} | { + content: [ + (string), + (string) + ]; + foo: 'Corge'; +}; + +export type foo = 'Bar'; + +export type ModelWithNestedArrayEnumsDataFoo = 'foo' | 'bar'; + +export type ModelWithNestedArrayEnumsDataBar = 'baz' | 'qux'; + +export type ModelWithNestedArrayEnumsData = { + foo?: Array; + bar?: Array; +}; + +export type ModelWithNestedArrayEnums = { + array_strings?: Array<(string)>; + data?: (ModelWithNestedArrayEnumsData); +}; + +export type ModelWithNestedCompositionEnums = { + foo?: (ModelWithNestedArrayEnumsDataFoo); +}; + +export type ModelWithReadOnlyAndWriteOnly = { + foo: string; + readonly bar: string; + baz: string; +}; + +export type ModelWithConstantSizeArray = [ + number, + number +]; + +export type ModelWithAnyOfConstantSizeArray = [ + (number | string), + (number | string), + (number | string) +]; + +export type ModelWithPrefixItemsConstantSizeArray = [ + ModelWithInteger, + (number | string), + string +]; + +export type ModelWithAnyOfConstantSizeArrayNullable = [ + ((number) | null | string), + ((number) | null | string), + ((number) | null | string) +]; + +export type ModelWithAnyOfConstantSizeArrayWithNSizeAndOptions = [ + (number | _import), + (number | _import) +]; + +export type ModelWithAnyOfConstantSizeArrayAndIntersect = [ + (number & string), + (number & string) +]; + +export type ModelWithNumericEnumUnion = { + /** + * Период + */ + value?: -10 | -1 | 0 | 1 | 3 | 6 | 12; +}; + +/** + * Период + */ +export type value = -10 | -1 | 0 | 1 | 3 | 6 | 12; + +/** + * Some description with `back ticks` + */ +export type ModelWithBackticksInDescription = { + /** + * The template `that` should be used for parsing and importing the contents of the CSV file. + * + *

There is one placeholder currently supported:

  • ${x} - refers to the n-th column in the CSV file, e.g. ${1}, ${2}, ...)

Example of a correct JSON template:

+ *
+     * [
+     * {
+     * "resourceType": "Asset",
+     * "identifier": {
+     * "name": "${1}",
+     * "domain": {
+     * "name": "${2}",
+     * "community": {
+     * "name": "Some Community"
+     * }
+     * }
+     * },
+     * "attributes" : {
+     * "00000000-0000-0000-0000-000000003115" : [ {
+     * "value" : "${3}"
+     * } ],
+     * "00000000-0000-0000-0000-000000000222" : [ {
+     * "value" : "${4}"
+     * } ]
+     * }
+     * }
+     * ]
+     * 
+ */ + template?: string; +}; + +export type ModelWithOneOfAndProperties = (ParameterSimpleParameter | NonAsciiStringæøåÆØÅöôêÊ字符串) & { + baz: (number) | null; + qux: number; +}; + +/** + * Model used to test deduplication strategy (unused) + */ +export type ParameterSimpleParameterUnused = string; + +/** + * Model used to test deduplication strategy + */ +export type PostServiceWithEmptyTagResponse = string; + +/** + * Model used to test deduplication strategy + */ +export type PostServiceWithEmptyTagResponse2 = string; + +/** + * Model used to test deduplication strategy + */ +export type DeleteFooData = string; + +/** + * Model used to test deduplication strategy + */ +export type DeleteFooData2 = string; + +/** + * Model with restricted keyword name + */ +export type _import = string; + +export type SchemaWithFormRestrictedKeys = { + description?: string; + 'x-enum-descriptions'?: string; + 'x-enum-varnames'?: string; + 'x-enumNames'?: string; + title?: string; + object?: { + description?: string; + 'x-enum-descriptions'?: string; + 'x-enum-varnames'?: string; + 'x-enumNames'?: string; + title?: string; + }; + array?: Array<({ + description?: string; + 'x-enum-descriptions'?: string; + 'x-enum-varnames'?: string; + 'x-enumNames'?: string; + title?: string; +})>; +}; + +/** + * This schema was giving PascalCase transformations a hard time + */ +export type io_k8s_apimachinery_pkg_apis_meta_v1_DeleteOptions = { + /** + * Must be fulfilled before a deletion is carried out. If not possible, a 409 Conflict status will be returned. + */ + preconditions?: (io_k8s_apimachinery_pkg_apis_meta_v1_Preconditions); +}; + +/** + * This schema was giving PascalCase transformations a hard time + */ +export type io_k8s_apimachinery_pkg_apis_meta_v1_Preconditions = { + /** + * Specifies the target ResourceVersion + */ + resourceVersion?: string; + /** + * Specifies the target UID. + */ + uid?: string; +}; + +export type AdditionalPropertiesUnknownIssue = { + [key: string]: (string | number); +}; + +export type AdditionalPropertiesUnknownIssue2 = { + [key: string]: (string | number); +}; + +export type AdditionalPropertiesUnknownIssue3 = string & { + entries: { + [key: string]: AdditionalPropertiesUnknownIssue; + }; +}; + +export type AdditionalPropertiesIntegerIssue = { + value: number; + [key: string]: (number) | undefined; +}; + +export type OneOfAllOfIssue = ((ConstValue | Generic_Schema_Duplicate_Issue_1_System_Boolean_) & _3e_num_1Период) | Generic_Schema_Duplicate_Issue_1_System_String_; + +export type Generic_Schema_Duplicate_Issue_1_System_Boolean_ = { + item?: boolean; + error?: (string) | null; + readonly hasError?: boolean; + data?: { + [key: string]: unknown; + }; +}; + +export type Generic_Schema_Duplicate_Issue_1_System_String_ = { + item?: (string) | null; + error?: (string) | null; + readonly hasError?: boolean; +}; + +/** + * This is a reusable parameter + */ +export type ParameterSimpleParameter = string; + +/** + * Parameter with illegal characters + */ +export type Parameterx_Foo_Bar = ModelWithString; + +export type ImportData = { + body: (ModelWithReadOnlyAndWriteOnly | ModelWithArrayReadOnlyAndWriteOnly); +}; + +export type ImportResponse = (Model_From_Zendesk | ModelWithReadOnlyAndWriteOnly); + +export type ImportError = unknown; + +export type ApiVversionOdataControllerCountResponse = (Model_From_Zendesk); + +export type ApiVversionOdataControllerCountError = unknown; + +export type GetApiVbyApiVersionSimpleOperationData = { + path: { + /** + * foo in method + */ + foo_param: string; + }; +}; + +export type GetApiVbyApiVersionSimpleOperationResponse = (number); + +export type GetApiVbyApiVersionSimpleOperationError = (ModelWithBoolean); + +export type DeleteFooData3 = { + headers: { + /** + * Parameter with illegal characters + */ + 'x-Foo-Bar': ModelWithString; + }; + path: { + /** + * bar in method + */ + BarParam: string; + /** + * foo in method + */ + foo_param: string; + }; +}; + +export type CallWithDescriptionsData = { + query?: { + /** + * Testing backticks in string: `backticks` and ```multiple backticks``` should work + */ + parameterWithBackticks?: unknown; + /** + * Testing multiline comments in string: First line + * Second line + * + * Fourth line + */ + parameterWithBreaks?: unknown; + /** + * Testing expression placeholders in string: ${expression} should work + */ + parameterWithExpressionPlaceholders?: unknown; + /** + * Testing quotes in string: 'single quote''' and "double quotes""" should work + */ + parameterWithQuotes?: unknown; + /** + * Testing reserved characters in string: * inline * and ** inline ** should work + */ + parameterWithReservedCharacters?: unknown; + /** + * Testing slashes in string: \backwards\\\ and /forwards/// should work + */ + parameterWithSlashes?: unknown; + }; +}; + +export type DeprecatedCallData = { + headers: { + /** + * This parameter is deprecated + * @deprecated + */ + parameter: (DeprecatedModel) | null; + }; +}; + +export type CallWithParametersData = { + /** + * This is the parameter that goes into the body + */ + body: { + [key: string]: unknown; + } | null; + headers: { + /** + * This is the parameter that goes into the header + */ + parameterHeader: (string) | null; + }; + path: { + /** + * api-version should be required in standalone clients + */ + 'api-version': (string) | null; + /** + * This is the parameter that goes into the path + */ + parameterPath: (string) | null; + }; + query: { + /** + * This is the parameter that goes into the query params + */ + cursor: (string) | null; + foo_all_of_enum: (ModelWithNestedArrayEnumsDataFoo); + foo_ref_enum?: ModelWithNestedArrayEnumsDataFoo; + }; +}; + +export type CallWithWeirdParameterNamesData = { + /** + * This is the parameter that goes into the body + */ + body: (ModelWithString) | null; + headers: { + /** + * This is the parameter that goes into the request header + */ + 'parameter.header': (string) | null; + }; + path: { + /** + * api-version should be required in standalone clients + */ + 'api-version': (string) | null; + /** + * This is the parameter that goes into the path + */ + 'parameter-path-2'?: string; + /** + * This is the parameter that goes into the path + */ + 'PARAMETER-PATH-3'?: string; + /** + * This is the parameter that goes into the path + */ + 'parameter.path.1'?: string; + }; + query: { + /** + * This is the parameter with a reserved keyword + */ + default?: string; + /** + * This is the parameter that goes into the request query params + */ + 'parameter-query': (string) | null; + }; +}; + +export type GetCallWithOptionalParamData = { + /** + * This is a required parameter + */ + body: ModelWithOneOfEnum; + query?: { + /** + * This is an optional parameter + */ + page?: number; + }; +}; + +export type PostCallWithOptionalParamData = { + /** + * This is an optional parameter + */ + body?: { + offset?: (number) | null; + }; + query: { + /** + * This is a required parameter + */ + parameter: Pageable; + }; +}; + +export type PostCallWithOptionalParamResponse = (number | void); + +export type PostCallWithOptionalParamError = unknown; + +export type PostApiVbyApiVersionRequestBodyData = { + /** + * A reusable request body + */ + body?: ModelWithString; + query?: { + /** + * This is a reusable parameter + */ + parameter?: string; + }; +}; + +export type PostApiVbyApiVersionFormDataData = { + /** + * A reusable request body + */ + body?: ModelWithString; + query?: { + /** + * This is a reusable parameter + */ + parameter?: string; + }; +}; + +export type CallWithDefaultParametersData = { + query?: { + /** + * This is a simple boolean with default value + */ + parameterBoolean?: (boolean) | null; + /** + * This is a simple enum with default value + */ + parameterEnum?: 'Success' | 'Warning' | 'Error'; + /** + * This is a simple model with default value + */ + parameterModel?: (ModelWithString) | null; + /** + * This is a simple number with default value + */ + parameterNumber?: (number) | null; + /** + * This is a simple string with default value + */ + parameterString?: (string) | null; + }; +}; + +export type CallWithDefaultOptionalParametersData = { + query?: { + /** + * This is a simple boolean that is optional with default value + */ + parameterBoolean?: boolean; + /** + * This is a simple enum that is optional with default value + */ + parameterEnum?: 'Success' | 'Warning' | 'Error'; + /** + * This is a simple model that is optional with default value + */ + parameterModel?: ModelWithString; + /** + * This is a simple number that is optional with default value + */ + parameterNumber?: number; + /** + * This is a simple string that is optional with default value + */ + parameterString?: string; + }; +}; + +export type CallToTestOrderOfParamsData = { + query: { + /** + * This is a optional string with default + */ + parameterOptionalStringWithDefault?: string; + /** + * This is a optional string with empty default + */ + parameterOptionalStringWithEmptyDefault?: string; + /** + * This is a optional string with no default + */ + parameterOptionalStringWithNoDefault?: string; + /** + * This is a string that can be null with default + */ + parameterStringNullableWithDefault?: (string) | null; + /** + * This is a string that can be null with no default + */ + parameterStringNullableWithNoDefault?: (string) | null; + /** + * This is a string with default + */ + parameterStringWithDefault: string; + /** + * This is a string with empty default + */ + parameterStringWithEmptyDefault: string; + /** + * This is a string with no default + */ + parameterStringWithNoDefault: string; + }; +}; + +export type CallWithNoContentResponseResponse = (void); + +export type CallWithNoContentResponseError = unknown; + +export type CallWithResponseAndNoContentResponseResponse = (number | void); + +export type CallWithResponseAndNoContentResponseError = unknown; + +export type DummyAResponse = (_400); + +export type DummyAError = unknown; + +export type DummyBResponse = (void); + +export type DummyBError = unknown; + +export type CallWithResponseResponse = (_import); + +export type CallWithResponseError = unknown; + +export type CallWithDuplicateResponsesResponse = ((ModelWithBoolean & ModelWithInteger) | ModelWithString); + +export type CallWithDuplicateResponsesError = (ModelWithStringError | DictionaryWithArray | ModelWithBoolean); + +export type CallWithResponsesResponse = ({ + readonly '@namespace.string'?: string; + readonly '@namespace.integer'?: number; + readonly value?: Array; +} | ModelThatExtends | ModelThatExtendsExtends); + +export type CallWithResponsesError = (ModelWithStringError); + +export type CollectionFormatData = { + query: { + /** + * This is an array parameter that is sent as csv format (comma-separated values) + */ + parameterArrayCSV: Array<(string)> | null; + /** + * This is an array parameter that is sent as multi format (multiple parameter instances) + */ + parameterArrayMulti: Array<(string)> | null; + /** + * This is an array parameter that is sent as pipes format (pipe-separated values) + */ + parameterArrayPipes: Array<(string)> | null; + /** + * This is an array parameter that is sent as ssv format (space-separated values) + */ + parameterArraySSV: Array<(string)> | null; + /** + * This is an array parameter that is sent as tsv format (tab-separated values) + */ + parameterArrayTSV: Array<(string)> | null; + }; +}; + +export type TypesData = { + path?: { + /** + * This is a number parameter + */ + id?: number; + }; + query: { + /** + * This is an array parameter + */ + parameterArray: Array<(string)> | null; + /** + * This is a boolean parameter + */ + parameterBoolean: (boolean) | null; + /** + * This is a dictionary parameter + */ + parameterDictionary: { + [key: string]: unknown; + } | null; + /** + * This is an enum parameter + */ + parameterEnum: ('Success' | 'Warning' | 'Error') | null; + /** + * This is a number parameter + */ + parameterNumber: number; + /** + * This is an object parameter + */ + parameterObject: { + [key: string]: unknown; + } | null; + /** + * This is a string parameter + */ + parameterString: (string) | null; + }; +}; + +export type TypesResponse = (number | string | boolean | { + [key: string]: unknown; +}); + +export type TypesError = unknown; + +export type UploadFileData = { + body: (Blob | File); + path: { + /** + * api-version should be required in standalone clients + */ + 'api-version': (string) | null; + }; +}; + +export type UploadFileResponse = (boolean); + +export type UploadFileError = unknown; + +export type FileResponseData = { + path: { + /** + * api-version should be required in standalone clients + */ + 'api-version': string; + id: string; + }; +}; + +export type FileResponseResponse = ((Blob | File)); + +export type FileResponseError = unknown; + +export type ComplexTypesData = { + query: { + /** + * Parameter containing object + */ + parameterObject: { + first?: { + second?: { + third?: string; + }; + }; + }; + /** + * Parameter containing reference + */ + parameterReference: ModelWithString; + }; +}; + +export type ComplexTypesResponse = (Array); + +export type ComplexTypesError = (unknown); + +export type MultipartRequestData = { + body?: { + content?: (Blob | File); + data?: ((ModelWithString) | null); + }; +}; + +export type MultipartResponseResponse = ({ + file?: (Blob | File); + metadata?: { + foo?: string; + bar?: string; + }; +}); + +export type MultipartResponseError = unknown; + +export type ComplexParamsData = { + body?: { + readonly key: (string) | null; + name: (string) | null; + enabled?: boolean; + readonly type: 'Monkey' | 'Horse' | 'Bird'; + listOfModels?: Array | null; + listOfStrings?: Array<(string)> | null; + parameters: (ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary); + readonly user?: { + readonly id?: number; + readonly name?: (string) | null; + }; + }; + path: { + /** + * api-version should be required in standalone clients + */ + 'api-version': string; + id: number; + }; +}; + +export type ComplexParamsResponse = (ModelWithString); + +export type ComplexParamsError = unknown; + +export type CallWithResultFromHeaderResponse = (string); + +export type CallWithResultFromHeaderError = (unknown); + +export type TestErrorCodeData = { + query: { + /** + * Status code to return + */ + status: number; + }; +}; + +export type TestErrorCodeResponse = (unknown); + +export type TestErrorCodeError = (unknown); + +export type NonAsciiæøåÆøÅöôêÊ字符串Data = { + query: { + /** + * Dummy input param + */ + nonAsciiParamæøåÆØÅöôêÊ: number; + }; +}; + +export type NonAsciiæøåÆøÅöôêÊ字符串Response = (Array); + +export type NonAsciiæøåÆøÅöôêÊ字符串Error = unknown; + +export type PutWithFormUrlEncodedData = { + body: ArrayWithStrings; +}; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-solid-query/@tanstack/solid-query.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/solid-query/fetch/@tanstack/solid-query.gen.ts similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-solid-query/@tanstack/solid-query.gen.ts.snap rename to packages/openapi-ts/test/__snapshots__/plugins/@tanstack/solid-query/fetch/@tanstack/solid-query.gen.ts diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-svelte-query_transform/index.ts.snap b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/solid-query/fetch/index.ts similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-svelte-query_transform/index.ts.snap rename to packages/openapi-ts/test/__snapshots__/plugins/@tanstack/solid-query/fetch/index.ts diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-solid-query/services.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/solid-query/fetch/services.gen.ts similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-solid-query/services.gen.ts.snap rename to packages/openapi-ts/test/__snapshots__/plugins/@tanstack/solid-query/fetch/services.gen.ts diff --git a/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/solid-query/fetch/types.gen.ts b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/solid-query/fetch/types.gen.ts new file mode 100644 index 000000000..1989b3f22 --- /dev/null +++ b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/solid-query/fetch/types.gen.ts @@ -0,0 +1,1507 @@ +// This file is auto-generated by @hey-api/openapi-ts + +/** + * Model with number-only name + */ +export type _400 = string; + +/** + * Testing multiline comments in string: First line + * Second line + * + * Fourth line + */ +export type camelCaseCommentWithBreaks = number; + +/** + * Testing multiline comments in string: First line + * Second line + * + * Fourth line + */ +export type CommentWithBreaks = number; + +/** + * Testing backticks in string: `backticks` and ```multiple backticks``` should work + */ +export type CommentWithBackticks = number; + +/** + * Testing backticks and quotes in string: `backticks`, 'quotes', "double quotes" and ```multiple backticks``` should work + */ +export type CommentWithBackticksAndQuotes = number; + +/** + * Testing slashes in string: \backwards\\\ and /forwards/// should work + */ +export type CommentWithSlashes = number; + +/** + * Testing expression placeholders in string: ${expression} should work + */ +export type CommentWithExpressionPlaceholders = number; + +/** + * Testing quotes in string: 'single quote''' and "double quotes""" should work + */ +export type CommentWithQuotes = number; + +/** + * Testing reserved characters in string: * inline * and ** inline ** should work + */ +export type CommentWithReservedCharacters = number; + +/** + * This is a simple number + */ +export type SimpleInteger = number; + +/** + * This is a simple boolean + */ +export type SimpleBoolean = boolean; + +/** + * This is a simple string + */ +export type SimpleString = string; + +/** + * A string with non-ascii (unicode) characters valid in typescript identifiers (æøåÆØÅöÔèÈ字符串) + */ +export type NonAsciiStringæøåÆØÅöôêÊ字符串 = string; + +/** + * This is a simple file + */ +export type SimpleFile = (Blob | File); + +/** + * This is a simple reference + */ +export type SimpleReference = ModelWithString; + +/** + * This is a simple string + */ +export type SimpleStringWithPattern = (string) | null; + +/** + * This is a simple enum with strings + */ +export type EnumWithStrings = 'Success' | 'Warning' | 'Error' | "'Single Quote'" | '"Double Quotes"' | 'Non-ascii: øæåôöØÆÅÔÖ字符串'; + +export type EnumWithReplacedCharacters = "'Single Quote'" | '"Double Quotes"' | 'øæåôöØÆÅÔÖ字符串' | 3.1 | ''; + +/** + * This is a simple enum with numbers + */ +export type EnumWithNumbers = 1 | 2 | 3 | 1.1 | 1.2 | 1.3 | 100 | 200 | 300 | -100 | -200 | -300 | -1.1 | -1.2 | -1.3; + +/** + * Success=1,Warning=2,Error=3 + */ +export type EnumFromDescription = number; + +/** + * This is a simple enum with numbers + */ +export type EnumWithExtensions = 200 | 400 | 500; + +export type EnumWithXEnumNames = 0 | 1 | 2; + +/** + * This is a simple array with numbers + */ +export type ArrayWithNumbers = Array<(number)>; + +/** + * This is a simple array with booleans + */ +export type ArrayWithBooleans = Array<(boolean)>; + +/** + * This is a simple array with strings + */ +export type ArrayWithStrings = Array<(string)>; + +/** + * This is a simple array with references + */ +export type ArrayWithReferences = Array; + +/** + * This is a simple array containing an array + */ +export type ArrayWithArray = Array>; + +/** + * This is a simple array with properties + */ +export type ArrayWithProperties = Array<{ + '16x16'?: camelCaseCommentWithBreaks; + bar?: string; +}>; + +/** + * This is a simple array with any of properties + */ +export type ArrayWithAnyOfProperties = Array<({ + foo?: string; +} | { + bar?: string; +})>; + +export type AnyOfAnyAndNull = { + data?: (unknown | null); +}; + +/** + * This is a simple array with any of properties + */ +export type AnyOfArrays = { + results?: Array<({ + foo?: string; +} | { + bar?: string; +})>; +}; + +/** + * This is a string dictionary + */ +export type DictionaryWithString = { + [key: string]: (string); +}; + +export type DictionaryWithPropertiesAndAdditionalProperties = { + foo?: number; + bar?: boolean; + [key: string]: (string | number | boolean) | undefined; +}; + +/** + * This is a string reference + */ +export type DictionaryWithReference = { + [key: string]: ModelWithString; +}; + +/** + * This is a complex dictionary + */ +export type DictionaryWithArray = { + [key: string]: Array; +}; + +/** + * This is a string dictionary + */ +export type DictionaryWithDictionary = { + [key: string]: { + [key: string]: (string); + }; +}; + +/** + * This is a complex dictionary + */ +export type DictionaryWithProperties = { + [key: string]: { + foo?: string; + bar?: string; + }; +}; + +/** + * This is a model with one number property + */ +export type ModelWithInteger = { + /** + * This is a simple number property + */ + prop?: number; +}; + +/** + * This is a model with one boolean property + */ +export type ModelWithBoolean = { + /** + * This is a simple boolean property + */ + prop?: boolean; +}; + +/** + * This is a model with one string property + */ +export type ModelWithString = { + /** + * This is a simple string property + */ + prop?: string; +}; + +/** + * This is a model with one string property + */ +export type ModelWithStringError = { + /** + * This is a simple string property + */ + prop?: string; +}; + +/** + * `Comment` or `VoiceComment`. The JSON object for adding voice comments to tickets is different. See [Adding voice comments to tickets](/documentation/ticketing/managing-tickets/adding-voice-comments-to-tickets) + */ +export type Model_From_Zendesk = string; + +/** + * This is a model with one string property + */ +export type ModelWithNullableString = { + /** + * This is a simple string property + */ + nullableProp1?: (string) | null; + /** + * This is a simple string property + */ + nullableRequiredProp1: (string) | null; + /** + * This is a simple string property + */ + nullableProp2?: (string) | null; + /** + * This is a simple string property + */ + nullableRequiredProp2: (string) | null; + /** + * This is a simple enum with strings + */ + 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; +}; + +/** + * This is a simple enum with strings + */ +export type foo_bar_enum = 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; + +/** + * This is a model with one enum + */ +export type ModelWithEnum = { + /** + * This is a simple enum with strings + */ + 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; + /** + * These are the HTTP error code enums + */ + statusCode?: '100' | '200 FOO' | '300 FOO_BAR' | '400 foo-bar' | '500 foo.bar' | '600 foo&bar'; + /** + * Simple boolean enum + */ + bool?: boolean; +}; + +/** + * These are the HTTP error code enums + */ +export type statusCode = '100' | '200 FOO' | '300 FOO_BAR' | '400 foo-bar' | '500 foo.bar' | '600 foo&bar'; + +/** + * This is a model with one enum with escaped name + */ +export type ModelWithEnumWithHyphen = { + 'foo-bar-baz-qux'?: '3.0'; +}; + +export type foo_bar_baz_qux = '3.0'; + +/** + * This is a model with one enum + */ +export type ModelWithEnumFromDescription = { + /** + * Success=1,Warning=2,Error=3 + */ + test?: number; +}; + +/** + * This is a model with nested enums + */ +export type ModelWithNestedEnums = { + dictionaryWithEnum?: { + [key: string]: ('Success' | 'Warning' | 'Error'); + }; + dictionaryWithEnumFromDescription?: { + [key: string]: (number); + }; + arrayWithEnum?: Array<('Success' | 'Warning' | 'Error')>; + arrayWithDescription?: Array<(number)>; + /** + * This is a simple enum with strings + */ + 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; +}; + +/** + * This is a model with one property containing a reference + */ +export type ModelWithReference = { + prop?: ModelWithProperties; +}; + +/** + * This is a model with one property containing an array + */ +export type ModelWithArrayReadOnlyAndWriteOnly = { + prop?: Array; + propWithFile?: Array<((Blob | File))>; + propWithNumber?: Array<(number)>; +}; + +/** + * This is a model with one property containing an array + */ +export type ModelWithArray = { + prop?: Array; + propWithFile?: Array<((Blob | File))>; + propWithNumber?: Array<(number)>; +}; + +/** + * This is a model with one property containing a dictionary + */ +export type ModelWithDictionary = { + prop?: { + [key: string]: (string); + }; +}; + +/** + * This is a deprecated model with a deprecated property + * @deprecated + */ +export type DeprecatedModel = { + /** + * This is a deprecated property + * @deprecated + */ + prop?: string; +}; + +/** + * This is a model with one property containing a circular reference + */ +export type ModelWithCircularReference = { + prop?: ModelWithCircularReference; +}; + +/** + * This is a model with one property with a 'one of' relationship + */ +export type CompositionWithOneOf = { + propA?: (ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary); +}; + +/** + * This is a model with one property with a 'one of' relationship where the options are not $ref + */ +export type CompositionWithOneOfAnonymous = { + propA?: ({ + propA?: string; +} | string | number); +}; + +/** + * Circle + */ +export type ModelCircle = { + kind: 'circle'; + radius?: number; +}; + +/** + * Square + */ +export type ModelSquare = { + kind: 'square'; + sideLength?: number; +}; + +/** + * This is a model with one property with a 'one of' relationship where the options are not $ref + */ +export type CompositionWithOneOfDiscriminator = ModelCircle | ModelSquare; + +/** + * This is a model with one property with a 'any of' relationship + */ +export type CompositionWithAnyOf = { + propA?: (ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary); +}; + +/** + * This is a model with one property with a 'any of' relationship where the options are not $ref + */ +export type CompositionWithAnyOfAnonymous = { + propA?: ({ + propA?: string; +} | string | number); +}; + +/** + * This is a model with nested 'any of' property with a type null + */ +export type CompositionWithNestedAnyAndTypeNull = { + propA?: (Array<(ModelWithDictionary | null)> | Array<(ModelWithArray | null)>); +}; + +export type _3e_num_1Период = 'Bird' | 'Dog'; + +export type ConstValue = "ConstValue"; + +/** + * This is a model with one property with a 'any of' relationship where the options are not $ref + */ +export type CompositionWithNestedAnyOfAndNull = { + propA?: (Array<(_3e_num_1Период | ConstValue)> | null); +}; + +/** + * This is a model with one property with a 'one of' relationship + */ +export type CompositionWithOneOfAndNullable = { + propA?: (({ + boolean?: boolean; +} | ModelWithEnum | ModelWithArray | ModelWithDictionary) | null); +}; + +/** + * This is a model that contains a simple dictionary within composition + */ +export type CompositionWithOneOfAndSimpleDictionary = { + propA?: (boolean | { + [key: string]: (number); +}); +}; + +/** + * This is a model that contains a dictionary of simple arrays within composition + */ +export type CompositionWithOneOfAndSimpleArrayDictionary = { + propA?: (boolean | { + [key: string]: Array<(boolean)>; +}); +}; + +/** + * This is a model that contains a dictionary of complex arrays (composited) within composition + */ +export type CompositionWithOneOfAndComplexArrayDictionary = { + propA?: (boolean | { + [key: string]: Array<(number | string)>; +}); +}; + +/** + * This is a model with one property with a 'all of' relationship + */ +export type CompositionWithAllOfAndNullable = { + propA?: (({ + boolean?: boolean; +} & ModelWithEnum & ModelWithArray & ModelWithDictionary) | null); +}; + +/** + * This is a model with one property with a 'any of' relationship + */ +export type CompositionWithAnyOfAndNullable = { + propA?: (({ + boolean?: boolean; +} | ModelWithEnum | ModelWithArray | ModelWithDictionary) | null); +}; + +/** + * This is a base model with two simple optional properties + */ +export type CompositionBaseModel = { + firstName?: string; + lastname?: string; +}; + +/** + * This is a model that extends the base model + */ +export type CompositionExtendedModel = CompositionBaseModel & { + firstName: string; + lastname: string; + age: number; +}; + +/** + * This is a model with one nested property + */ +export type ModelWithProperties = { + required: string; + readonly requiredAndReadOnly: string; + requiredAndNullable: (string) | null; + string?: string; + number?: number; + boolean?: boolean; + reference?: ModelWithString; + 'property with space'?: string; + default?: string; + try?: string; + readonly '@namespace.string'?: string; + readonly '@namespace.integer'?: number; +}; + +/** + * This is a model with one nested property + */ +export type ModelWithNestedProperties = { + readonly first: { + readonly second: { + readonly third: (string) | null; + } | null; + } | null; +}; + +/** + * This is a model with duplicated properties + */ +export type ModelWithDuplicateProperties = { + prop?: ModelWithString; +}; + +/** + * This is a model with ordered properties + */ +export type ModelWithOrderedProperties = { + zebra?: string; + apple?: string; + hawaii?: string; +}; + +/** + * This is a model with duplicated imports + */ +export type ModelWithDuplicateImports = { + propA?: ModelWithString; + propB?: ModelWithString; + propC?: ModelWithString; +}; + +/** + * This is a model that extends another model + */ +export type ModelThatExtends = ModelWithString & { + propExtendsA?: string; + propExtendsB?: ModelWithString; +}; + +/** + * This is a model that extends another model + */ +export type ModelThatExtendsExtends = ModelWithString & ModelThatExtends & { + propExtendsC?: string; + propExtendsD?: ModelWithString; +}; + +/** + * This is a model that contains a some patterns + */ +export type ModelWithPattern = { + key: string; + name: string; + readonly enabled?: boolean; + readonly modified?: string; + id?: string; + text?: string; + patternWithSingleQuotes?: string; + patternWithNewline?: string; + patternWithBacktick?: string; +}; + +export type File = { + readonly id?: string; + readonly updated_at?: string; + readonly created_at?: string; + mime: string; + readonly file?: string; +}; + +export type _default = { + name?: string; +}; + +export type Pageable = { + page?: number; + size?: number; + sort?: Array<(string)>; +}; + +/** + * This is a free-form object without additionalProperties. + */ +export type FreeFormObjectWithoutAdditionalProperties = { + [key: string]: unknown; +}; + +/** + * This is a free-form object with additionalProperties: true. + */ +export type FreeFormObjectWithAdditionalPropertiesEqTrue = { + [key: string]: unknown; +}; + +/** + * This is a free-form object with additionalProperties: {}. + */ +export type FreeFormObjectWithAdditionalPropertiesEqEmptyObject = { + [key: string]: unknown; +}; + +export type ModelWithConst = { + String?: "String"; + number?: 0; + null?: null; + withType?: "Some string"; +}; + +/** + * This is a model with one property and additionalProperties: true + */ +export type ModelWithAdditionalPropertiesEqTrue = { + /** + * This is a simple string property + */ + prop?: string; + [key: string]: unknown | string; +}; + +export type NestedAnyOfArraysNullable = { + nullableArray?: (Array<(string | boolean)> | null); +}; + +export type CompositionWithOneOfAndProperties = ({ + foo: ParameterSimpleParameter; +} | { + bar: NonAsciiStringæøåÆØÅöôêÊ字符串; +}) & { + baz: (number) | null; + qux: number; +}; + +/** + * An object that can be null + */ +export type NullableObject = { + foo?: string; +} | null; + +/** + * Some % character + */ +export type CharactersInDescription = string; + +export type ModelWithNullableObject = { + data?: NullableObject; +}; + +export type ModelWithOneOfEnum = { + foo: 'Bar'; +} | { + foo: 'Baz'; +} | { + foo: 'Qux'; +} | { + content: string; + foo: 'Quux'; +} | { + content: [ + (string), + (string) + ]; + foo: 'Corge'; +}; + +export type foo = 'Bar'; + +export type ModelWithNestedArrayEnumsDataFoo = 'foo' | 'bar'; + +export type ModelWithNestedArrayEnumsDataBar = 'baz' | 'qux'; + +export type ModelWithNestedArrayEnumsData = { + foo?: Array; + bar?: Array; +}; + +export type ModelWithNestedArrayEnums = { + array_strings?: Array<(string)>; + data?: (ModelWithNestedArrayEnumsData); +}; + +export type ModelWithNestedCompositionEnums = { + foo?: (ModelWithNestedArrayEnumsDataFoo); +}; + +export type ModelWithReadOnlyAndWriteOnly = { + foo: string; + readonly bar: string; + baz: string; +}; + +export type ModelWithConstantSizeArray = [ + number, + number +]; + +export type ModelWithAnyOfConstantSizeArray = [ + (number | string), + (number | string), + (number | string) +]; + +export type ModelWithPrefixItemsConstantSizeArray = [ + ModelWithInteger, + (number | string), + string +]; + +export type ModelWithAnyOfConstantSizeArrayNullable = [ + ((number) | null | string), + ((number) | null | string), + ((number) | null | string) +]; + +export type ModelWithAnyOfConstantSizeArrayWithNSizeAndOptions = [ + (number | _import), + (number | _import) +]; + +export type ModelWithAnyOfConstantSizeArrayAndIntersect = [ + (number & string), + (number & string) +]; + +export type ModelWithNumericEnumUnion = { + /** + * Период + */ + value?: -10 | -1 | 0 | 1 | 3 | 6 | 12; +}; + +/** + * Период + */ +export type value = -10 | -1 | 0 | 1 | 3 | 6 | 12; + +/** + * Some description with `back ticks` + */ +export type ModelWithBackticksInDescription = { + /** + * The template `that` should be used for parsing and importing the contents of the CSV file. + * + *

There is one placeholder currently supported:

  • ${x} - refers to the n-th column in the CSV file, e.g. ${1}, ${2}, ...)

Example of a correct JSON template:

+ *
+     * [
+     * {
+     * "resourceType": "Asset",
+     * "identifier": {
+     * "name": "${1}",
+     * "domain": {
+     * "name": "${2}",
+     * "community": {
+     * "name": "Some Community"
+     * }
+     * }
+     * },
+     * "attributes" : {
+     * "00000000-0000-0000-0000-000000003115" : [ {
+     * "value" : "${3}"
+     * } ],
+     * "00000000-0000-0000-0000-000000000222" : [ {
+     * "value" : "${4}"
+     * } ]
+     * }
+     * }
+     * ]
+     * 
+ */ + template?: string; +}; + +export type ModelWithOneOfAndProperties = (ParameterSimpleParameter | NonAsciiStringæøåÆØÅöôêÊ字符串) & { + baz: (number) | null; + qux: number; +}; + +/** + * Model used to test deduplication strategy (unused) + */ +export type ParameterSimpleParameterUnused = string; + +/** + * Model used to test deduplication strategy + */ +export type PostServiceWithEmptyTagResponse = string; + +/** + * Model used to test deduplication strategy + */ +export type PostServiceWithEmptyTagResponse2 = string; + +/** + * Model used to test deduplication strategy + */ +export type DeleteFooData = string; + +/** + * Model used to test deduplication strategy + */ +export type DeleteFooData2 = string; + +/** + * Model with restricted keyword name + */ +export type _import = string; + +export type SchemaWithFormRestrictedKeys = { + description?: string; + 'x-enum-descriptions'?: string; + 'x-enum-varnames'?: string; + 'x-enumNames'?: string; + title?: string; + object?: { + description?: string; + 'x-enum-descriptions'?: string; + 'x-enum-varnames'?: string; + 'x-enumNames'?: string; + title?: string; + }; + array?: Array<({ + description?: string; + 'x-enum-descriptions'?: string; + 'x-enum-varnames'?: string; + 'x-enumNames'?: string; + title?: string; +})>; +}; + +/** + * This schema was giving PascalCase transformations a hard time + */ +export type io_k8s_apimachinery_pkg_apis_meta_v1_DeleteOptions = { + /** + * Must be fulfilled before a deletion is carried out. If not possible, a 409 Conflict status will be returned. + */ + preconditions?: (io_k8s_apimachinery_pkg_apis_meta_v1_Preconditions); +}; + +/** + * This schema was giving PascalCase transformations a hard time + */ +export type io_k8s_apimachinery_pkg_apis_meta_v1_Preconditions = { + /** + * Specifies the target ResourceVersion + */ + resourceVersion?: string; + /** + * Specifies the target UID. + */ + uid?: string; +}; + +export type AdditionalPropertiesUnknownIssue = { + [key: string]: (string | number); +}; + +export type AdditionalPropertiesUnknownIssue2 = { + [key: string]: (string | number); +}; + +export type AdditionalPropertiesUnknownIssue3 = string & { + entries: { + [key: string]: AdditionalPropertiesUnknownIssue; + }; +}; + +export type AdditionalPropertiesIntegerIssue = { + value: number; + [key: string]: (number) | undefined; +}; + +export type OneOfAllOfIssue = ((ConstValue | Generic_Schema_Duplicate_Issue_1_System_Boolean_) & _3e_num_1Период) | Generic_Schema_Duplicate_Issue_1_System_String_; + +export type Generic_Schema_Duplicate_Issue_1_System_Boolean_ = { + item?: boolean; + error?: (string) | null; + readonly hasError?: boolean; + data?: { + [key: string]: unknown; + }; +}; + +export type Generic_Schema_Duplicate_Issue_1_System_String_ = { + item?: (string) | null; + error?: (string) | null; + readonly hasError?: boolean; +}; + +/** + * This is a reusable parameter + */ +export type ParameterSimpleParameter = string; + +/** + * Parameter with illegal characters + */ +export type Parameterx_Foo_Bar = ModelWithString; + +export type ImportData = { + body: (ModelWithReadOnlyAndWriteOnly | ModelWithArrayReadOnlyAndWriteOnly); +}; + +export type ImportResponse = (Model_From_Zendesk | ModelWithReadOnlyAndWriteOnly); + +export type ImportError = unknown; + +export type ApiVversionOdataControllerCountResponse = (Model_From_Zendesk); + +export type ApiVversionOdataControllerCountError = unknown; + +export type GetApiVbyApiVersionSimpleOperationData = { + path: { + /** + * foo in method + */ + foo_param: string; + }; +}; + +export type GetApiVbyApiVersionSimpleOperationResponse = (number); + +export type GetApiVbyApiVersionSimpleOperationError = (ModelWithBoolean); + +export type DeleteFooData3 = { + headers: { + /** + * Parameter with illegal characters + */ + 'x-Foo-Bar': ModelWithString; + }; + path: { + /** + * bar in method + */ + BarParam: string; + /** + * foo in method + */ + foo_param: string; + }; +}; + +export type CallWithDescriptionsData = { + query?: { + /** + * Testing backticks in string: `backticks` and ```multiple backticks``` should work + */ + parameterWithBackticks?: unknown; + /** + * Testing multiline comments in string: First line + * Second line + * + * Fourth line + */ + parameterWithBreaks?: unknown; + /** + * Testing expression placeholders in string: ${expression} should work + */ + parameterWithExpressionPlaceholders?: unknown; + /** + * Testing quotes in string: 'single quote''' and "double quotes""" should work + */ + parameterWithQuotes?: unknown; + /** + * Testing reserved characters in string: * inline * and ** inline ** should work + */ + parameterWithReservedCharacters?: unknown; + /** + * Testing slashes in string: \backwards\\\ and /forwards/// should work + */ + parameterWithSlashes?: unknown; + }; +}; + +export type DeprecatedCallData = { + headers: { + /** + * This parameter is deprecated + * @deprecated + */ + parameter: (DeprecatedModel) | null; + }; +}; + +export type CallWithParametersData = { + /** + * This is the parameter that goes into the body + */ + body: { + [key: string]: unknown; + } | null; + headers: { + /** + * This is the parameter that goes into the header + */ + parameterHeader: (string) | null; + }; + path: { + /** + * api-version should be required in standalone clients + */ + 'api-version': (string) | null; + /** + * This is the parameter that goes into the path + */ + parameterPath: (string) | null; + }; + query: { + /** + * This is the parameter that goes into the query params + */ + cursor: (string) | null; + foo_all_of_enum: (ModelWithNestedArrayEnumsDataFoo); + foo_ref_enum?: ModelWithNestedArrayEnumsDataFoo; + }; +}; + +export type CallWithWeirdParameterNamesData = { + /** + * This is the parameter that goes into the body + */ + body: (ModelWithString) | null; + headers: { + /** + * This is the parameter that goes into the request header + */ + 'parameter.header': (string) | null; + }; + path: { + /** + * api-version should be required in standalone clients + */ + 'api-version': (string) | null; + /** + * This is the parameter that goes into the path + */ + 'parameter-path-2'?: string; + /** + * This is the parameter that goes into the path + */ + 'PARAMETER-PATH-3'?: string; + /** + * This is the parameter that goes into the path + */ + 'parameter.path.1'?: string; + }; + query: { + /** + * This is the parameter with a reserved keyword + */ + default?: string; + /** + * This is the parameter that goes into the request query params + */ + 'parameter-query': (string) | null; + }; +}; + +export type GetCallWithOptionalParamData = { + /** + * This is a required parameter + */ + body: ModelWithOneOfEnum; + query?: { + /** + * This is an optional parameter + */ + page?: number; + }; +}; + +export type PostCallWithOptionalParamData = { + /** + * This is an optional parameter + */ + body?: { + offset?: (number) | null; + }; + query: { + /** + * This is a required parameter + */ + parameter: Pageable; + }; +}; + +export type PostCallWithOptionalParamResponse = (number | void); + +export type PostCallWithOptionalParamError = unknown; + +export type PostApiVbyApiVersionRequestBodyData = { + /** + * A reusable request body + */ + body?: ModelWithString; + query?: { + /** + * This is a reusable parameter + */ + parameter?: string; + }; +}; + +export type PostApiVbyApiVersionFormDataData = { + /** + * A reusable request body + */ + body?: ModelWithString; + query?: { + /** + * This is a reusable parameter + */ + parameter?: string; + }; +}; + +export type CallWithDefaultParametersData = { + query?: { + /** + * This is a simple boolean with default value + */ + parameterBoolean?: (boolean) | null; + /** + * This is a simple enum with default value + */ + parameterEnum?: 'Success' | 'Warning' | 'Error'; + /** + * This is a simple model with default value + */ + parameterModel?: (ModelWithString) | null; + /** + * This is a simple number with default value + */ + parameterNumber?: (number) | null; + /** + * This is a simple string with default value + */ + parameterString?: (string) | null; + }; +}; + +export type CallWithDefaultOptionalParametersData = { + query?: { + /** + * This is a simple boolean that is optional with default value + */ + parameterBoolean?: boolean; + /** + * This is a simple enum that is optional with default value + */ + parameterEnum?: 'Success' | 'Warning' | 'Error'; + /** + * This is a simple model that is optional with default value + */ + parameterModel?: ModelWithString; + /** + * This is a simple number that is optional with default value + */ + parameterNumber?: number; + /** + * This is a simple string that is optional with default value + */ + parameterString?: string; + }; +}; + +export type CallToTestOrderOfParamsData = { + query: { + /** + * This is a optional string with default + */ + parameterOptionalStringWithDefault?: string; + /** + * This is a optional string with empty default + */ + parameterOptionalStringWithEmptyDefault?: string; + /** + * This is a optional string with no default + */ + parameterOptionalStringWithNoDefault?: string; + /** + * This is a string that can be null with default + */ + parameterStringNullableWithDefault?: (string) | null; + /** + * This is a string that can be null with no default + */ + parameterStringNullableWithNoDefault?: (string) | null; + /** + * This is a string with default + */ + parameterStringWithDefault: string; + /** + * This is a string with empty default + */ + parameterStringWithEmptyDefault: string; + /** + * This is a string with no default + */ + parameterStringWithNoDefault: string; + }; +}; + +export type CallWithNoContentResponseResponse = (void); + +export type CallWithNoContentResponseError = unknown; + +export type CallWithResponseAndNoContentResponseResponse = (number | void); + +export type CallWithResponseAndNoContentResponseError = unknown; + +export type DummyAResponse = (_400); + +export type DummyAError = unknown; + +export type DummyBResponse = (void); + +export type DummyBError = unknown; + +export type CallWithResponseResponse = (_import); + +export type CallWithResponseError = unknown; + +export type CallWithDuplicateResponsesResponse = ((ModelWithBoolean & ModelWithInteger) | ModelWithString); + +export type CallWithDuplicateResponsesError = (ModelWithStringError | DictionaryWithArray | ModelWithBoolean); + +export type CallWithResponsesResponse = ({ + readonly '@namespace.string'?: string; + readonly '@namespace.integer'?: number; + readonly value?: Array; +} | ModelThatExtends | ModelThatExtendsExtends); + +export type CallWithResponsesError = (ModelWithStringError); + +export type CollectionFormatData = { + query: { + /** + * This is an array parameter that is sent as csv format (comma-separated values) + */ + parameterArrayCSV: Array<(string)> | null; + /** + * This is an array parameter that is sent as multi format (multiple parameter instances) + */ + parameterArrayMulti: Array<(string)> | null; + /** + * This is an array parameter that is sent as pipes format (pipe-separated values) + */ + parameterArrayPipes: Array<(string)> | null; + /** + * This is an array parameter that is sent as ssv format (space-separated values) + */ + parameterArraySSV: Array<(string)> | null; + /** + * This is an array parameter that is sent as tsv format (tab-separated values) + */ + parameterArrayTSV: Array<(string)> | null; + }; +}; + +export type TypesData = { + path?: { + /** + * This is a number parameter + */ + id?: number; + }; + query: { + /** + * This is an array parameter + */ + parameterArray: Array<(string)> | null; + /** + * This is a boolean parameter + */ + parameterBoolean: (boolean) | null; + /** + * This is a dictionary parameter + */ + parameterDictionary: { + [key: string]: unknown; + } | null; + /** + * This is an enum parameter + */ + parameterEnum: ('Success' | 'Warning' | 'Error') | null; + /** + * This is a number parameter + */ + parameterNumber: number; + /** + * This is an object parameter + */ + parameterObject: { + [key: string]: unknown; + } | null; + /** + * This is a string parameter + */ + parameterString: (string) | null; + }; +}; + +export type TypesResponse = (number | string | boolean | { + [key: string]: unknown; +}); + +export type TypesError = unknown; + +export type UploadFileData = { + body: (Blob | File); + path: { + /** + * api-version should be required in standalone clients + */ + 'api-version': (string) | null; + }; +}; + +export type UploadFileResponse = (boolean); + +export type UploadFileError = unknown; + +export type FileResponseData = { + path: { + /** + * api-version should be required in standalone clients + */ + 'api-version': string; + id: string; + }; +}; + +export type FileResponseResponse = ((Blob | File)); + +export type FileResponseError = unknown; + +export type ComplexTypesData = { + query: { + /** + * Parameter containing object + */ + parameterObject: { + first?: { + second?: { + third?: string; + }; + }; + }; + /** + * Parameter containing reference + */ + parameterReference: ModelWithString; + }; +}; + +export type ComplexTypesResponse = (Array); + +export type ComplexTypesError = (unknown); + +export type MultipartRequestData = { + body?: { + content?: (Blob | File); + data?: ((ModelWithString) | null); + }; +}; + +export type MultipartResponseResponse = ({ + file?: (Blob | File); + metadata?: { + foo?: string; + bar?: string; + }; +}); + +export type MultipartResponseError = unknown; + +export type ComplexParamsData = { + body?: { + readonly key: (string) | null; + name: (string) | null; + enabled?: boolean; + readonly type: 'Monkey' | 'Horse' | 'Bird'; + listOfModels?: Array | null; + listOfStrings?: Array<(string)> | null; + parameters: (ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary); + readonly user?: { + readonly id?: number; + readonly name?: (string) | null; + }; + }; + path: { + /** + * api-version should be required in standalone clients + */ + 'api-version': string; + id: number; + }; +}; + +export type ComplexParamsResponse = (ModelWithString); + +export type ComplexParamsError = unknown; + +export type CallWithResultFromHeaderResponse = (string); + +export type CallWithResultFromHeaderError = (unknown); + +export type TestErrorCodeData = { + query: { + /** + * Status code to return + */ + status: number; + }; +}; + +export type TestErrorCodeResponse = (unknown); + +export type TestErrorCodeError = (unknown); + +export type NonAsciiæøåÆøÅöôêÊ字符串Data = { + query: { + /** + * Dummy input param + */ + nonAsciiParamæøåÆØÅöôêÊ: number; + }; +}; + +export type NonAsciiæøåÆøÅöôêÊ字符串Response = (Array); + +export type NonAsciiæøåÆøÅöôêÊ字符串Error = unknown; + +export type PutWithFormUrlEncodedData = { + body: ArrayWithStrings; +}; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/svelte-query/asClass/@tanstack/svelte-query.gen.ts b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/svelte-query/asClass/@tanstack/svelte-query.gen.ts new file mode 100644 index 000000000..5891d67f9 --- /dev/null +++ b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/svelte-query/asClass/@tanstack/svelte-query.gen.ts @@ -0,0 +1,997 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import type { Options } from '@hey-api/client-fetch'; +import { queryOptions, type MutationOptions, type DefaultError, infiniteQueryOptions, type InfiniteData } from '@tanstack/svelte-query'; +import type { CollectionFormatData, ComplexTypesData, ComplexParamsData, ComplexParamsError, ComplexParamsResponse, ImportData, ImportError, ImportResponse, GetApiVbyApiVersionSimpleOperationData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, DeprecatedCallData, CallWithDescriptionsData, TestErrorCodeData, TestErrorCodeError, TestErrorCodeResponse, FileResponseData, PostApiVbyApiVersionFormDataData, CallWithResultFromHeaderError, CallWithResultFromHeaderResponse, MultipartRequestData, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Error, NonAsciiæøåÆøÅöôêÊ字符串Response, PutWithFormUrlEncodedData, DeleteFooData3, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamData, PostCallWithOptionalParamError, PostCallWithOptionalParamResponse, PostApiVbyApiVersionRequestBodyData, CallWithDuplicateResponsesError, CallWithDuplicateResponsesResponse, CallWithResponsesError, CallWithResponsesResponse, TypesData, UploadFileData, UploadFileError, UploadFileResponse } from '../types.gen'; +import { client, CollectionFormatService, ComplexService, DefaultService, DefaultsService, DeprecatedService, DescriptionsService, DuplicateService, ErrorService, FileResponseService, FormDataService, HeaderService, MultipartService, MultipleTags1Service, NoContentService, NonAsciiÆøåÆøÅöôêÊService, ParametersService, RequestBodyService, ResponseService, SimpleService, TypesService, UploadService } from '../services.gen'; + +type QueryKey = [ + Pick & { + _id: string; + _infinite?: boolean; + } +]; + +const createQueryKey = (id: string, options?: TOptions, infinite?: boolean): QueryKey[0] => { + const params: QueryKey[0] = { _id: id, baseUrl: (options?.client ?? client).getConfig().baseUrl } as QueryKey[0]; + if (infinite) { + params._infinite = infinite; + } + if (options?.body) { + params.body = options.body; + } + if (options?.headers) { + params.headers = options.headers; + } + if (options?.path) { + params.path = options.path; + } + if (options?.query) { + params.query = options.query; + } + return params; +}; + +export const collectionFormatQueryKey = (options: Options) => [ + createQueryKey("collectionFormat", options) +]; + +export const collectionFormatOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await CollectionFormatService.collectionFormat({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: collectionFormatQueryKey(options) +}); }; + +export const complexTypesQueryKey = (options: Options) => [ + createQueryKey("complexTypes", options) +]; + +export const complexTypesOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await ComplexService.complexTypes({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: complexTypesQueryKey(options) +}); }; + +export const complexParamsMutation = () => { const mutationOptions: MutationOptions> = { + mutationFn: async (options) => { + const { data } = await ComplexService.complexParams({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const exportQueryKey = (options?: Options) => [ + createQueryKey("export", options) +]; + +export const exportOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await DefaultService.export({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: exportQueryKey(options) +}); }; + +export const importQueryKey = (options: Options) => [ + createQueryKey("import", options) +]; + +export const importOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await DefaultService.import({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: importQueryKey(options) +}); }; + +export const importMutation = () => { const mutationOptions: MutationOptions> = { + mutationFn: async (options) => { + const { data } = await DefaultService.import({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const getApiVbyApiVersionSimpleOperationQueryKey = (options: Options) => [ + createQueryKey("getApiVbyApiVersionSimpleOperation", options) +]; + +export const getApiVbyApiVersionSimpleOperationOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await DefaultService.getApiVbyApiVersionSimpleOperation({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: getApiVbyApiVersionSimpleOperationQueryKey(options) +}); }; + +export const callWithDefaultParametersQueryKey = (options?: Options) => [ + createQueryKey("callWithDefaultParameters", options) +]; + +export const callWithDefaultParametersOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await DefaultsService.callWithDefaultParameters({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: callWithDefaultParametersQueryKey(options) +}); }; + +export const callWithDefaultOptionalParametersQueryKey = (options?: Options) => [ + createQueryKey("callWithDefaultOptionalParameters", options) +]; + +export const callWithDefaultOptionalParametersOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await DefaultsService.callWithDefaultOptionalParameters({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: callWithDefaultOptionalParametersQueryKey(options) +}); }; + +export const callWithDefaultOptionalParametersMutation = () => { const mutationOptions: MutationOptions> = { + mutationFn: async (options) => { + const { data } = await DefaultsService.callWithDefaultOptionalParameters({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const callToTestOrderOfParamsMutation = () => { const mutationOptions: MutationOptions> = { + mutationFn: async (options) => { + const { data } = await DefaultsService.callToTestOrderOfParams({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const deprecatedCallQueryKey = (options: Options) => [ + createQueryKey("deprecatedCall", options) +]; + +export const deprecatedCallOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await DeprecatedService.deprecatedCall({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: deprecatedCallQueryKey(options) +}); }; + +export const deprecatedCallMutation = () => { const mutationOptions: MutationOptions> = { + mutationFn: async (options) => { + const { data } = await DeprecatedService.deprecatedCall({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const callWithDescriptionsQueryKey = (options?: Options) => [ + createQueryKey("callWithDescriptions", options) +]; + +export const callWithDescriptionsOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await DescriptionsService.callWithDescriptions({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: callWithDescriptionsQueryKey(options) +}); }; + +export const callWithDescriptionsMutation = () => { const mutationOptions: MutationOptions> = { + mutationFn: async (options) => { + const { data } = await DescriptionsService.callWithDescriptions({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const duplicateNameQueryKey = (options?: Options) => [ + createQueryKey("duplicateName", options) +]; + +export const duplicateNameOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await DuplicateService.duplicateName({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: duplicateNameQueryKey(options) +}); }; + +export const duplicateName1QueryKey = (options?: Options) => [ + createQueryKey("duplicateName1", options) +]; + +export const duplicateName1Options = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await DuplicateService.duplicateName1({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: duplicateName1QueryKey(options) +}); }; + +export const duplicateName1Mutation = () => { const mutationOptions: MutationOptions = { + mutationFn: async (options) => { + const { data } = await DuplicateService.duplicateName1({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const duplicateName2Mutation = () => { const mutationOptions: MutationOptions = { + mutationFn: async (options) => { + const { data } = await DuplicateService.duplicateName2({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const duplicateName3Mutation = () => { const mutationOptions: MutationOptions = { + mutationFn: async (options) => { + const { data } = await DuplicateService.duplicateName3({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const testErrorCodeQueryKey = (options: Options) => [ + createQueryKey("testErrorCode", options) +]; + +export const testErrorCodeOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await ErrorService.testErrorCode({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: testErrorCodeQueryKey(options) +}); }; + +export const testErrorCodeMutation = () => { const mutationOptions: MutationOptions> = { + mutationFn: async (options) => { + const { data } = await ErrorService.testErrorCode({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const fileResponseQueryKey = (options: Options) => [ + createQueryKey("fileResponse", options) +]; + +export const fileResponseOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await FileResponseService.fileResponse({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: fileResponseQueryKey(options) +}); }; + +export const postApiVbyApiVersionFormDataQueryKey = (options?: Options) => [ + createQueryKey("postApiVbyApiVersionFormData", options) +]; + +export const postApiVbyApiVersionFormDataOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await FormDataService.postApiVbyApiVersionFormData({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: postApiVbyApiVersionFormDataQueryKey(options) +}); }; + +export const postApiVbyApiVersionFormDataMutation = () => { const mutationOptions: MutationOptions> = { + mutationFn: async (options) => { + const { data } = await FormDataService.postApiVbyApiVersionFormData({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const callWithResultFromHeaderQueryKey = (options?: Options) => [ + createQueryKey("callWithResultFromHeader", options) +]; + +export const callWithResultFromHeaderOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await HeaderService.callWithResultFromHeader({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: callWithResultFromHeaderQueryKey(options) +}); }; + +export const callWithResultFromHeaderMutation = () => { const mutationOptions: MutationOptions = { + mutationFn: async (options) => { + const { data } = await HeaderService.callWithResultFromHeader({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const multipartRequestQueryKey = (options?: Options) => [ + createQueryKey("multipartRequest", options) +]; + +export const multipartRequestOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await MultipartService.multipartRequest({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: multipartRequestQueryKey(options) +}); }; + +export const multipartRequestMutation = () => { const mutationOptions: MutationOptions> = { + mutationFn: async (options) => { + const { data } = await MultipartService.multipartRequest({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const multipartResponseQueryKey = (options?: Options) => [ + createQueryKey("multipartResponse", options) +]; + +export const multipartResponseOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await MultipartService.multipartResponse({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: multipartResponseQueryKey(options) +}); }; + +export const dummyAQueryKey = (options?: Options) => [ + createQueryKey("dummyA", options) +]; + +export const dummyAOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await MultipleTags1Service.dummyA({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: dummyAQueryKey(options) +}); }; + +export const dummyBQueryKey = (options?: Options) => [ + createQueryKey("dummyB", options) +]; + +export const dummyBOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await MultipleTags1Service.dummyB({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: dummyBQueryKey(options) +}); }; + +export const callWithNoContentResponseQueryKey = (options?: Options) => [ + createQueryKey("callWithNoContentResponse", options) +]; + +export const callWithNoContentResponseOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await NoContentService.callWithNoContentResponse({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: callWithNoContentResponseQueryKey(options) +}); }; + +export const callWithResponseAndNoContentResponseQueryKey = (options?: Options) => [ + createQueryKey("callWithResponseAndNoContentResponse", options) +]; + +export const callWithResponseAndNoContentResponseOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await NoContentService.callWithResponseAndNoContentResponse({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: callWithResponseAndNoContentResponseQueryKey(options) +}); }; + +export const nonAsciiæøåÆøÅöôêÊ字符串QueryKey = (options: Options) => [ + createQueryKey("nonAsciiæøåÆøÅöôêÊ字符串", options) +]; + +export const nonAsciiæøåÆøÅöôêÊ字符串Options = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await NonAsciiÆøåÆøÅöôêÊService.nonAsciiæøåÆøÅöôêÊ字符串({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: nonAsciiæøåÆøÅöôêÊ字符串QueryKey(options) +}); }; + +export const nonAsciiæøåÆøÅöôêÊ字符串Mutation = () => { const mutationOptions: MutationOptions> = { + mutationFn: async (options) => { + const { data } = await NonAsciiÆøåÆøÅöôêÊService.nonAsciiæøåÆøÅöôêÊ字符串({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const putWithFormUrlEncodedMutation = () => { const mutationOptions: MutationOptions> = { + mutationFn: async (options) => { + const { data } = await NonAsciiÆøåÆøÅöôêÊService.putWithFormUrlEncoded({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const deleteFooMutation = () => { const mutationOptions: MutationOptions> = { + mutationFn: async (options) => { + const { data } = await ParametersService.deleteFoo({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const callWithParametersQueryKey = (options: Options) => [ + createQueryKey("callWithParameters", options) +]; + +export const callWithParametersOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await ParametersService.callWithParameters({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: callWithParametersQueryKey(options) +}); }; + +export const callWithParametersInfiniteQueryKey = (options: Options): QueryKey> => [ + createQueryKey("callWithParameters", options, true) +]; + +export const callWithParametersInfiniteOptions = (options: Options) => { return infiniteQueryOptions, QueryKey>, string | Pick>[0], 'body' | 'headers' | 'path' | 'query'>>( +// @ts-ignore +{ + queryFn: async ({ pageParam, queryKey }) => { + // @ts-ignore + const page: Pick>[0], 'body' | 'headers' | 'path' | 'query'> = typeof pageParam === "object" ? pageParam : { + query: { + cursor: pageParam + } + }; + const params: Partial> = {}; + if (page.body) { + params.body = { + ...queryKey[0].body as any, + ...page.body as any + }; + } + if (page.headers) { + params.headers = { + ...queryKey[0].headers, + ...page.headers + }; + } + if (page.path) { + params.path = { + ...queryKey[0].path, + ...page.path + }; + } + if (page.query) { + params.query = { + ...queryKey[0].query, + ...page.query + }; + } + const { data } = await ParametersService.callWithParameters({ + ...options, + ...queryKey[0], + ...params, + throwOnError: true + }); + return data; + }, + queryKey: callWithParametersInfiniteQueryKey(options) +}); }; + +export const callWithParametersMutation = () => { const mutationOptions: MutationOptions> = { + mutationFn: async (options) => { + const { data } = await ParametersService.callWithParameters({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const callWithWeirdParameterNamesQueryKey = (options: Options) => [ + createQueryKey("callWithWeirdParameterNames", options) +]; + +export const callWithWeirdParameterNamesOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await ParametersService.callWithWeirdParameterNames({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: callWithWeirdParameterNamesQueryKey(options) +}); }; + +export const callWithWeirdParameterNamesMutation = () => { const mutationOptions: MutationOptions> = { + mutationFn: async (options) => { + const { data } = await ParametersService.callWithWeirdParameterNames({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const getCallWithOptionalParamQueryKey = (options: Options) => [ + createQueryKey("getCallWithOptionalParam", options) +]; + +export const getCallWithOptionalParamOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await ParametersService.getCallWithOptionalParam({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: getCallWithOptionalParamQueryKey(options) +}); }; + +export const getCallWithOptionalParamInfiniteQueryKey = (options: Options): QueryKey> => [ + createQueryKey("getCallWithOptionalParam", options, true) +]; + +export const getCallWithOptionalParamInfiniteOptions = (options: Options) => { return infiniteQueryOptions, QueryKey>, number | Pick>[0], 'body' | 'headers' | 'path' | 'query'>>( +// @ts-ignore +{ + queryFn: async ({ pageParam, queryKey }) => { + // @ts-ignore + const page: Pick>[0], 'body' | 'headers' | 'path' | 'query'> = typeof pageParam === "object" ? pageParam : { + query: { + page: pageParam + } + }; + const params: Partial> = {}; + if (page.body) { + params.body = { + ...queryKey[0].body as any, + ...page.body as any + }; + } + if (page.headers) { + params.headers = { + ...queryKey[0].headers, + ...page.headers + }; + } + if (page.path) { + params.path = { + ...queryKey[0].path, + ...page.path + }; + } + if (page.query) { + params.query = { + ...queryKey[0].query, + ...page.query + }; + } + const { data } = await ParametersService.getCallWithOptionalParam({ + ...options, + ...queryKey[0], + ...params, + throwOnError: true + }); + return data; + }, + queryKey: getCallWithOptionalParamInfiniteQueryKey(options) +}); }; + +export const postCallWithOptionalParamQueryKey = (options: Options) => [ + createQueryKey("postCallWithOptionalParam", options) +]; + +export const postCallWithOptionalParamOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await ParametersService.postCallWithOptionalParam({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: postCallWithOptionalParamQueryKey(options) +}); }; + +export const postCallWithOptionalParamInfiniteQueryKey = (options: Options): QueryKey> => [ + createQueryKey("postCallWithOptionalParam", options, true) +]; + +export const postCallWithOptionalParamInfiniteOptions = (options: Options) => { return infiniteQueryOptions, QueryKey>, number | Pick>[0], 'body' | 'headers' | 'path' | 'query'>>( +// @ts-ignore +{ + queryFn: async ({ pageParam, queryKey }) => { + // @ts-ignore + const page: Pick>[0], 'body' | 'headers' | 'path' | 'query'> = typeof pageParam === "object" ? pageParam : { + body: { + offset: pageParam + } + }; + const params: Partial> = {}; + if (page.body) { + params.body = { + ...queryKey[0].body as any, + ...page.body as any + }; + } + if (page.headers) { + params.headers = { + ...queryKey[0].headers, + ...page.headers + }; + } + if (page.path) { + params.path = { + ...queryKey[0].path, + ...page.path + }; + } + if (page.query) { + params.query = { + ...queryKey[0].query, + ...page.query + }; + } + const { data } = await ParametersService.postCallWithOptionalParam({ + ...options, + ...queryKey[0], + ...params, + throwOnError: true + }); + return data; + }, + queryKey: postCallWithOptionalParamInfiniteQueryKey(options) +}); }; + +export const postCallWithOptionalParamMutation = () => { const mutationOptions: MutationOptions> = { + mutationFn: async (options) => { + const { data } = await ParametersService.postCallWithOptionalParam({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const postApiVbyApiVersionRequestBodyQueryKey = (options?: Options) => [ + createQueryKey("postApiVbyApiVersionRequestBody", options) +]; + +export const postApiVbyApiVersionRequestBodyOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await RequestBodyService.postApiVbyApiVersionRequestBody({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: postApiVbyApiVersionRequestBodyQueryKey(options) +}); }; + +export const postApiVbyApiVersionRequestBodyMutation = () => { const mutationOptions: MutationOptions> = { + mutationFn: async (options) => { + const { data } = await RequestBodyService.postApiVbyApiVersionRequestBody({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const callWithResponseQueryKey = (options?: Options) => [ + createQueryKey("callWithResponse", options) +]; + +export const callWithResponseOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await ResponseService.callWithResponse({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: callWithResponseQueryKey(options) +}); }; + +export const callWithDuplicateResponsesQueryKey = (options?: Options) => [ + createQueryKey("callWithDuplicateResponses", options) +]; + +export const callWithDuplicateResponsesOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await ResponseService.callWithDuplicateResponses({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: callWithDuplicateResponsesQueryKey(options) +}); }; + +export const callWithDuplicateResponsesMutation = () => { const mutationOptions: MutationOptions = { + mutationFn: async (options) => { + const { data } = await ResponseService.callWithDuplicateResponses({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const callWithResponsesMutation = () => { const mutationOptions: MutationOptions = { + mutationFn: async (options) => { + const { data } = await ResponseService.callWithResponses({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const apiVVersionOdataControllerCountQueryKey = (options?: Options) => [ + createQueryKey("apiVVersionOdataControllerCount", options) +]; + +export const apiVVersionOdataControllerCountOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await SimpleService.apiVVersionOdataControllerCount({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: apiVVersionOdataControllerCountQueryKey(options) +}); }; + +export const getCallWithoutParametersAndResponseQueryKey = (options?: Options) => [ + createQueryKey("getCallWithoutParametersAndResponse", options) +]; + +export const getCallWithoutParametersAndResponseOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await SimpleService.getCallWithoutParametersAndResponse({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: getCallWithoutParametersAndResponseQueryKey(options) +}); }; + +export const putCallWithoutParametersAndResponseMutation = () => { const mutationOptions: MutationOptions = { + mutationFn: async (options) => { + const { data } = await SimpleService.putCallWithoutParametersAndResponse({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const postCallWithoutParametersAndResponseQueryKey = (options?: Options) => [ + createQueryKey("postCallWithoutParametersAndResponse", options) +]; + +export const postCallWithoutParametersAndResponseOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await SimpleService.postCallWithoutParametersAndResponse({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: postCallWithoutParametersAndResponseQueryKey(options) +}); }; + +export const postCallWithoutParametersAndResponseMutation = () => { const mutationOptions: MutationOptions = { + mutationFn: async (options) => { + const { data } = await SimpleService.postCallWithoutParametersAndResponse({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const deleteCallWithoutParametersAndResponseMutation = () => { const mutationOptions: MutationOptions = { + mutationFn: async (options) => { + const { data } = await SimpleService.deleteCallWithoutParametersAndResponse({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const patchCallWithoutParametersAndResponseMutation = () => { const mutationOptions: MutationOptions = { + mutationFn: async (options) => { + const { data } = await SimpleService.patchCallWithoutParametersAndResponse({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const typesQueryKey = (options: Options) => [ + createQueryKey("types", options) +]; + +export const typesOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await TypesService.types({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: typesQueryKey(options) +}); }; + +export const uploadFileQueryKey = (options: Options) => [ + createQueryKey("uploadFile", options) +]; + +export const uploadFileOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await UploadService.uploadFile({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: uploadFileQueryKey(options) +}); }; + +export const uploadFileMutation = () => { const mutationOptions: MutationOptions> = { + mutationFn: async (options) => { + const { data } = await UploadService.uploadFile({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-vue-query/index.ts.snap b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/svelte-query/asClass/index.ts similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-vue-query/index.ts.snap rename to packages/openapi-ts/test/__snapshots__/plugins/@tanstack/svelte-query/asClass/index.ts diff --git a/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/svelte-query/asClass/services.gen.ts b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/svelte-query/asClass/services.gen.ts new file mode 100644 index 000000000..2b3087c92 --- /dev/null +++ b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/svelte-query/asClass/services.gen.ts @@ -0,0 +1,451 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { createClient, createConfig, type Options, formDataBodySerializer, urlSearchParamsBodySerializer } from '@hey-api/client-fetch'; +import type { ImportData, ImportError, ImportResponse, GetApiVbyApiVersionSimpleOperationData, GetApiVbyApiVersionSimpleOperationError, GetApiVbyApiVersionSimpleOperationResponse, ApiVversionOdataControllerCountError, ApiVversionOdataControllerCountResponse, DeleteFooData3, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamData, PostCallWithOptionalParamError, PostCallWithOptionalParamResponse, CallWithDescriptionsData, DeprecatedCallData, PostApiVbyApiVersionRequestBodyData, PostApiVbyApiVersionFormDataData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, CallWithNoContentResponseError, CallWithNoContentResponseResponse, CallWithResponseAndNoContentResponseError, CallWithResponseAndNoContentResponseResponse, CallWithResponseError, CallWithResponseResponse, CallWithDuplicateResponsesError, CallWithDuplicateResponsesResponse, CallWithResponsesError, CallWithResponsesResponse, DummyAError, DummyAResponse, DummyBError, DummyBResponse, CollectionFormatData, TypesData, TypesError, TypesResponse, UploadFileData, UploadFileError, UploadFileResponse, FileResponseData, FileResponseError, FileResponseResponse, ComplexTypesData, ComplexTypesError, ComplexTypesResponse, ComplexParamsData, ComplexParamsError, ComplexParamsResponse, MultipartRequestData, MultipartResponseError, MultipartResponseResponse, CallWithResultFromHeaderError, CallWithResultFromHeaderResponse, TestErrorCodeData, TestErrorCodeError, TestErrorCodeResponse, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Error, NonAsciiæøåÆøÅöôêÊ字符串Response, PutWithFormUrlEncodedData } from './types.gen'; + +export const client = createClient(createConfig()); + +export class DefaultService { + public static export(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/no-tag' + }); + } + + public static import(options: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/no-tag' + }); + } + + public static getApiVbyApiVersionSimpleOperation(options: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/simple:operation' + }); + } + +} + +export class SimpleService { + public static apiVVersionOdataControllerCount(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/simple/$count' + }); + } + + public static getCallWithoutParametersAndResponse(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/simple' + }); + } + + public static putCallWithoutParametersAndResponse(options?: Options) { + return (options?.client ?? client).put({ + ...options, + url: '/api/v{api-version}/simple' + }); + } + + public static postCallWithoutParametersAndResponse(options?: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/simple' + }); + } + + public static deleteCallWithoutParametersAndResponse(options?: Options) { + return (options?.client ?? client).delete({ + ...options, + url: '/api/v{api-version}/simple' + }); + } + + public static optionsCallWithoutParametersAndResponse(options?: Options) { + return (options?.client ?? client).options({ + ...options, + url: '/api/v{api-version}/simple' + }); + } + + public static headCallWithoutParametersAndResponse(options?: Options) { + return (options?.client ?? client).head({ + ...options, + url: '/api/v{api-version}/simple' + }); + } + + public static patchCallWithoutParametersAndResponse(options?: Options) { + return (options?.client ?? client).patch({ + ...options, + url: '/api/v{api-version}/simple' + }); + } + +} + +export class ParametersService { + public static deleteFoo(options: Options) { + return (options?.client ?? client).delete({ + ...options, + url: '/api/v{api-version}/foo/{foo_param}/bar/{BarParam}' + }); + } + + public static callWithParameters(options: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/parameters/{parameterPath}' + }); + } + + public static callWithWeirdParameterNames(options: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/parameters/{parameter.path.1}/{parameter-path-2}/{PARAMETER-PATH-3}' + }); + } + + public static getCallWithOptionalParam(options: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/parameters/' + }); + } + + public static postCallWithOptionalParam(options: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/parameters/' + }); + } + +} + +export class DescriptionsService { + public static callWithDescriptions(options?: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/descriptions/' + }); + } + +} + +export class DeprecatedService { + /** + * @deprecated + */ + public static deprecatedCall(options: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/parameters/deprecated' + }); + } + +} + +export class RequestBodyService { + public static postApiVbyApiVersionRequestBody(options?: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/requestBody/' + }); + } + +} + +export class FormDataService { + public static postApiVbyApiVersionFormData(options?: Options) { + return (options?.client ?? client).post({ + ...options, + ...formDataBodySerializer, + headers: { + 'Content-Type': null, + ...options?.headers + }, + url: '/api/v{api-version}/formData/' + }); + } + +} + +export class DefaultsService { + public static callWithDefaultParameters(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/defaults' + }); + } + + public static callWithDefaultOptionalParameters(options?: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/defaults' + }); + } + + public static callToTestOrderOfParams(options: Options) { + return (options?.client ?? client).put({ + ...options, + url: '/api/v{api-version}/defaults' + }); + } + +} + +export class DuplicateService { + public static duplicateName(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/duplicate' + }); + } + + public static duplicateName1(options?: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/duplicate' + }); + } + + public static duplicateName2(options?: Options) { + return (options?.client ?? client).put({ + ...options, + url: '/api/v{api-version}/duplicate' + }); + } + + public static duplicateName3(options?: Options) { + return (options?.client ?? client).delete({ + ...options, + url: '/api/v{api-version}/duplicate' + }); + } + +} + +export class NoContentService { + public static callWithNoContentResponse(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/no-content' + }); + } + + public static callWithResponseAndNoContentResponse(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/multiple-tags/response-and-no-content' + }); + } + +} + +export class ResponseService { + public static callWithResponseAndNoContentResponse(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/multiple-tags/response-and-no-content' + }); + } + + public static callWithResponse(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/response' + }); + } + + public static callWithDuplicateResponses(options?: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/response' + }); + } + + public static callWithResponses(options?: Options) { + return (options?.client ?? client).put({ + ...options, + url: '/api/v{api-version}/response' + }); + } + +} + +export class MultipleTags1Service { + public static dummyA(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/multiple-tags/a' + }); + } + + public static dummyB(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/multiple-tags/b' + }); + } + +} + +export class MultipleTags2Service { + public static dummyA(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/multiple-tags/a' + }); + } + + public static dummyB(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/multiple-tags/b' + }); + } + +} + +export class MultipleTags3Service { + public static dummyB(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/multiple-tags/b' + }); + } + +} + +export class CollectionFormatService { + public static collectionFormat(options: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/collectionFormat' + }); + } + +} + +export class TypesService { + public static types(options: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/types' + }); + } + +} + +export class UploadService { + public static uploadFile(options: Options) { + return (options?.client ?? client).post({ + ...options, + ...urlSearchParamsBodySerializer, + headers: { + 'Content-Type': 'application/x-www-form-urlencoded', + ...options?.headers + }, + url: '/api/v{api-version}/upload' + }); + } + +} + +export class FileResponseService { + public static fileResponse(options: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/file/{id}' + }); + } + +} + +export class ComplexService { + public static complexTypes(options: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/complex' + }); + } + + public static complexParams(options: Options) { + return (options?.client ?? client).put({ + ...options, + url: '/api/v{api-version}/complex/{id}' + }); + } + +} + +export class MultipartService { + public static multipartRequest(options?: Options) { + return (options?.client ?? client).post({ + ...options, + ...formDataBodySerializer, + headers: { + 'Content-Type': null, + ...options?.headers + }, + url: '/api/v{api-version}/multipart' + }); + } + + public static multipartResponse(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/multipart' + }); + } + +} + +export class HeaderService { + public static callWithResultFromHeader(options?: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/header' + }); + } + +} + +export class ErrorService { + public static testErrorCode(options: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/error' + }); + } + +} + +export class NonAsciiÆøåÆøÅöôêÊService { + public static nonAsciiæøåÆøÅöôêÊ字符串(options: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串' + }); + } + + /** + * Login User + */ + public static putWithFormUrlEncoded(options: Options) { + return (options?.client ?? client).put({ + ...options, + ...urlSearchParamsBodySerializer, + headers: { + 'Content-Type': 'application/x-www-form-urlencoded', + ...options?.headers + }, + url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串' + }); + } + +} \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/svelte-query/asClass/types.gen.ts b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/svelte-query/asClass/types.gen.ts new file mode 100644 index 000000000..a48ba3ea4 --- /dev/null +++ b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/svelte-query/asClass/types.gen.ts @@ -0,0 +1,1507 @@ +// This file is auto-generated by @hey-api/openapi-ts + +/** + * Model with number-only name + */ +export type _400 = string; + +/** + * Testing multiline comments in string: First line + * Second line + * + * Fourth line + */ +export type camelCaseCommentWithBreaks = number; + +/** + * Testing multiline comments in string: First line + * Second line + * + * Fourth line + */ +export type CommentWithBreaks = number; + +/** + * Testing backticks in string: `backticks` and ```multiple backticks``` should work + */ +export type CommentWithBackticks = number; + +/** + * Testing backticks and quotes in string: `backticks`, 'quotes', "double quotes" and ```multiple backticks``` should work + */ +export type CommentWithBackticksAndQuotes = number; + +/** + * Testing slashes in string: \backwards\\\ and /forwards/// should work + */ +export type CommentWithSlashes = number; + +/** + * Testing expression placeholders in string: ${expression} should work + */ +export type CommentWithExpressionPlaceholders = number; + +/** + * Testing quotes in string: 'single quote''' and "double quotes""" should work + */ +export type CommentWithQuotes = number; + +/** + * Testing reserved characters in string: * inline * and ** inline ** should work + */ +export type CommentWithReservedCharacters = number; + +/** + * This is a simple number + */ +export type SimpleInteger = number; + +/** + * This is a simple boolean + */ +export type SimpleBoolean = boolean; + +/** + * This is a simple string + */ +export type SimpleString = string; + +/** + * A string with non-ascii (unicode) characters valid in typescript identifiers (æøåÆØÅöÔèÈ字符串) + */ +export type NonAsciiStringæøåÆØÅöôêÊ字符串 = string; + +/** + * This is a simple file + */ +export type SimpleFile = (Blob | File); + +/** + * This is a simple reference + */ +export type SimpleReference = ModelWithString; + +/** + * This is a simple string + */ +export type SimpleStringWithPattern = (string) | null; + +/** + * This is a simple enum with strings + */ +export type EnumWithStrings = 'Success' | 'Warning' | 'Error' | "'Single Quote'" | '"Double Quotes"' | 'Non-ascii: øæåôöØÆÅÔÖ字符串'; + +export type EnumWithReplacedCharacters = "'Single Quote'" | '"Double Quotes"' | 'øæåôöØÆÅÔÖ字符串' | 3.1 | ''; + +/** + * This is a simple enum with numbers + */ +export type EnumWithNumbers = 1 | 2 | 3 | 1.1 | 1.2 | 1.3 | 100 | 200 | 300 | -100 | -200 | -300 | -1.1 | -1.2 | -1.3; + +/** + * Success=1,Warning=2,Error=3 + */ +export type EnumFromDescription = number; + +/** + * This is a simple enum with numbers + */ +export type EnumWithExtensions = 200 | 400 | 500; + +export type EnumWithXEnumNames = 0 | 1 | 2; + +/** + * This is a simple array with numbers + */ +export type ArrayWithNumbers = Array<(number)>; + +/** + * This is a simple array with booleans + */ +export type ArrayWithBooleans = Array<(boolean)>; + +/** + * This is a simple array with strings + */ +export type ArrayWithStrings = Array<(string)>; + +/** + * This is a simple array with references + */ +export type ArrayWithReferences = Array; + +/** + * This is a simple array containing an array + */ +export type ArrayWithArray = Array>; + +/** + * This is a simple array with properties + */ +export type ArrayWithProperties = Array<{ + '16x16'?: camelCaseCommentWithBreaks; + bar?: string; +}>; + +/** + * This is a simple array with any of properties + */ +export type ArrayWithAnyOfProperties = Array<({ + foo?: string; +} | { + bar?: string; +})>; + +export type AnyOfAnyAndNull = { + data?: (unknown | null); +}; + +/** + * This is a simple array with any of properties + */ +export type AnyOfArrays = { + results?: Array<({ + foo?: string; +} | { + bar?: string; +})>; +}; + +/** + * This is a string dictionary + */ +export type DictionaryWithString = { + [key: string]: (string); +}; + +export type DictionaryWithPropertiesAndAdditionalProperties = { + foo?: number; + bar?: boolean; + [key: string]: (string | number | boolean) | undefined; +}; + +/** + * This is a string reference + */ +export type DictionaryWithReference = { + [key: string]: ModelWithString; +}; + +/** + * This is a complex dictionary + */ +export type DictionaryWithArray = { + [key: string]: Array; +}; + +/** + * This is a string dictionary + */ +export type DictionaryWithDictionary = { + [key: string]: { + [key: string]: (string); + }; +}; + +/** + * This is a complex dictionary + */ +export type DictionaryWithProperties = { + [key: string]: { + foo?: string; + bar?: string; + }; +}; + +/** + * This is a model with one number property + */ +export type ModelWithInteger = { + /** + * This is a simple number property + */ + prop?: number; +}; + +/** + * This is a model with one boolean property + */ +export type ModelWithBoolean = { + /** + * This is a simple boolean property + */ + prop?: boolean; +}; + +/** + * This is a model with one string property + */ +export type ModelWithString = { + /** + * This is a simple string property + */ + prop?: string; +}; + +/** + * This is a model with one string property + */ +export type ModelWithStringError = { + /** + * This is a simple string property + */ + prop?: string; +}; + +/** + * `Comment` or `VoiceComment`. The JSON object for adding voice comments to tickets is different. See [Adding voice comments to tickets](/documentation/ticketing/managing-tickets/adding-voice-comments-to-tickets) + */ +export type Model_From_Zendesk = string; + +/** + * This is a model with one string property + */ +export type ModelWithNullableString = { + /** + * This is a simple string property + */ + nullableProp1?: (string) | null; + /** + * This is a simple string property + */ + nullableRequiredProp1: (string) | null; + /** + * This is a simple string property + */ + nullableProp2?: (string) | null; + /** + * This is a simple string property + */ + nullableRequiredProp2: (string) | null; + /** + * This is a simple enum with strings + */ + 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; +}; + +/** + * This is a simple enum with strings + */ +export type foo_bar_enum = 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; + +/** + * This is a model with one enum + */ +export type ModelWithEnum = { + /** + * This is a simple enum with strings + */ + 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; + /** + * These are the HTTP error code enums + */ + statusCode?: '100' | '200 FOO' | '300 FOO_BAR' | '400 foo-bar' | '500 foo.bar' | '600 foo&bar'; + /** + * Simple boolean enum + */ + bool?: boolean; +}; + +/** + * These are the HTTP error code enums + */ +export type statusCode = '100' | '200 FOO' | '300 FOO_BAR' | '400 foo-bar' | '500 foo.bar' | '600 foo&bar'; + +/** + * This is a model with one enum with escaped name + */ +export type ModelWithEnumWithHyphen = { + 'foo-bar-baz-qux'?: '3.0'; +}; + +export type foo_bar_baz_qux = '3.0'; + +/** + * This is a model with one enum + */ +export type ModelWithEnumFromDescription = { + /** + * Success=1,Warning=2,Error=3 + */ + test?: number; +}; + +/** + * This is a model with nested enums + */ +export type ModelWithNestedEnums = { + dictionaryWithEnum?: { + [key: string]: ('Success' | 'Warning' | 'Error'); + }; + dictionaryWithEnumFromDescription?: { + [key: string]: (number); + }; + arrayWithEnum?: Array<('Success' | 'Warning' | 'Error')>; + arrayWithDescription?: Array<(number)>; + /** + * This is a simple enum with strings + */ + 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; +}; + +/** + * This is a model with one property containing a reference + */ +export type ModelWithReference = { + prop?: ModelWithProperties; +}; + +/** + * This is a model with one property containing an array + */ +export type ModelWithArrayReadOnlyAndWriteOnly = { + prop?: Array; + propWithFile?: Array<((Blob | File))>; + propWithNumber?: Array<(number)>; +}; + +/** + * This is a model with one property containing an array + */ +export type ModelWithArray = { + prop?: Array; + propWithFile?: Array<((Blob | File))>; + propWithNumber?: Array<(number)>; +}; + +/** + * This is a model with one property containing a dictionary + */ +export type ModelWithDictionary = { + prop?: { + [key: string]: (string); + }; +}; + +/** + * This is a deprecated model with a deprecated property + * @deprecated + */ +export type DeprecatedModel = { + /** + * This is a deprecated property + * @deprecated + */ + prop?: string; +}; + +/** + * This is a model with one property containing a circular reference + */ +export type ModelWithCircularReference = { + prop?: ModelWithCircularReference; +}; + +/** + * This is a model with one property with a 'one of' relationship + */ +export type CompositionWithOneOf = { + propA?: (ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary); +}; + +/** + * This is a model with one property with a 'one of' relationship where the options are not $ref + */ +export type CompositionWithOneOfAnonymous = { + propA?: ({ + propA?: string; +} | string | number); +}; + +/** + * Circle + */ +export type ModelCircle = { + kind: 'circle'; + radius?: number; +}; + +/** + * Square + */ +export type ModelSquare = { + kind: 'square'; + sideLength?: number; +}; + +/** + * This is a model with one property with a 'one of' relationship where the options are not $ref + */ +export type CompositionWithOneOfDiscriminator = ModelCircle | ModelSquare; + +/** + * This is a model with one property with a 'any of' relationship + */ +export type CompositionWithAnyOf = { + propA?: (ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary); +}; + +/** + * This is a model with one property with a 'any of' relationship where the options are not $ref + */ +export type CompositionWithAnyOfAnonymous = { + propA?: ({ + propA?: string; +} | string | number); +}; + +/** + * This is a model with nested 'any of' property with a type null + */ +export type CompositionWithNestedAnyAndTypeNull = { + propA?: (Array<(ModelWithDictionary | null)> | Array<(ModelWithArray | null)>); +}; + +export type _3e_num_1Период = 'Bird' | 'Dog'; + +export type ConstValue = "ConstValue"; + +/** + * This is a model with one property with a 'any of' relationship where the options are not $ref + */ +export type CompositionWithNestedAnyOfAndNull = { + propA?: (Array<(_3e_num_1Период | ConstValue)> | null); +}; + +/** + * This is a model with one property with a 'one of' relationship + */ +export type CompositionWithOneOfAndNullable = { + propA?: (({ + boolean?: boolean; +} | ModelWithEnum | ModelWithArray | ModelWithDictionary) | null); +}; + +/** + * This is a model that contains a simple dictionary within composition + */ +export type CompositionWithOneOfAndSimpleDictionary = { + propA?: (boolean | { + [key: string]: (number); +}); +}; + +/** + * This is a model that contains a dictionary of simple arrays within composition + */ +export type CompositionWithOneOfAndSimpleArrayDictionary = { + propA?: (boolean | { + [key: string]: Array<(boolean)>; +}); +}; + +/** + * This is a model that contains a dictionary of complex arrays (composited) within composition + */ +export type CompositionWithOneOfAndComplexArrayDictionary = { + propA?: (boolean | { + [key: string]: Array<(number | string)>; +}); +}; + +/** + * This is a model with one property with a 'all of' relationship + */ +export type CompositionWithAllOfAndNullable = { + propA?: (({ + boolean?: boolean; +} & ModelWithEnum & ModelWithArray & ModelWithDictionary) | null); +}; + +/** + * This is a model with one property with a 'any of' relationship + */ +export type CompositionWithAnyOfAndNullable = { + propA?: (({ + boolean?: boolean; +} | ModelWithEnum | ModelWithArray | ModelWithDictionary) | null); +}; + +/** + * This is a base model with two simple optional properties + */ +export type CompositionBaseModel = { + firstName?: string; + lastname?: string; +}; + +/** + * This is a model that extends the base model + */ +export type CompositionExtendedModel = CompositionBaseModel & { + firstName: string; + lastname: string; + age: number; +}; + +/** + * This is a model with one nested property + */ +export type ModelWithProperties = { + required: string; + readonly requiredAndReadOnly: string; + requiredAndNullable: (string) | null; + string?: string; + number?: number; + boolean?: boolean; + reference?: ModelWithString; + 'property with space'?: string; + default?: string; + try?: string; + readonly '@namespace.string'?: string; + readonly '@namespace.integer'?: number; +}; + +/** + * This is a model with one nested property + */ +export type ModelWithNestedProperties = { + readonly first: { + readonly second: { + readonly third: (string) | null; + } | null; + } | null; +}; + +/** + * This is a model with duplicated properties + */ +export type ModelWithDuplicateProperties = { + prop?: ModelWithString; +}; + +/** + * This is a model with ordered properties + */ +export type ModelWithOrderedProperties = { + zebra?: string; + apple?: string; + hawaii?: string; +}; + +/** + * This is a model with duplicated imports + */ +export type ModelWithDuplicateImports = { + propA?: ModelWithString; + propB?: ModelWithString; + propC?: ModelWithString; +}; + +/** + * This is a model that extends another model + */ +export type ModelThatExtends = ModelWithString & { + propExtendsA?: string; + propExtendsB?: ModelWithString; +}; + +/** + * This is a model that extends another model + */ +export type ModelThatExtendsExtends = ModelWithString & ModelThatExtends & { + propExtendsC?: string; + propExtendsD?: ModelWithString; +}; + +/** + * This is a model that contains a some patterns + */ +export type ModelWithPattern = { + key: string; + name: string; + readonly enabled?: boolean; + readonly modified?: string; + id?: string; + text?: string; + patternWithSingleQuotes?: string; + patternWithNewline?: string; + patternWithBacktick?: string; +}; + +export type File = { + readonly id?: string; + readonly updated_at?: string; + readonly created_at?: string; + mime: string; + readonly file?: string; +}; + +export type _default = { + name?: string; +}; + +export type Pageable = { + page?: number; + size?: number; + sort?: Array<(string)>; +}; + +/** + * This is a free-form object without additionalProperties. + */ +export type FreeFormObjectWithoutAdditionalProperties = { + [key: string]: unknown; +}; + +/** + * This is a free-form object with additionalProperties: true. + */ +export type FreeFormObjectWithAdditionalPropertiesEqTrue = { + [key: string]: unknown; +}; + +/** + * This is a free-form object with additionalProperties: {}. + */ +export type FreeFormObjectWithAdditionalPropertiesEqEmptyObject = { + [key: string]: unknown; +}; + +export type ModelWithConst = { + String?: "String"; + number?: 0; + null?: null; + withType?: "Some string"; +}; + +/** + * This is a model with one property and additionalProperties: true + */ +export type ModelWithAdditionalPropertiesEqTrue = { + /** + * This is a simple string property + */ + prop?: string; + [key: string]: unknown | string; +}; + +export type NestedAnyOfArraysNullable = { + nullableArray?: (Array<(string | boolean)> | null); +}; + +export type CompositionWithOneOfAndProperties = ({ + foo: ParameterSimpleParameter; +} | { + bar: NonAsciiStringæøåÆØÅöôêÊ字符串; +}) & { + baz: (number) | null; + qux: number; +}; + +/** + * An object that can be null + */ +export type NullableObject = { + foo?: string; +} | null; + +/** + * Some % character + */ +export type CharactersInDescription = string; + +export type ModelWithNullableObject = { + data?: NullableObject; +}; + +export type ModelWithOneOfEnum = { + foo: 'Bar'; +} | { + foo: 'Baz'; +} | { + foo: 'Qux'; +} | { + content: string; + foo: 'Quux'; +} | { + content: [ + (string), + (string) + ]; + foo: 'Corge'; +}; + +export type foo = 'Bar'; + +export type ModelWithNestedArrayEnumsDataFoo = 'foo' | 'bar'; + +export type ModelWithNestedArrayEnumsDataBar = 'baz' | 'qux'; + +export type ModelWithNestedArrayEnumsData = { + foo?: Array; + bar?: Array; +}; + +export type ModelWithNestedArrayEnums = { + array_strings?: Array<(string)>; + data?: (ModelWithNestedArrayEnumsData); +}; + +export type ModelWithNestedCompositionEnums = { + foo?: (ModelWithNestedArrayEnumsDataFoo); +}; + +export type ModelWithReadOnlyAndWriteOnly = { + foo: string; + readonly bar: string; + baz: string; +}; + +export type ModelWithConstantSizeArray = [ + number, + number +]; + +export type ModelWithAnyOfConstantSizeArray = [ + (number | string), + (number | string), + (number | string) +]; + +export type ModelWithPrefixItemsConstantSizeArray = [ + ModelWithInteger, + (number | string), + string +]; + +export type ModelWithAnyOfConstantSizeArrayNullable = [ + ((number) | null | string), + ((number) | null | string), + ((number) | null | string) +]; + +export type ModelWithAnyOfConstantSizeArrayWithNSizeAndOptions = [ + (number | _import), + (number | _import) +]; + +export type ModelWithAnyOfConstantSizeArrayAndIntersect = [ + (number & string), + (number & string) +]; + +export type ModelWithNumericEnumUnion = { + /** + * Период + */ + value?: -10 | -1 | 0 | 1 | 3 | 6 | 12; +}; + +/** + * Период + */ +export type value = -10 | -1 | 0 | 1 | 3 | 6 | 12; + +/** + * Some description with `back ticks` + */ +export type ModelWithBackticksInDescription = { + /** + * The template `that` should be used for parsing and importing the contents of the CSV file. + * + *

There is one placeholder currently supported:

  • ${x} - refers to the n-th column in the CSV file, e.g. ${1}, ${2}, ...)

Example of a correct JSON template:

+ *
+     * [
+     * {
+     * "resourceType": "Asset",
+     * "identifier": {
+     * "name": "${1}",
+     * "domain": {
+     * "name": "${2}",
+     * "community": {
+     * "name": "Some Community"
+     * }
+     * }
+     * },
+     * "attributes" : {
+     * "00000000-0000-0000-0000-000000003115" : [ {
+     * "value" : "${3}"
+     * } ],
+     * "00000000-0000-0000-0000-000000000222" : [ {
+     * "value" : "${4}"
+     * } ]
+     * }
+     * }
+     * ]
+     * 
+ */ + template?: string; +}; + +export type ModelWithOneOfAndProperties = (ParameterSimpleParameter | NonAsciiStringæøåÆØÅöôêÊ字符串) & { + baz: (number) | null; + qux: number; +}; + +/** + * Model used to test deduplication strategy (unused) + */ +export type ParameterSimpleParameterUnused = string; + +/** + * Model used to test deduplication strategy + */ +export type PostServiceWithEmptyTagResponse = string; + +/** + * Model used to test deduplication strategy + */ +export type PostServiceWithEmptyTagResponse2 = string; + +/** + * Model used to test deduplication strategy + */ +export type DeleteFooData = string; + +/** + * Model used to test deduplication strategy + */ +export type DeleteFooData2 = string; + +/** + * Model with restricted keyword name + */ +export type _import = string; + +export type SchemaWithFormRestrictedKeys = { + description?: string; + 'x-enum-descriptions'?: string; + 'x-enum-varnames'?: string; + 'x-enumNames'?: string; + title?: string; + object?: { + description?: string; + 'x-enum-descriptions'?: string; + 'x-enum-varnames'?: string; + 'x-enumNames'?: string; + title?: string; + }; + array?: Array<({ + description?: string; + 'x-enum-descriptions'?: string; + 'x-enum-varnames'?: string; + 'x-enumNames'?: string; + title?: string; +})>; +}; + +/** + * This schema was giving PascalCase transformations a hard time + */ +export type io_k8s_apimachinery_pkg_apis_meta_v1_DeleteOptions = { + /** + * Must be fulfilled before a deletion is carried out. If not possible, a 409 Conflict status will be returned. + */ + preconditions?: (io_k8s_apimachinery_pkg_apis_meta_v1_Preconditions); +}; + +/** + * This schema was giving PascalCase transformations a hard time + */ +export type io_k8s_apimachinery_pkg_apis_meta_v1_Preconditions = { + /** + * Specifies the target ResourceVersion + */ + resourceVersion?: string; + /** + * Specifies the target UID. + */ + uid?: string; +}; + +export type AdditionalPropertiesUnknownIssue = { + [key: string]: (string | number); +}; + +export type AdditionalPropertiesUnknownIssue2 = { + [key: string]: (string | number); +}; + +export type AdditionalPropertiesUnknownIssue3 = string & { + entries: { + [key: string]: AdditionalPropertiesUnknownIssue; + }; +}; + +export type AdditionalPropertiesIntegerIssue = { + value: number; + [key: string]: (number) | undefined; +}; + +export type OneOfAllOfIssue = ((ConstValue | Generic_Schema_Duplicate_Issue_1_System_Boolean_) & _3e_num_1Период) | Generic_Schema_Duplicate_Issue_1_System_String_; + +export type Generic_Schema_Duplicate_Issue_1_System_Boolean_ = { + item?: boolean; + error?: (string) | null; + readonly hasError?: boolean; + data?: { + [key: string]: unknown; + }; +}; + +export type Generic_Schema_Duplicate_Issue_1_System_String_ = { + item?: (string) | null; + error?: (string) | null; + readonly hasError?: boolean; +}; + +/** + * This is a reusable parameter + */ +export type ParameterSimpleParameter = string; + +/** + * Parameter with illegal characters + */ +export type Parameterx_Foo_Bar = ModelWithString; + +export type ImportData = { + body: (ModelWithReadOnlyAndWriteOnly | ModelWithArrayReadOnlyAndWriteOnly); +}; + +export type ImportResponse = (Model_From_Zendesk | ModelWithReadOnlyAndWriteOnly); + +export type ImportError = unknown; + +export type GetApiVbyApiVersionSimpleOperationData = { + path: { + /** + * foo in method + */ + foo_param: string; + }; +}; + +export type GetApiVbyApiVersionSimpleOperationResponse = (number); + +export type GetApiVbyApiVersionSimpleOperationError = (ModelWithBoolean); + +export type ApiVversionOdataControllerCountResponse = (Model_From_Zendesk); + +export type ApiVversionOdataControllerCountError = unknown; + +export type DeleteFooData3 = { + headers: { + /** + * Parameter with illegal characters + */ + 'x-Foo-Bar': ModelWithString; + }; + path: { + /** + * bar in method + */ + BarParam: string; + /** + * foo in method + */ + foo_param: string; + }; +}; + +export type CallWithParametersData = { + /** + * This is the parameter that goes into the body + */ + body: { + [key: string]: unknown; + } | null; + headers: { + /** + * This is the parameter that goes into the header + */ + parameterHeader: (string) | null; + }; + path: { + /** + * api-version should be required in standalone clients + */ + 'api-version': (string) | null; + /** + * This is the parameter that goes into the path + */ + parameterPath: (string) | null; + }; + query: { + /** + * This is the parameter that goes into the query params + */ + cursor: (string) | null; + foo_all_of_enum: (ModelWithNestedArrayEnumsDataFoo); + foo_ref_enum?: ModelWithNestedArrayEnumsDataFoo; + }; +}; + +export type CallWithWeirdParameterNamesData = { + /** + * This is the parameter that goes into the body + */ + body: (ModelWithString) | null; + headers: { + /** + * This is the parameter that goes into the request header + */ + 'parameter.header': (string) | null; + }; + path: { + /** + * api-version should be required in standalone clients + */ + 'api-version': (string) | null; + /** + * This is the parameter that goes into the path + */ + 'parameter-path-2'?: string; + /** + * This is the parameter that goes into the path + */ + 'PARAMETER-PATH-3'?: string; + /** + * This is the parameter that goes into the path + */ + 'parameter.path.1'?: string; + }; + query: { + /** + * This is the parameter with a reserved keyword + */ + default?: string; + /** + * This is the parameter that goes into the request query params + */ + 'parameter-query': (string) | null; + }; +}; + +export type GetCallWithOptionalParamData = { + /** + * This is a required parameter + */ + body: ModelWithOneOfEnum; + query?: { + /** + * This is an optional parameter + */ + page?: number; + }; +}; + +export type PostCallWithOptionalParamData = { + /** + * This is an optional parameter + */ + body?: { + offset?: (number) | null; + }; + query: { + /** + * This is a required parameter + */ + parameter: Pageable; + }; +}; + +export type PostCallWithOptionalParamResponse = (number | void); + +export type PostCallWithOptionalParamError = unknown; + +export type CallWithDescriptionsData = { + query?: { + /** + * Testing backticks in string: `backticks` and ```multiple backticks``` should work + */ + parameterWithBackticks?: unknown; + /** + * Testing multiline comments in string: First line + * Second line + * + * Fourth line + */ + parameterWithBreaks?: unknown; + /** + * Testing expression placeholders in string: ${expression} should work + */ + parameterWithExpressionPlaceholders?: unknown; + /** + * Testing quotes in string: 'single quote''' and "double quotes""" should work + */ + parameterWithQuotes?: unknown; + /** + * Testing reserved characters in string: * inline * and ** inline ** should work + */ + parameterWithReservedCharacters?: unknown; + /** + * Testing slashes in string: \backwards\\\ and /forwards/// should work + */ + parameterWithSlashes?: unknown; + }; +}; + +export type DeprecatedCallData = { + headers: { + /** + * This parameter is deprecated + * @deprecated + */ + parameter: (DeprecatedModel) | null; + }; +}; + +export type PostApiVbyApiVersionRequestBodyData = { + /** + * A reusable request body + */ + body?: ModelWithString; + query?: { + /** + * This is a reusable parameter + */ + parameter?: string; + }; +}; + +export type PostApiVbyApiVersionFormDataData = { + /** + * A reusable request body + */ + body?: ModelWithString; + query?: { + /** + * This is a reusable parameter + */ + parameter?: string; + }; +}; + +export type CallWithDefaultParametersData = { + query?: { + /** + * This is a simple boolean with default value + */ + parameterBoolean?: (boolean) | null; + /** + * This is a simple enum with default value + */ + parameterEnum?: 'Success' | 'Warning' | 'Error'; + /** + * This is a simple model with default value + */ + parameterModel?: (ModelWithString) | null; + /** + * This is a simple number with default value + */ + parameterNumber?: (number) | null; + /** + * This is a simple string with default value + */ + parameterString?: (string) | null; + }; +}; + +export type CallWithDefaultOptionalParametersData = { + query?: { + /** + * This is a simple boolean that is optional with default value + */ + parameterBoolean?: boolean; + /** + * This is a simple enum that is optional with default value + */ + parameterEnum?: 'Success' | 'Warning' | 'Error'; + /** + * This is a simple model that is optional with default value + */ + parameterModel?: ModelWithString; + /** + * This is a simple number that is optional with default value + */ + parameterNumber?: number; + /** + * This is a simple string that is optional with default value + */ + parameterString?: string; + }; +}; + +export type CallToTestOrderOfParamsData = { + query: { + /** + * This is a optional string with default + */ + parameterOptionalStringWithDefault?: string; + /** + * This is a optional string with empty default + */ + parameterOptionalStringWithEmptyDefault?: string; + /** + * This is a optional string with no default + */ + parameterOptionalStringWithNoDefault?: string; + /** + * This is a string that can be null with default + */ + parameterStringNullableWithDefault?: (string) | null; + /** + * This is a string that can be null with no default + */ + parameterStringNullableWithNoDefault?: (string) | null; + /** + * This is a string with default + */ + parameterStringWithDefault: string; + /** + * This is a string with empty default + */ + parameterStringWithEmptyDefault: string; + /** + * This is a string with no default + */ + parameterStringWithNoDefault: string; + }; +}; + +export type CallWithNoContentResponseResponse = (void); + +export type CallWithNoContentResponseError = unknown; + +export type CallWithResponseAndNoContentResponseResponse = (number | void); + +export type CallWithResponseAndNoContentResponseError = unknown; + +export type CallWithResponseResponse = (_import); + +export type CallWithResponseError = unknown; + +export type CallWithDuplicateResponsesResponse = ((ModelWithBoolean & ModelWithInteger) | ModelWithString); + +export type CallWithDuplicateResponsesError = (ModelWithStringError | DictionaryWithArray | ModelWithBoolean); + +export type CallWithResponsesResponse = ({ + readonly '@namespace.string'?: string; + readonly '@namespace.integer'?: number; + readonly value?: Array; +} | ModelThatExtends | ModelThatExtendsExtends); + +export type CallWithResponsesError = (ModelWithStringError); + +export type DummyAResponse = (_400); + +export type DummyAError = unknown; + +export type DummyBResponse = (void); + +export type DummyBError = unknown; + +export type CollectionFormatData = { + query: { + /** + * This is an array parameter that is sent as csv format (comma-separated values) + */ + parameterArrayCSV: Array<(string)> | null; + /** + * This is an array parameter that is sent as multi format (multiple parameter instances) + */ + parameterArrayMulti: Array<(string)> | null; + /** + * This is an array parameter that is sent as pipes format (pipe-separated values) + */ + parameterArrayPipes: Array<(string)> | null; + /** + * This is an array parameter that is sent as ssv format (space-separated values) + */ + parameterArraySSV: Array<(string)> | null; + /** + * This is an array parameter that is sent as tsv format (tab-separated values) + */ + parameterArrayTSV: Array<(string)> | null; + }; +}; + +export type TypesData = { + path?: { + /** + * This is a number parameter + */ + id?: number; + }; + query: { + /** + * This is an array parameter + */ + parameterArray: Array<(string)> | null; + /** + * This is a boolean parameter + */ + parameterBoolean: (boolean) | null; + /** + * This is a dictionary parameter + */ + parameterDictionary: { + [key: string]: unknown; + } | null; + /** + * This is an enum parameter + */ + parameterEnum: ('Success' | 'Warning' | 'Error') | null; + /** + * This is a number parameter + */ + parameterNumber: number; + /** + * This is an object parameter + */ + parameterObject: { + [key: string]: unknown; + } | null; + /** + * This is a string parameter + */ + parameterString: (string) | null; + }; +}; + +export type TypesResponse = (number | string | boolean | { + [key: string]: unknown; +}); + +export type TypesError = unknown; + +export type UploadFileData = { + body: (Blob | File); + path: { + /** + * api-version should be required in standalone clients + */ + 'api-version': (string) | null; + }; +}; + +export type UploadFileResponse = (boolean); + +export type UploadFileError = unknown; + +export type FileResponseData = { + path: { + /** + * api-version should be required in standalone clients + */ + 'api-version': string; + id: string; + }; +}; + +export type FileResponseResponse = ((Blob | File)); + +export type FileResponseError = unknown; + +export type ComplexTypesData = { + query: { + /** + * Parameter containing object + */ + parameterObject: { + first?: { + second?: { + third?: string; + }; + }; + }; + /** + * Parameter containing reference + */ + parameterReference: ModelWithString; + }; +}; + +export type ComplexTypesResponse = (Array); + +export type ComplexTypesError = (unknown); + +export type ComplexParamsData = { + body?: { + readonly key: (string) | null; + name: (string) | null; + enabled?: boolean; + readonly type: 'Monkey' | 'Horse' | 'Bird'; + listOfModels?: Array | null; + listOfStrings?: Array<(string)> | null; + parameters: (ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary); + readonly user?: { + readonly id?: number; + readonly name?: (string) | null; + }; + }; + path: { + /** + * api-version should be required in standalone clients + */ + 'api-version': string; + id: number; + }; +}; + +export type ComplexParamsResponse = (ModelWithString); + +export type ComplexParamsError = unknown; + +export type MultipartRequestData = { + body?: { + content?: (Blob | File); + data?: ((ModelWithString) | null); + }; +}; + +export type MultipartResponseResponse = ({ + file?: (Blob | File); + metadata?: { + foo?: string; + bar?: string; + }; +}); + +export type MultipartResponseError = unknown; + +export type CallWithResultFromHeaderResponse = (string); + +export type CallWithResultFromHeaderError = (unknown); + +export type TestErrorCodeData = { + query: { + /** + * Status code to return + */ + status: number; + }; +}; + +export type TestErrorCodeResponse = (unknown); + +export type TestErrorCodeError = (unknown); + +export type NonAsciiæøåÆøÅöôêÊ字符串Data = { + query: { + /** + * Dummy input param + */ + nonAsciiParamæøåÆØÅöôêÊ: number; + }; +}; + +export type NonAsciiæøåÆøÅöôêÊ字符串Response = (Array); + +export type NonAsciiæøåÆøÅöôêÊ字符串Error = unknown; + +export type PutWithFormUrlEncodedData = { + body: ArrayWithStrings; +}; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-svelte-query/@tanstack/svelte-query.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/svelte-query/axios/@tanstack/svelte-query.gen.ts similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-svelte-query/@tanstack/svelte-query.gen.ts.snap rename to packages/openapi-ts/test/__snapshots__/plugins/@tanstack/svelte-query/axios/@tanstack/svelte-query.gen.ts diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-vue-query_transform/index.ts.snap b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/svelte-query/axios/index.ts similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-vue-query_transform/index.ts.snap rename to packages/openapi-ts/test/__snapshots__/plugins/@tanstack/svelte-query/axios/index.ts diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-svelte-query/services.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/svelte-query/axios/services.gen.ts similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-svelte-query/services.gen.ts.snap rename to packages/openapi-ts/test/__snapshots__/plugins/@tanstack/svelte-query/axios/services.gen.ts diff --git a/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/svelte-query/axios/types.gen.ts b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/svelte-query/axios/types.gen.ts new file mode 100644 index 000000000..1989b3f22 --- /dev/null +++ b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/svelte-query/axios/types.gen.ts @@ -0,0 +1,1507 @@ +// This file is auto-generated by @hey-api/openapi-ts + +/** + * Model with number-only name + */ +export type _400 = string; + +/** + * Testing multiline comments in string: First line + * Second line + * + * Fourth line + */ +export type camelCaseCommentWithBreaks = number; + +/** + * Testing multiline comments in string: First line + * Second line + * + * Fourth line + */ +export type CommentWithBreaks = number; + +/** + * Testing backticks in string: `backticks` and ```multiple backticks``` should work + */ +export type CommentWithBackticks = number; + +/** + * Testing backticks and quotes in string: `backticks`, 'quotes', "double quotes" and ```multiple backticks``` should work + */ +export type CommentWithBackticksAndQuotes = number; + +/** + * Testing slashes in string: \backwards\\\ and /forwards/// should work + */ +export type CommentWithSlashes = number; + +/** + * Testing expression placeholders in string: ${expression} should work + */ +export type CommentWithExpressionPlaceholders = number; + +/** + * Testing quotes in string: 'single quote''' and "double quotes""" should work + */ +export type CommentWithQuotes = number; + +/** + * Testing reserved characters in string: * inline * and ** inline ** should work + */ +export type CommentWithReservedCharacters = number; + +/** + * This is a simple number + */ +export type SimpleInteger = number; + +/** + * This is a simple boolean + */ +export type SimpleBoolean = boolean; + +/** + * This is a simple string + */ +export type SimpleString = string; + +/** + * A string with non-ascii (unicode) characters valid in typescript identifiers (æøåÆØÅöÔèÈ字符串) + */ +export type NonAsciiStringæøåÆØÅöôêÊ字符串 = string; + +/** + * This is a simple file + */ +export type SimpleFile = (Blob | File); + +/** + * This is a simple reference + */ +export type SimpleReference = ModelWithString; + +/** + * This is a simple string + */ +export type SimpleStringWithPattern = (string) | null; + +/** + * This is a simple enum with strings + */ +export type EnumWithStrings = 'Success' | 'Warning' | 'Error' | "'Single Quote'" | '"Double Quotes"' | 'Non-ascii: øæåôöØÆÅÔÖ字符串'; + +export type EnumWithReplacedCharacters = "'Single Quote'" | '"Double Quotes"' | 'øæåôöØÆÅÔÖ字符串' | 3.1 | ''; + +/** + * This is a simple enum with numbers + */ +export type EnumWithNumbers = 1 | 2 | 3 | 1.1 | 1.2 | 1.3 | 100 | 200 | 300 | -100 | -200 | -300 | -1.1 | -1.2 | -1.3; + +/** + * Success=1,Warning=2,Error=3 + */ +export type EnumFromDescription = number; + +/** + * This is a simple enum with numbers + */ +export type EnumWithExtensions = 200 | 400 | 500; + +export type EnumWithXEnumNames = 0 | 1 | 2; + +/** + * This is a simple array with numbers + */ +export type ArrayWithNumbers = Array<(number)>; + +/** + * This is a simple array with booleans + */ +export type ArrayWithBooleans = Array<(boolean)>; + +/** + * This is a simple array with strings + */ +export type ArrayWithStrings = Array<(string)>; + +/** + * This is a simple array with references + */ +export type ArrayWithReferences = Array; + +/** + * This is a simple array containing an array + */ +export type ArrayWithArray = Array>; + +/** + * This is a simple array with properties + */ +export type ArrayWithProperties = Array<{ + '16x16'?: camelCaseCommentWithBreaks; + bar?: string; +}>; + +/** + * This is a simple array with any of properties + */ +export type ArrayWithAnyOfProperties = Array<({ + foo?: string; +} | { + bar?: string; +})>; + +export type AnyOfAnyAndNull = { + data?: (unknown | null); +}; + +/** + * This is a simple array with any of properties + */ +export type AnyOfArrays = { + results?: Array<({ + foo?: string; +} | { + bar?: string; +})>; +}; + +/** + * This is a string dictionary + */ +export type DictionaryWithString = { + [key: string]: (string); +}; + +export type DictionaryWithPropertiesAndAdditionalProperties = { + foo?: number; + bar?: boolean; + [key: string]: (string | number | boolean) | undefined; +}; + +/** + * This is a string reference + */ +export type DictionaryWithReference = { + [key: string]: ModelWithString; +}; + +/** + * This is a complex dictionary + */ +export type DictionaryWithArray = { + [key: string]: Array; +}; + +/** + * This is a string dictionary + */ +export type DictionaryWithDictionary = { + [key: string]: { + [key: string]: (string); + }; +}; + +/** + * This is a complex dictionary + */ +export type DictionaryWithProperties = { + [key: string]: { + foo?: string; + bar?: string; + }; +}; + +/** + * This is a model with one number property + */ +export type ModelWithInteger = { + /** + * This is a simple number property + */ + prop?: number; +}; + +/** + * This is a model with one boolean property + */ +export type ModelWithBoolean = { + /** + * This is a simple boolean property + */ + prop?: boolean; +}; + +/** + * This is a model with one string property + */ +export type ModelWithString = { + /** + * This is a simple string property + */ + prop?: string; +}; + +/** + * This is a model with one string property + */ +export type ModelWithStringError = { + /** + * This is a simple string property + */ + prop?: string; +}; + +/** + * `Comment` or `VoiceComment`. The JSON object for adding voice comments to tickets is different. See [Adding voice comments to tickets](/documentation/ticketing/managing-tickets/adding-voice-comments-to-tickets) + */ +export type Model_From_Zendesk = string; + +/** + * This is a model with one string property + */ +export type ModelWithNullableString = { + /** + * This is a simple string property + */ + nullableProp1?: (string) | null; + /** + * This is a simple string property + */ + nullableRequiredProp1: (string) | null; + /** + * This is a simple string property + */ + nullableProp2?: (string) | null; + /** + * This is a simple string property + */ + nullableRequiredProp2: (string) | null; + /** + * This is a simple enum with strings + */ + 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; +}; + +/** + * This is a simple enum with strings + */ +export type foo_bar_enum = 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; + +/** + * This is a model with one enum + */ +export type ModelWithEnum = { + /** + * This is a simple enum with strings + */ + 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; + /** + * These are the HTTP error code enums + */ + statusCode?: '100' | '200 FOO' | '300 FOO_BAR' | '400 foo-bar' | '500 foo.bar' | '600 foo&bar'; + /** + * Simple boolean enum + */ + bool?: boolean; +}; + +/** + * These are the HTTP error code enums + */ +export type statusCode = '100' | '200 FOO' | '300 FOO_BAR' | '400 foo-bar' | '500 foo.bar' | '600 foo&bar'; + +/** + * This is a model with one enum with escaped name + */ +export type ModelWithEnumWithHyphen = { + 'foo-bar-baz-qux'?: '3.0'; +}; + +export type foo_bar_baz_qux = '3.0'; + +/** + * This is a model with one enum + */ +export type ModelWithEnumFromDescription = { + /** + * Success=1,Warning=2,Error=3 + */ + test?: number; +}; + +/** + * This is a model with nested enums + */ +export type ModelWithNestedEnums = { + dictionaryWithEnum?: { + [key: string]: ('Success' | 'Warning' | 'Error'); + }; + dictionaryWithEnumFromDescription?: { + [key: string]: (number); + }; + arrayWithEnum?: Array<('Success' | 'Warning' | 'Error')>; + arrayWithDescription?: Array<(number)>; + /** + * This is a simple enum with strings + */ + 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; +}; + +/** + * This is a model with one property containing a reference + */ +export type ModelWithReference = { + prop?: ModelWithProperties; +}; + +/** + * This is a model with one property containing an array + */ +export type ModelWithArrayReadOnlyAndWriteOnly = { + prop?: Array; + propWithFile?: Array<((Blob | File))>; + propWithNumber?: Array<(number)>; +}; + +/** + * This is a model with one property containing an array + */ +export type ModelWithArray = { + prop?: Array; + propWithFile?: Array<((Blob | File))>; + propWithNumber?: Array<(number)>; +}; + +/** + * This is a model with one property containing a dictionary + */ +export type ModelWithDictionary = { + prop?: { + [key: string]: (string); + }; +}; + +/** + * This is a deprecated model with a deprecated property + * @deprecated + */ +export type DeprecatedModel = { + /** + * This is a deprecated property + * @deprecated + */ + prop?: string; +}; + +/** + * This is a model with one property containing a circular reference + */ +export type ModelWithCircularReference = { + prop?: ModelWithCircularReference; +}; + +/** + * This is a model with one property with a 'one of' relationship + */ +export type CompositionWithOneOf = { + propA?: (ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary); +}; + +/** + * This is a model with one property with a 'one of' relationship where the options are not $ref + */ +export type CompositionWithOneOfAnonymous = { + propA?: ({ + propA?: string; +} | string | number); +}; + +/** + * Circle + */ +export type ModelCircle = { + kind: 'circle'; + radius?: number; +}; + +/** + * Square + */ +export type ModelSquare = { + kind: 'square'; + sideLength?: number; +}; + +/** + * This is a model with one property with a 'one of' relationship where the options are not $ref + */ +export type CompositionWithOneOfDiscriminator = ModelCircle | ModelSquare; + +/** + * This is a model with one property with a 'any of' relationship + */ +export type CompositionWithAnyOf = { + propA?: (ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary); +}; + +/** + * This is a model with one property with a 'any of' relationship where the options are not $ref + */ +export type CompositionWithAnyOfAnonymous = { + propA?: ({ + propA?: string; +} | string | number); +}; + +/** + * This is a model with nested 'any of' property with a type null + */ +export type CompositionWithNestedAnyAndTypeNull = { + propA?: (Array<(ModelWithDictionary | null)> | Array<(ModelWithArray | null)>); +}; + +export type _3e_num_1Период = 'Bird' | 'Dog'; + +export type ConstValue = "ConstValue"; + +/** + * This is a model with one property with a 'any of' relationship where the options are not $ref + */ +export type CompositionWithNestedAnyOfAndNull = { + propA?: (Array<(_3e_num_1Период | ConstValue)> | null); +}; + +/** + * This is a model with one property with a 'one of' relationship + */ +export type CompositionWithOneOfAndNullable = { + propA?: (({ + boolean?: boolean; +} | ModelWithEnum | ModelWithArray | ModelWithDictionary) | null); +}; + +/** + * This is a model that contains a simple dictionary within composition + */ +export type CompositionWithOneOfAndSimpleDictionary = { + propA?: (boolean | { + [key: string]: (number); +}); +}; + +/** + * This is a model that contains a dictionary of simple arrays within composition + */ +export type CompositionWithOneOfAndSimpleArrayDictionary = { + propA?: (boolean | { + [key: string]: Array<(boolean)>; +}); +}; + +/** + * This is a model that contains a dictionary of complex arrays (composited) within composition + */ +export type CompositionWithOneOfAndComplexArrayDictionary = { + propA?: (boolean | { + [key: string]: Array<(number | string)>; +}); +}; + +/** + * This is a model with one property with a 'all of' relationship + */ +export type CompositionWithAllOfAndNullable = { + propA?: (({ + boolean?: boolean; +} & ModelWithEnum & ModelWithArray & ModelWithDictionary) | null); +}; + +/** + * This is a model with one property with a 'any of' relationship + */ +export type CompositionWithAnyOfAndNullable = { + propA?: (({ + boolean?: boolean; +} | ModelWithEnum | ModelWithArray | ModelWithDictionary) | null); +}; + +/** + * This is a base model with two simple optional properties + */ +export type CompositionBaseModel = { + firstName?: string; + lastname?: string; +}; + +/** + * This is a model that extends the base model + */ +export type CompositionExtendedModel = CompositionBaseModel & { + firstName: string; + lastname: string; + age: number; +}; + +/** + * This is a model with one nested property + */ +export type ModelWithProperties = { + required: string; + readonly requiredAndReadOnly: string; + requiredAndNullable: (string) | null; + string?: string; + number?: number; + boolean?: boolean; + reference?: ModelWithString; + 'property with space'?: string; + default?: string; + try?: string; + readonly '@namespace.string'?: string; + readonly '@namespace.integer'?: number; +}; + +/** + * This is a model with one nested property + */ +export type ModelWithNestedProperties = { + readonly first: { + readonly second: { + readonly third: (string) | null; + } | null; + } | null; +}; + +/** + * This is a model with duplicated properties + */ +export type ModelWithDuplicateProperties = { + prop?: ModelWithString; +}; + +/** + * This is a model with ordered properties + */ +export type ModelWithOrderedProperties = { + zebra?: string; + apple?: string; + hawaii?: string; +}; + +/** + * This is a model with duplicated imports + */ +export type ModelWithDuplicateImports = { + propA?: ModelWithString; + propB?: ModelWithString; + propC?: ModelWithString; +}; + +/** + * This is a model that extends another model + */ +export type ModelThatExtends = ModelWithString & { + propExtendsA?: string; + propExtendsB?: ModelWithString; +}; + +/** + * This is a model that extends another model + */ +export type ModelThatExtendsExtends = ModelWithString & ModelThatExtends & { + propExtendsC?: string; + propExtendsD?: ModelWithString; +}; + +/** + * This is a model that contains a some patterns + */ +export type ModelWithPattern = { + key: string; + name: string; + readonly enabled?: boolean; + readonly modified?: string; + id?: string; + text?: string; + patternWithSingleQuotes?: string; + patternWithNewline?: string; + patternWithBacktick?: string; +}; + +export type File = { + readonly id?: string; + readonly updated_at?: string; + readonly created_at?: string; + mime: string; + readonly file?: string; +}; + +export type _default = { + name?: string; +}; + +export type Pageable = { + page?: number; + size?: number; + sort?: Array<(string)>; +}; + +/** + * This is a free-form object without additionalProperties. + */ +export type FreeFormObjectWithoutAdditionalProperties = { + [key: string]: unknown; +}; + +/** + * This is a free-form object with additionalProperties: true. + */ +export type FreeFormObjectWithAdditionalPropertiesEqTrue = { + [key: string]: unknown; +}; + +/** + * This is a free-form object with additionalProperties: {}. + */ +export type FreeFormObjectWithAdditionalPropertiesEqEmptyObject = { + [key: string]: unknown; +}; + +export type ModelWithConst = { + String?: "String"; + number?: 0; + null?: null; + withType?: "Some string"; +}; + +/** + * This is a model with one property and additionalProperties: true + */ +export type ModelWithAdditionalPropertiesEqTrue = { + /** + * This is a simple string property + */ + prop?: string; + [key: string]: unknown | string; +}; + +export type NestedAnyOfArraysNullable = { + nullableArray?: (Array<(string | boolean)> | null); +}; + +export type CompositionWithOneOfAndProperties = ({ + foo: ParameterSimpleParameter; +} | { + bar: NonAsciiStringæøåÆØÅöôêÊ字符串; +}) & { + baz: (number) | null; + qux: number; +}; + +/** + * An object that can be null + */ +export type NullableObject = { + foo?: string; +} | null; + +/** + * Some % character + */ +export type CharactersInDescription = string; + +export type ModelWithNullableObject = { + data?: NullableObject; +}; + +export type ModelWithOneOfEnum = { + foo: 'Bar'; +} | { + foo: 'Baz'; +} | { + foo: 'Qux'; +} | { + content: string; + foo: 'Quux'; +} | { + content: [ + (string), + (string) + ]; + foo: 'Corge'; +}; + +export type foo = 'Bar'; + +export type ModelWithNestedArrayEnumsDataFoo = 'foo' | 'bar'; + +export type ModelWithNestedArrayEnumsDataBar = 'baz' | 'qux'; + +export type ModelWithNestedArrayEnumsData = { + foo?: Array; + bar?: Array; +}; + +export type ModelWithNestedArrayEnums = { + array_strings?: Array<(string)>; + data?: (ModelWithNestedArrayEnumsData); +}; + +export type ModelWithNestedCompositionEnums = { + foo?: (ModelWithNestedArrayEnumsDataFoo); +}; + +export type ModelWithReadOnlyAndWriteOnly = { + foo: string; + readonly bar: string; + baz: string; +}; + +export type ModelWithConstantSizeArray = [ + number, + number +]; + +export type ModelWithAnyOfConstantSizeArray = [ + (number | string), + (number | string), + (number | string) +]; + +export type ModelWithPrefixItemsConstantSizeArray = [ + ModelWithInteger, + (number | string), + string +]; + +export type ModelWithAnyOfConstantSizeArrayNullable = [ + ((number) | null | string), + ((number) | null | string), + ((number) | null | string) +]; + +export type ModelWithAnyOfConstantSizeArrayWithNSizeAndOptions = [ + (number | _import), + (number | _import) +]; + +export type ModelWithAnyOfConstantSizeArrayAndIntersect = [ + (number & string), + (number & string) +]; + +export type ModelWithNumericEnumUnion = { + /** + * Период + */ + value?: -10 | -1 | 0 | 1 | 3 | 6 | 12; +}; + +/** + * Период + */ +export type value = -10 | -1 | 0 | 1 | 3 | 6 | 12; + +/** + * Some description with `back ticks` + */ +export type ModelWithBackticksInDescription = { + /** + * The template `that` should be used for parsing and importing the contents of the CSV file. + * + *

There is one placeholder currently supported:

  • ${x} - refers to the n-th column in the CSV file, e.g. ${1}, ${2}, ...)

Example of a correct JSON template:

+ *
+     * [
+     * {
+     * "resourceType": "Asset",
+     * "identifier": {
+     * "name": "${1}",
+     * "domain": {
+     * "name": "${2}",
+     * "community": {
+     * "name": "Some Community"
+     * }
+     * }
+     * },
+     * "attributes" : {
+     * "00000000-0000-0000-0000-000000003115" : [ {
+     * "value" : "${3}"
+     * } ],
+     * "00000000-0000-0000-0000-000000000222" : [ {
+     * "value" : "${4}"
+     * } ]
+     * }
+     * }
+     * ]
+     * 
+ */ + template?: string; +}; + +export type ModelWithOneOfAndProperties = (ParameterSimpleParameter | NonAsciiStringæøåÆØÅöôêÊ字符串) & { + baz: (number) | null; + qux: number; +}; + +/** + * Model used to test deduplication strategy (unused) + */ +export type ParameterSimpleParameterUnused = string; + +/** + * Model used to test deduplication strategy + */ +export type PostServiceWithEmptyTagResponse = string; + +/** + * Model used to test deduplication strategy + */ +export type PostServiceWithEmptyTagResponse2 = string; + +/** + * Model used to test deduplication strategy + */ +export type DeleteFooData = string; + +/** + * Model used to test deduplication strategy + */ +export type DeleteFooData2 = string; + +/** + * Model with restricted keyword name + */ +export type _import = string; + +export type SchemaWithFormRestrictedKeys = { + description?: string; + 'x-enum-descriptions'?: string; + 'x-enum-varnames'?: string; + 'x-enumNames'?: string; + title?: string; + object?: { + description?: string; + 'x-enum-descriptions'?: string; + 'x-enum-varnames'?: string; + 'x-enumNames'?: string; + title?: string; + }; + array?: Array<({ + description?: string; + 'x-enum-descriptions'?: string; + 'x-enum-varnames'?: string; + 'x-enumNames'?: string; + title?: string; +})>; +}; + +/** + * This schema was giving PascalCase transformations a hard time + */ +export type io_k8s_apimachinery_pkg_apis_meta_v1_DeleteOptions = { + /** + * Must be fulfilled before a deletion is carried out. If not possible, a 409 Conflict status will be returned. + */ + preconditions?: (io_k8s_apimachinery_pkg_apis_meta_v1_Preconditions); +}; + +/** + * This schema was giving PascalCase transformations a hard time + */ +export type io_k8s_apimachinery_pkg_apis_meta_v1_Preconditions = { + /** + * Specifies the target ResourceVersion + */ + resourceVersion?: string; + /** + * Specifies the target UID. + */ + uid?: string; +}; + +export type AdditionalPropertiesUnknownIssue = { + [key: string]: (string | number); +}; + +export type AdditionalPropertiesUnknownIssue2 = { + [key: string]: (string | number); +}; + +export type AdditionalPropertiesUnknownIssue3 = string & { + entries: { + [key: string]: AdditionalPropertiesUnknownIssue; + }; +}; + +export type AdditionalPropertiesIntegerIssue = { + value: number; + [key: string]: (number) | undefined; +}; + +export type OneOfAllOfIssue = ((ConstValue | Generic_Schema_Duplicate_Issue_1_System_Boolean_) & _3e_num_1Период) | Generic_Schema_Duplicate_Issue_1_System_String_; + +export type Generic_Schema_Duplicate_Issue_1_System_Boolean_ = { + item?: boolean; + error?: (string) | null; + readonly hasError?: boolean; + data?: { + [key: string]: unknown; + }; +}; + +export type Generic_Schema_Duplicate_Issue_1_System_String_ = { + item?: (string) | null; + error?: (string) | null; + readonly hasError?: boolean; +}; + +/** + * This is a reusable parameter + */ +export type ParameterSimpleParameter = string; + +/** + * Parameter with illegal characters + */ +export type Parameterx_Foo_Bar = ModelWithString; + +export type ImportData = { + body: (ModelWithReadOnlyAndWriteOnly | ModelWithArrayReadOnlyAndWriteOnly); +}; + +export type ImportResponse = (Model_From_Zendesk | ModelWithReadOnlyAndWriteOnly); + +export type ImportError = unknown; + +export type ApiVversionOdataControllerCountResponse = (Model_From_Zendesk); + +export type ApiVversionOdataControllerCountError = unknown; + +export type GetApiVbyApiVersionSimpleOperationData = { + path: { + /** + * foo in method + */ + foo_param: string; + }; +}; + +export type GetApiVbyApiVersionSimpleOperationResponse = (number); + +export type GetApiVbyApiVersionSimpleOperationError = (ModelWithBoolean); + +export type DeleteFooData3 = { + headers: { + /** + * Parameter with illegal characters + */ + 'x-Foo-Bar': ModelWithString; + }; + path: { + /** + * bar in method + */ + BarParam: string; + /** + * foo in method + */ + foo_param: string; + }; +}; + +export type CallWithDescriptionsData = { + query?: { + /** + * Testing backticks in string: `backticks` and ```multiple backticks``` should work + */ + parameterWithBackticks?: unknown; + /** + * Testing multiline comments in string: First line + * Second line + * + * Fourth line + */ + parameterWithBreaks?: unknown; + /** + * Testing expression placeholders in string: ${expression} should work + */ + parameterWithExpressionPlaceholders?: unknown; + /** + * Testing quotes in string: 'single quote''' and "double quotes""" should work + */ + parameterWithQuotes?: unknown; + /** + * Testing reserved characters in string: * inline * and ** inline ** should work + */ + parameterWithReservedCharacters?: unknown; + /** + * Testing slashes in string: \backwards\\\ and /forwards/// should work + */ + parameterWithSlashes?: unknown; + }; +}; + +export type DeprecatedCallData = { + headers: { + /** + * This parameter is deprecated + * @deprecated + */ + parameter: (DeprecatedModel) | null; + }; +}; + +export type CallWithParametersData = { + /** + * This is the parameter that goes into the body + */ + body: { + [key: string]: unknown; + } | null; + headers: { + /** + * This is the parameter that goes into the header + */ + parameterHeader: (string) | null; + }; + path: { + /** + * api-version should be required in standalone clients + */ + 'api-version': (string) | null; + /** + * This is the parameter that goes into the path + */ + parameterPath: (string) | null; + }; + query: { + /** + * This is the parameter that goes into the query params + */ + cursor: (string) | null; + foo_all_of_enum: (ModelWithNestedArrayEnumsDataFoo); + foo_ref_enum?: ModelWithNestedArrayEnumsDataFoo; + }; +}; + +export type CallWithWeirdParameterNamesData = { + /** + * This is the parameter that goes into the body + */ + body: (ModelWithString) | null; + headers: { + /** + * This is the parameter that goes into the request header + */ + 'parameter.header': (string) | null; + }; + path: { + /** + * api-version should be required in standalone clients + */ + 'api-version': (string) | null; + /** + * This is the parameter that goes into the path + */ + 'parameter-path-2'?: string; + /** + * This is the parameter that goes into the path + */ + 'PARAMETER-PATH-3'?: string; + /** + * This is the parameter that goes into the path + */ + 'parameter.path.1'?: string; + }; + query: { + /** + * This is the parameter with a reserved keyword + */ + default?: string; + /** + * This is the parameter that goes into the request query params + */ + 'parameter-query': (string) | null; + }; +}; + +export type GetCallWithOptionalParamData = { + /** + * This is a required parameter + */ + body: ModelWithOneOfEnum; + query?: { + /** + * This is an optional parameter + */ + page?: number; + }; +}; + +export type PostCallWithOptionalParamData = { + /** + * This is an optional parameter + */ + body?: { + offset?: (number) | null; + }; + query: { + /** + * This is a required parameter + */ + parameter: Pageable; + }; +}; + +export type PostCallWithOptionalParamResponse = (number | void); + +export type PostCallWithOptionalParamError = unknown; + +export type PostApiVbyApiVersionRequestBodyData = { + /** + * A reusable request body + */ + body?: ModelWithString; + query?: { + /** + * This is a reusable parameter + */ + parameter?: string; + }; +}; + +export type PostApiVbyApiVersionFormDataData = { + /** + * A reusable request body + */ + body?: ModelWithString; + query?: { + /** + * This is a reusable parameter + */ + parameter?: string; + }; +}; + +export type CallWithDefaultParametersData = { + query?: { + /** + * This is a simple boolean with default value + */ + parameterBoolean?: (boolean) | null; + /** + * This is a simple enum with default value + */ + parameterEnum?: 'Success' | 'Warning' | 'Error'; + /** + * This is a simple model with default value + */ + parameterModel?: (ModelWithString) | null; + /** + * This is a simple number with default value + */ + parameterNumber?: (number) | null; + /** + * This is a simple string with default value + */ + parameterString?: (string) | null; + }; +}; + +export type CallWithDefaultOptionalParametersData = { + query?: { + /** + * This is a simple boolean that is optional with default value + */ + parameterBoolean?: boolean; + /** + * This is a simple enum that is optional with default value + */ + parameterEnum?: 'Success' | 'Warning' | 'Error'; + /** + * This is a simple model that is optional with default value + */ + parameterModel?: ModelWithString; + /** + * This is a simple number that is optional with default value + */ + parameterNumber?: number; + /** + * This is a simple string that is optional with default value + */ + parameterString?: string; + }; +}; + +export type CallToTestOrderOfParamsData = { + query: { + /** + * This is a optional string with default + */ + parameterOptionalStringWithDefault?: string; + /** + * This is a optional string with empty default + */ + parameterOptionalStringWithEmptyDefault?: string; + /** + * This is a optional string with no default + */ + parameterOptionalStringWithNoDefault?: string; + /** + * This is a string that can be null with default + */ + parameterStringNullableWithDefault?: (string) | null; + /** + * This is a string that can be null with no default + */ + parameterStringNullableWithNoDefault?: (string) | null; + /** + * This is a string with default + */ + parameterStringWithDefault: string; + /** + * This is a string with empty default + */ + parameterStringWithEmptyDefault: string; + /** + * This is a string with no default + */ + parameterStringWithNoDefault: string; + }; +}; + +export type CallWithNoContentResponseResponse = (void); + +export type CallWithNoContentResponseError = unknown; + +export type CallWithResponseAndNoContentResponseResponse = (number | void); + +export type CallWithResponseAndNoContentResponseError = unknown; + +export type DummyAResponse = (_400); + +export type DummyAError = unknown; + +export type DummyBResponse = (void); + +export type DummyBError = unknown; + +export type CallWithResponseResponse = (_import); + +export type CallWithResponseError = unknown; + +export type CallWithDuplicateResponsesResponse = ((ModelWithBoolean & ModelWithInteger) | ModelWithString); + +export type CallWithDuplicateResponsesError = (ModelWithStringError | DictionaryWithArray | ModelWithBoolean); + +export type CallWithResponsesResponse = ({ + readonly '@namespace.string'?: string; + readonly '@namespace.integer'?: number; + readonly value?: Array; +} | ModelThatExtends | ModelThatExtendsExtends); + +export type CallWithResponsesError = (ModelWithStringError); + +export type CollectionFormatData = { + query: { + /** + * This is an array parameter that is sent as csv format (comma-separated values) + */ + parameterArrayCSV: Array<(string)> | null; + /** + * This is an array parameter that is sent as multi format (multiple parameter instances) + */ + parameterArrayMulti: Array<(string)> | null; + /** + * This is an array parameter that is sent as pipes format (pipe-separated values) + */ + parameterArrayPipes: Array<(string)> | null; + /** + * This is an array parameter that is sent as ssv format (space-separated values) + */ + parameterArraySSV: Array<(string)> | null; + /** + * This is an array parameter that is sent as tsv format (tab-separated values) + */ + parameterArrayTSV: Array<(string)> | null; + }; +}; + +export type TypesData = { + path?: { + /** + * This is a number parameter + */ + id?: number; + }; + query: { + /** + * This is an array parameter + */ + parameterArray: Array<(string)> | null; + /** + * This is a boolean parameter + */ + parameterBoolean: (boolean) | null; + /** + * This is a dictionary parameter + */ + parameterDictionary: { + [key: string]: unknown; + } | null; + /** + * This is an enum parameter + */ + parameterEnum: ('Success' | 'Warning' | 'Error') | null; + /** + * This is a number parameter + */ + parameterNumber: number; + /** + * This is an object parameter + */ + parameterObject: { + [key: string]: unknown; + } | null; + /** + * This is a string parameter + */ + parameterString: (string) | null; + }; +}; + +export type TypesResponse = (number | string | boolean | { + [key: string]: unknown; +}); + +export type TypesError = unknown; + +export type UploadFileData = { + body: (Blob | File); + path: { + /** + * api-version should be required in standalone clients + */ + 'api-version': (string) | null; + }; +}; + +export type UploadFileResponse = (boolean); + +export type UploadFileError = unknown; + +export type FileResponseData = { + path: { + /** + * api-version should be required in standalone clients + */ + 'api-version': string; + id: string; + }; +}; + +export type FileResponseResponse = ((Blob | File)); + +export type FileResponseError = unknown; + +export type ComplexTypesData = { + query: { + /** + * Parameter containing object + */ + parameterObject: { + first?: { + second?: { + third?: string; + }; + }; + }; + /** + * Parameter containing reference + */ + parameterReference: ModelWithString; + }; +}; + +export type ComplexTypesResponse = (Array); + +export type ComplexTypesError = (unknown); + +export type MultipartRequestData = { + body?: { + content?: (Blob | File); + data?: ((ModelWithString) | null); + }; +}; + +export type MultipartResponseResponse = ({ + file?: (Blob | File); + metadata?: { + foo?: string; + bar?: string; + }; +}); + +export type MultipartResponseError = unknown; + +export type ComplexParamsData = { + body?: { + readonly key: (string) | null; + name: (string) | null; + enabled?: boolean; + readonly type: 'Monkey' | 'Horse' | 'Bird'; + listOfModels?: Array | null; + listOfStrings?: Array<(string)> | null; + parameters: (ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary); + readonly user?: { + readonly id?: number; + readonly name?: (string) | null; + }; + }; + path: { + /** + * api-version should be required in standalone clients + */ + 'api-version': string; + id: number; + }; +}; + +export type ComplexParamsResponse = (ModelWithString); + +export type ComplexParamsError = unknown; + +export type CallWithResultFromHeaderResponse = (string); + +export type CallWithResultFromHeaderError = (unknown); + +export type TestErrorCodeData = { + query: { + /** + * Status code to return + */ + status: number; + }; +}; + +export type TestErrorCodeResponse = (unknown); + +export type TestErrorCodeError = (unknown); + +export type NonAsciiæøåÆøÅöôêÊ字符串Data = { + query: { + /** + * Dummy input param + */ + nonAsciiParamæøåÆØÅöôêÊ: number; + }; +}; + +export type NonAsciiæøåÆøÅöôêÊ字符串Response = (Array); + +export type NonAsciiæøåÆøÅöôêÊ字符串Error = unknown; + +export type PutWithFormUrlEncodedData = { + body: ArrayWithStrings; +}; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-svelte-query/@tanstack/svelte-query.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/svelte-query/fetch/@tanstack/svelte-query.gen.ts similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-svelte-query/@tanstack/svelte-query.gen.ts.snap rename to packages/openapi-ts/test/__snapshots__/plugins/@tanstack/svelte-query/fetch/@tanstack/svelte-query.gen.ts diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-react-query/index.ts.snap b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/svelte-query/fetch/index.ts similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-react-query/index.ts.snap rename to packages/openapi-ts/test/__snapshots__/plugins/@tanstack/svelte-query/fetch/index.ts diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-svelte-query/services.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/svelte-query/fetch/services.gen.ts similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-svelte-query/services.gen.ts.snap rename to packages/openapi-ts/test/__snapshots__/plugins/@tanstack/svelte-query/fetch/services.gen.ts diff --git a/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/svelte-query/fetch/types.gen.ts b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/svelte-query/fetch/types.gen.ts new file mode 100644 index 000000000..1989b3f22 --- /dev/null +++ b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/svelte-query/fetch/types.gen.ts @@ -0,0 +1,1507 @@ +// This file is auto-generated by @hey-api/openapi-ts + +/** + * Model with number-only name + */ +export type _400 = string; + +/** + * Testing multiline comments in string: First line + * Second line + * + * Fourth line + */ +export type camelCaseCommentWithBreaks = number; + +/** + * Testing multiline comments in string: First line + * Second line + * + * Fourth line + */ +export type CommentWithBreaks = number; + +/** + * Testing backticks in string: `backticks` and ```multiple backticks``` should work + */ +export type CommentWithBackticks = number; + +/** + * Testing backticks and quotes in string: `backticks`, 'quotes', "double quotes" and ```multiple backticks``` should work + */ +export type CommentWithBackticksAndQuotes = number; + +/** + * Testing slashes in string: \backwards\\\ and /forwards/// should work + */ +export type CommentWithSlashes = number; + +/** + * Testing expression placeholders in string: ${expression} should work + */ +export type CommentWithExpressionPlaceholders = number; + +/** + * Testing quotes in string: 'single quote''' and "double quotes""" should work + */ +export type CommentWithQuotes = number; + +/** + * Testing reserved characters in string: * inline * and ** inline ** should work + */ +export type CommentWithReservedCharacters = number; + +/** + * This is a simple number + */ +export type SimpleInteger = number; + +/** + * This is a simple boolean + */ +export type SimpleBoolean = boolean; + +/** + * This is a simple string + */ +export type SimpleString = string; + +/** + * A string with non-ascii (unicode) characters valid in typescript identifiers (æøåÆØÅöÔèÈ字符串) + */ +export type NonAsciiStringæøåÆØÅöôêÊ字符串 = string; + +/** + * This is a simple file + */ +export type SimpleFile = (Blob | File); + +/** + * This is a simple reference + */ +export type SimpleReference = ModelWithString; + +/** + * This is a simple string + */ +export type SimpleStringWithPattern = (string) | null; + +/** + * This is a simple enum with strings + */ +export type EnumWithStrings = 'Success' | 'Warning' | 'Error' | "'Single Quote'" | '"Double Quotes"' | 'Non-ascii: øæåôöØÆÅÔÖ字符串'; + +export type EnumWithReplacedCharacters = "'Single Quote'" | '"Double Quotes"' | 'øæåôöØÆÅÔÖ字符串' | 3.1 | ''; + +/** + * This is a simple enum with numbers + */ +export type EnumWithNumbers = 1 | 2 | 3 | 1.1 | 1.2 | 1.3 | 100 | 200 | 300 | -100 | -200 | -300 | -1.1 | -1.2 | -1.3; + +/** + * Success=1,Warning=2,Error=3 + */ +export type EnumFromDescription = number; + +/** + * This is a simple enum with numbers + */ +export type EnumWithExtensions = 200 | 400 | 500; + +export type EnumWithXEnumNames = 0 | 1 | 2; + +/** + * This is a simple array with numbers + */ +export type ArrayWithNumbers = Array<(number)>; + +/** + * This is a simple array with booleans + */ +export type ArrayWithBooleans = Array<(boolean)>; + +/** + * This is a simple array with strings + */ +export type ArrayWithStrings = Array<(string)>; + +/** + * This is a simple array with references + */ +export type ArrayWithReferences = Array; + +/** + * This is a simple array containing an array + */ +export type ArrayWithArray = Array>; + +/** + * This is a simple array with properties + */ +export type ArrayWithProperties = Array<{ + '16x16'?: camelCaseCommentWithBreaks; + bar?: string; +}>; + +/** + * This is a simple array with any of properties + */ +export type ArrayWithAnyOfProperties = Array<({ + foo?: string; +} | { + bar?: string; +})>; + +export type AnyOfAnyAndNull = { + data?: (unknown | null); +}; + +/** + * This is a simple array with any of properties + */ +export type AnyOfArrays = { + results?: Array<({ + foo?: string; +} | { + bar?: string; +})>; +}; + +/** + * This is a string dictionary + */ +export type DictionaryWithString = { + [key: string]: (string); +}; + +export type DictionaryWithPropertiesAndAdditionalProperties = { + foo?: number; + bar?: boolean; + [key: string]: (string | number | boolean) | undefined; +}; + +/** + * This is a string reference + */ +export type DictionaryWithReference = { + [key: string]: ModelWithString; +}; + +/** + * This is a complex dictionary + */ +export type DictionaryWithArray = { + [key: string]: Array; +}; + +/** + * This is a string dictionary + */ +export type DictionaryWithDictionary = { + [key: string]: { + [key: string]: (string); + }; +}; + +/** + * This is a complex dictionary + */ +export type DictionaryWithProperties = { + [key: string]: { + foo?: string; + bar?: string; + }; +}; + +/** + * This is a model with one number property + */ +export type ModelWithInteger = { + /** + * This is a simple number property + */ + prop?: number; +}; + +/** + * This is a model with one boolean property + */ +export type ModelWithBoolean = { + /** + * This is a simple boolean property + */ + prop?: boolean; +}; + +/** + * This is a model with one string property + */ +export type ModelWithString = { + /** + * This is a simple string property + */ + prop?: string; +}; + +/** + * This is a model with one string property + */ +export type ModelWithStringError = { + /** + * This is a simple string property + */ + prop?: string; +}; + +/** + * `Comment` or `VoiceComment`. The JSON object for adding voice comments to tickets is different. See [Adding voice comments to tickets](/documentation/ticketing/managing-tickets/adding-voice-comments-to-tickets) + */ +export type Model_From_Zendesk = string; + +/** + * This is a model with one string property + */ +export type ModelWithNullableString = { + /** + * This is a simple string property + */ + nullableProp1?: (string) | null; + /** + * This is a simple string property + */ + nullableRequiredProp1: (string) | null; + /** + * This is a simple string property + */ + nullableProp2?: (string) | null; + /** + * This is a simple string property + */ + nullableRequiredProp2: (string) | null; + /** + * This is a simple enum with strings + */ + 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; +}; + +/** + * This is a simple enum with strings + */ +export type foo_bar_enum = 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; + +/** + * This is a model with one enum + */ +export type ModelWithEnum = { + /** + * This is a simple enum with strings + */ + 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; + /** + * These are the HTTP error code enums + */ + statusCode?: '100' | '200 FOO' | '300 FOO_BAR' | '400 foo-bar' | '500 foo.bar' | '600 foo&bar'; + /** + * Simple boolean enum + */ + bool?: boolean; +}; + +/** + * These are the HTTP error code enums + */ +export type statusCode = '100' | '200 FOO' | '300 FOO_BAR' | '400 foo-bar' | '500 foo.bar' | '600 foo&bar'; + +/** + * This is a model with one enum with escaped name + */ +export type ModelWithEnumWithHyphen = { + 'foo-bar-baz-qux'?: '3.0'; +}; + +export type foo_bar_baz_qux = '3.0'; + +/** + * This is a model with one enum + */ +export type ModelWithEnumFromDescription = { + /** + * Success=1,Warning=2,Error=3 + */ + test?: number; +}; + +/** + * This is a model with nested enums + */ +export type ModelWithNestedEnums = { + dictionaryWithEnum?: { + [key: string]: ('Success' | 'Warning' | 'Error'); + }; + dictionaryWithEnumFromDescription?: { + [key: string]: (number); + }; + arrayWithEnum?: Array<('Success' | 'Warning' | 'Error')>; + arrayWithDescription?: Array<(number)>; + /** + * This is a simple enum with strings + */ + 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; +}; + +/** + * This is a model with one property containing a reference + */ +export type ModelWithReference = { + prop?: ModelWithProperties; +}; + +/** + * This is a model with one property containing an array + */ +export type ModelWithArrayReadOnlyAndWriteOnly = { + prop?: Array; + propWithFile?: Array<((Blob | File))>; + propWithNumber?: Array<(number)>; +}; + +/** + * This is a model with one property containing an array + */ +export type ModelWithArray = { + prop?: Array; + propWithFile?: Array<((Blob | File))>; + propWithNumber?: Array<(number)>; +}; + +/** + * This is a model with one property containing a dictionary + */ +export type ModelWithDictionary = { + prop?: { + [key: string]: (string); + }; +}; + +/** + * This is a deprecated model with a deprecated property + * @deprecated + */ +export type DeprecatedModel = { + /** + * This is a deprecated property + * @deprecated + */ + prop?: string; +}; + +/** + * This is a model with one property containing a circular reference + */ +export type ModelWithCircularReference = { + prop?: ModelWithCircularReference; +}; + +/** + * This is a model with one property with a 'one of' relationship + */ +export type CompositionWithOneOf = { + propA?: (ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary); +}; + +/** + * This is a model with one property with a 'one of' relationship where the options are not $ref + */ +export type CompositionWithOneOfAnonymous = { + propA?: ({ + propA?: string; +} | string | number); +}; + +/** + * Circle + */ +export type ModelCircle = { + kind: 'circle'; + radius?: number; +}; + +/** + * Square + */ +export type ModelSquare = { + kind: 'square'; + sideLength?: number; +}; + +/** + * This is a model with one property with a 'one of' relationship where the options are not $ref + */ +export type CompositionWithOneOfDiscriminator = ModelCircle | ModelSquare; + +/** + * This is a model with one property with a 'any of' relationship + */ +export type CompositionWithAnyOf = { + propA?: (ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary); +}; + +/** + * This is a model with one property with a 'any of' relationship where the options are not $ref + */ +export type CompositionWithAnyOfAnonymous = { + propA?: ({ + propA?: string; +} | string | number); +}; + +/** + * This is a model with nested 'any of' property with a type null + */ +export type CompositionWithNestedAnyAndTypeNull = { + propA?: (Array<(ModelWithDictionary | null)> | Array<(ModelWithArray | null)>); +}; + +export type _3e_num_1Период = 'Bird' | 'Dog'; + +export type ConstValue = "ConstValue"; + +/** + * This is a model with one property with a 'any of' relationship where the options are not $ref + */ +export type CompositionWithNestedAnyOfAndNull = { + propA?: (Array<(_3e_num_1Период | ConstValue)> | null); +}; + +/** + * This is a model with one property with a 'one of' relationship + */ +export type CompositionWithOneOfAndNullable = { + propA?: (({ + boolean?: boolean; +} | ModelWithEnum | ModelWithArray | ModelWithDictionary) | null); +}; + +/** + * This is a model that contains a simple dictionary within composition + */ +export type CompositionWithOneOfAndSimpleDictionary = { + propA?: (boolean | { + [key: string]: (number); +}); +}; + +/** + * This is a model that contains a dictionary of simple arrays within composition + */ +export type CompositionWithOneOfAndSimpleArrayDictionary = { + propA?: (boolean | { + [key: string]: Array<(boolean)>; +}); +}; + +/** + * This is a model that contains a dictionary of complex arrays (composited) within composition + */ +export type CompositionWithOneOfAndComplexArrayDictionary = { + propA?: (boolean | { + [key: string]: Array<(number | string)>; +}); +}; + +/** + * This is a model with one property with a 'all of' relationship + */ +export type CompositionWithAllOfAndNullable = { + propA?: (({ + boolean?: boolean; +} & ModelWithEnum & ModelWithArray & ModelWithDictionary) | null); +}; + +/** + * This is a model with one property with a 'any of' relationship + */ +export type CompositionWithAnyOfAndNullable = { + propA?: (({ + boolean?: boolean; +} | ModelWithEnum | ModelWithArray | ModelWithDictionary) | null); +}; + +/** + * This is a base model with two simple optional properties + */ +export type CompositionBaseModel = { + firstName?: string; + lastname?: string; +}; + +/** + * This is a model that extends the base model + */ +export type CompositionExtendedModel = CompositionBaseModel & { + firstName: string; + lastname: string; + age: number; +}; + +/** + * This is a model with one nested property + */ +export type ModelWithProperties = { + required: string; + readonly requiredAndReadOnly: string; + requiredAndNullable: (string) | null; + string?: string; + number?: number; + boolean?: boolean; + reference?: ModelWithString; + 'property with space'?: string; + default?: string; + try?: string; + readonly '@namespace.string'?: string; + readonly '@namespace.integer'?: number; +}; + +/** + * This is a model with one nested property + */ +export type ModelWithNestedProperties = { + readonly first: { + readonly second: { + readonly third: (string) | null; + } | null; + } | null; +}; + +/** + * This is a model with duplicated properties + */ +export type ModelWithDuplicateProperties = { + prop?: ModelWithString; +}; + +/** + * This is a model with ordered properties + */ +export type ModelWithOrderedProperties = { + zebra?: string; + apple?: string; + hawaii?: string; +}; + +/** + * This is a model with duplicated imports + */ +export type ModelWithDuplicateImports = { + propA?: ModelWithString; + propB?: ModelWithString; + propC?: ModelWithString; +}; + +/** + * This is a model that extends another model + */ +export type ModelThatExtends = ModelWithString & { + propExtendsA?: string; + propExtendsB?: ModelWithString; +}; + +/** + * This is a model that extends another model + */ +export type ModelThatExtendsExtends = ModelWithString & ModelThatExtends & { + propExtendsC?: string; + propExtendsD?: ModelWithString; +}; + +/** + * This is a model that contains a some patterns + */ +export type ModelWithPattern = { + key: string; + name: string; + readonly enabled?: boolean; + readonly modified?: string; + id?: string; + text?: string; + patternWithSingleQuotes?: string; + patternWithNewline?: string; + patternWithBacktick?: string; +}; + +export type File = { + readonly id?: string; + readonly updated_at?: string; + readonly created_at?: string; + mime: string; + readonly file?: string; +}; + +export type _default = { + name?: string; +}; + +export type Pageable = { + page?: number; + size?: number; + sort?: Array<(string)>; +}; + +/** + * This is a free-form object without additionalProperties. + */ +export type FreeFormObjectWithoutAdditionalProperties = { + [key: string]: unknown; +}; + +/** + * This is a free-form object with additionalProperties: true. + */ +export type FreeFormObjectWithAdditionalPropertiesEqTrue = { + [key: string]: unknown; +}; + +/** + * This is a free-form object with additionalProperties: {}. + */ +export type FreeFormObjectWithAdditionalPropertiesEqEmptyObject = { + [key: string]: unknown; +}; + +export type ModelWithConst = { + String?: "String"; + number?: 0; + null?: null; + withType?: "Some string"; +}; + +/** + * This is a model with one property and additionalProperties: true + */ +export type ModelWithAdditionalPropertiesEqTrue = { + /** + * This is a simple string property + */ + prop?: string; + [key: string]: unknown | string; +}; + +export type NestedAnyOfArraysNullable = { + nullableArray?: (Array<(string | boolean)> | null); +}; + +export type CompositionWithOneOfAndProperties = ({ + foo: ParameterSimpleParameter; +} | { + bar: NonAsciiStringæøåÆØÅöôêÊ字符串; +}) & { + baz: (number) | null; + qux: number; +}; + +/** + * An object that can be null + */ +export type NullableObject = { + foo?: string; +} | null; + +/** + * Some % character + */ +export type CharactersInDescription = string; + +export type ModelWithNullableObject = { + data?: NullableObject; +}; + +export type ModelWithOneOfEnum = { + foo: 'Bar'; +} | { + foo: 'Baz'; +} | { + foo: 'Qux'; +} | { + content: string; + foo: 'Quux'; +} | { + content: [ + (string), + (string) + ]; + foo: 'Corge'; +}; + +export type foo = 'Bar'; + +export type ModelWithNestedArrayEnumsDataFoo = 'foo' | 'bar'; + +export type ModelWithNestedArrayEnumsDataBar = 'baz' | 'qux'; + +export type ModelWithNestedArrayEnumsData = { + foo?: Array; + bar?: Array; +}; + +export type ModelWithNestedArrayEnums = { + array_strings?: Array<(string)>; + data?: (ModelWithNestedArrayEnumsData); +}; + +export type ModelWithNestedCompositionEnums = { + foo?: (ModelWithNestedArrayEnumsDataFoo); +}; + +export type ModelWithReadOnlyAndWriteOnly = { + foo: string; + readonly bar: string; + baz: string; +}; + +export type ModelWithConstantSizeArray = [ + number, + number +]; + +export type ModelWithAnyOfConstantSizeArray = [ + (number | string), + (number | string), + (number | string) +]; + +export type ModelWithPrefixItemsConstantSizeArray = [ + ModelWithInteger, + (number | string), + string +]; + +export type ModelWithAnyOfConstantSizeArrayNullable = [ + ((number) | null | string), + ((number) | null | string), + ((number) | null | string) +]; + +export type ModelWithAnyOfConstantSizeArrayWithNSizeAndOptions = [ + (number | _import), + (number | _import) +]; + +export type ModelWithAnyOfConstantSizeArrayAndIntersect = [ + (number & string), + (number & string) +]; + +export type ModelWithNumericEnumUnion = { + /** + * Период + */ + value?: -10 | -1 | 0 | 1 | 3 | 6 | 12; +}; + +/** + * Период + */ +export type value = -10 | -1 | 0 | 1 | 3 | 6 | 12; + +/** + * Some description with `back ticks` + */ +export type ModelWithBackticksInDescription = { + /** + * The template `that` should be used for parsing and importing the contents of the CSV file. + * + *

There is one placeholder currently supported:

  • ${x} - refers to the n-th column in the CSV file, e.g. ${1}, ${2}, ...)

Example of a correct JSON template:

+ *
+     * [
+     * {
+     * "resourceType": "Asset",
+     * "identifier": {
+     * "name": "${1}",
+     * "domain": {
+     * "name": "${2}",
+     * "community": {
+     * "name": "Some Community"
+     * }
+     * }
+     * },
+     * "attributes" : {
+     * "00000000-0000-0000-0000-000000003115" : [ {
+     * "value" : "${3}"
+     * } ],
+     * "00000000-0000-0000-0000-000000000222" : [ {
+     * "value" : "${4}"
+     * } ]
+     * }
+     * }
+     * ]
+     * 
+ */ + template?: string; +}; + +export type ModelWithOneOfAndProperties = (ParameterSimpleParameter | NonAsciiStringæøåÆØÅöôêÊ字符串) & { + baz: (number) | null; + qux: number; +}; + +/** + * Model used to test deduplication strategy (unused) + */ +export type ParameterSimpleParameterUnused = string; + +/** + * Model used to test deduplication strategy + */ +export type PostServiceWithEmptyTagResponse = string; + +/** + * Model used to test deduplication strategy + */ +export type PostServiceWithEmptyTagResponse2 = string; + +/** + * Model used to test deduplication strategy + */ +export type DeleteFooData = string; + +/** + * Model used to test deduplication strategy + */ +export type DeleteFooData2 = string; + +/** + * Model with restricted keyword name + */ +export type _import = string; + +export type SchemaWithFormRestrictedKeys = { + description?: string; + 'x-enum-descriptions'?: string; + 'x-enum-varnames'?: string; + 'x-enumNames'?: string; + title?: string; + object?: { + description?: string; + 'x-enum-descriptions'?: string; + 'x-enum-varnames'?: string; + 'x-enumNames'?: string; + title?: string; + }; + array?: Array<({ + description?: string; + 'x-enum-descriptions'?: string; + 'x-enum-varnames'?: string; + 'x-enumNames'?: string; + title?: string; +})>; +}; + +/** + * This schema was giving PascalCase transformations a hard time + */ +export type io_k8s_apimachinery_pkg_apis_meta_v1_DeleteOptions = { + /** + * Must be fulfilled before a deletion is carried out. If not possible, a 409 Conflict status will be returned. + */ + preconditions?: (io_k8s_apimachinery_pkg_apis_meta_v1_Preconditions); +}; + +/** + * This schema was giving PascalCase transformations a hard time + */ +export type io_k8s_apimachinery_pkg_apis_meta_v1_Preconditions = { + /** + * Specifies the target ResourceVersion + */ + resourceVersion?: string; + /** + * Specifies the target UID. + */ + uid?: string; +}; + +export type AdditionalPropertiesUnknownIssue = { + [key: string]: (string | number); +}; + +export type AdditionalPropertiesUnknownIssue2 = { + [key: string]: (string | number); +}; + +export type AdditionalPropertiesUnknownIssue3 = string & { + entries: { + [key: string]: AdditionalPropertiesUnknownIssue; + }; +}; + +export type AdditionalPropertiesIntegerIssue = { + value: number; + [key: string]: (number) | undefined; +}; + +export type OneOfAllOfIssue = ((ConstValue | Generic_Schema_Duplicate_Issue_1_System_Boolean_) & _3e_num_1Период) | Generic_Schema_Duplicate_Issue_1_System_String_; + +export type Generic_Schema_Duplicate_Issue_1_System_Boolean_ = { + item?: boolean; + error?: (string) | null; + readonly hasError?: boolean; + data?: { + [key: string]: unknown; + }; +}; + +export type Generic_Schema_Duplicate_Issue_1_System_String_ = { + item?: (string) | null; + error?: (string) | null; + readonly hasError?: boolean; +}; + +/** + * This is a reusable parameter + */ +export type ParameterSimpleParameter = string; + +/** + * Parameter with illegal characters + */ +export type Parameterx_Foo_Bar = ModelWithString; + +export type ImportData = { + body: (ModelWithReadOnlyAndWriteOnly | ModelWithArrayReadOnlyAndWriteOnly); +}; + +export type ImportResponse = (Model_From_Zendesk | ModelWithReadOnlyAndWriteOnly); + +export type ImportError = unknown; + +export type ApiVversionOdataControllerCountResponse = (Model_From_Zendesk); + +export type ApiVversionOdataControllerCountError = unknown; + +export type GetApiVbyApiVersionSimpleOperationData = { + path: { + /** + * foo in method + */ + foo_param: string; + }; +}; + +export type GetApiVbyApiVersionSimpleOperationResponse = (number); + +export type GetApiVbyApiVersionSimpleOperationError = (ModelWithBoolean); + +export type DeleteFooData3 = { + headers: { + /** + * Parameter with illegal characters + */ + 'x-Foo-Bar': ModelWithString; + }; + path: { + /** + * bar in method + */ + BarParam: string; + /** + * foo in method + */ + foo_param: string; + }; +}; + +export type CallWithDescriptionsData = { + query?: { + /** + * Testing backticks in string: `backticks` and ```multiple backticks``` should work + */ + parameterWithBackticks?: unknown; + /** + * Testing multiline comments in string: First line + * Second line + * + * Fourth line + */ + parameterWithBreaks?: unknown; + /** + * Testing expression placeholders in string: ${expression} should work + */ + parameterWithExpressionPlaceholders?: unknown; + /** + * Testing quotes in string: 'single quote''' and "double quotes""" should work + */ + parameterWithQuotes?: unknown; + /** + * Testing reserved characters in string: * inline * and ** inline ** should work + */ + parameterWithReservedCharacters?: unknown; + /** + * Testing slashes in string: \backwards\\\ and /forwards/// should work + */ + parameterWithSlashes?: unknown; + }; +}; + +export type DeprecatedCallData = { + headers: { + /** + * This parameter is deprecated + * @deprecated + */ + parameter: (DeprecatedModel) | null; + }; +}; + +export type CallWithParametersData = { + /** + * This is the parameter that goes into the body + */ + body: { + [key: string]: unknown; + } | null; + headers: { + /** + * This is the parameter that goes into the header + */ + parameterHeader: (string) | null; + }; + path: { + /** + * api-version should be required in standalone clients + */ + 'api-version': (string) | null; + /** + * This is the parameter that goes into the path + */ + parameterPath: (string) | null; + }; + query: { + /** + * This is the parameter that goes into the query params + */ + cursor: (string) | null; + foo_all_of_enum: (ModelWithNestedArrayEnumsDataFoo); + foo_ref_enum?: ModelWithNestedArrayEnumsDataFoo; + }; +}; + +export type CallWithWeirdParameterNamesData = { + /** + * This is the parameter that goes into the body + */ + body: (ModelWithString) | null; + headers: { + /** + * This is the parameter that goes into the request header + */ + 'parameter.header': (string) | null; + }; + path: { + /** + * api-version should be required in standalone clients + */ + 'api-version': (string) | null; + /** + * This is the parameter that goes into the path + */ + 'parameter-path-2'?: string; + /** + * This is the parameter that goes into the path + */ + 'PARAMETER-PATH-3'?: string; + /** + * This is the parameter that goes into the path + */ + 'parameter.path.1'?: string; + }; + query: { + /** + * This is the parameter with a reserved keyword + */ + default?: string; + /** + * This is the parameter that goes into the request query params + */ + 'parameter-query': (string) | null; + }; +}; + +export type GetCallWithOptionalParamData = { + /** + * This is a required parameter + */ + body: ModelWithOneOfEnum; + query?: { + /** + * This is an optional parameter + */ + page?: number; + }; +}; + +export type PostCallWithOptionalParamData = { + /** + * This is an optional parameter + */ + body?: { + offset?: (number) | null; + }; + query: { + /** + * This is a required parameter + */ + parameter: Pageable; + }; +}; + +export type PostCallWithOptionalParamResponse = (number | void); + +export type PostCallWithOptionalParamError = unknown; + +export type PostApiVbyApiVersionRequestBodyData = { + /** + * A reusable request body + */ + body?: ModelWithString; + query?: { + /** + * This is a reusable parameter + */ + parameter?: string; + }; +}; + +export type PostApiVbyApiVersionFormDataData = { + /** + * A reusable request body + */ + body?: ModelWithString; + query?: { + /** + * This is a reusable parameter + */ + parameter?: string; + }; +}; + +export type CallWithDefaultParametersData = { + query?: { + /** + * This is a simple boolean with default value + */ + parameterBoolean?: (boolean) | null; + /** + * This is a simple enum with default value + */ + parameterEnum?: 'Success' | 'Warning' | 'Error'; + /** + * This is a simple model with default value + */ + parameterModel?: (ModelWithString) | null; + /** + * This is a simple number with default value + */ + parameterNumber?: (number) | null; + /** + * This is a simple string with default value + */ + parameterString?: (string) | null; + }; +}; + +export type CallWithDefaultOptionalParametersData = { + query?: { + /** + * This is a simple boolean that is optional with default value + */ + parameterBoolean?: boolean; + /** + * This is a simple enum that is optional with default value + */ + parameterEnum?: 'Success' | 'Warning' | 'Error'; + /** + * This is a simple model that is optional with default value + */ + parameterModel?: ModelWithString; + /** + * This is a simple number that is optional with default value + */ + parameterNumber?: number; + /** + * This is a simple string that is optional with default value + */ + parameterString?: string; + }; +}; + +export type CallToTestOrderOfParamsData = { + query: { + /** + * This is a optional string with default + */ + parameterOptionalStringWithDefault?: string; + /** + * This is a optional string with empty default + */ + parameterOptionalStringWithEmptyDefault?: string; + /** + * This is a optional string with no default + */ + parameterOptionalStringWithNoDefault?: string; + /** + * This is a string that can be null with default + */ + parameterStringNullableWithDefault?: (string) | null; + /** + * This is a string that can be null with no default + */ + parameterStringNullableWithNoDefault?: (string) | null; + /** + * This is a string with default + */ + parameterStringWithDefault: string; + /** + * This is a string with empty default + */ + parameterStringWithEmptyDefault: string; + /** + * This is a string with no default + */ + parameterStringWithNoDefault: string; + }; +}; + +export type CallWithNoContentResponseResponse = (void); + +export type CallWithNoContentResponseError = unknown; + +export type CallWithResponseAndNoContentResponseResponse = (number | void); + +export type CallWithResponseAndNoContentResponseError = unknown; + +export type DummyAResponse = (_400); + +export type DummyAError = unknown; + +export type DummyBResponse = (void); + +export type DummyBError = unknown; + +export type CallWithResponseResponse = (_import); + +export type CallWithResponseError = unknown; + +export type CallWithDuplicateResponsesResponse = ((ModelWithBoolean & ModelWithInteger) | ModelWithString); + +export type CallWithDuplicateResponsesError = (ModelWithStringError | DictionaryWithArray | ModelWithBoolean); + +export type CallWithResponsesResponse = ({ + readonly '@namespace.string'?: string; + readonly '@namespace.integer'?: number; + readonly value?: Array; +} | ModelThatExtends | ModelThatExtendsExtends); + +export type CallWithResponsesError = (ModelWithStringError); + +export type CollectionFormatData = { + query: { + /** + * This is an array parameter that is sent as csv format (comma-separated values) + */ + parameterArrayCSV: Array<(string)> | null; + /** + * This is an array parameter that is sent as multi format (multiple parameter instances) + */ + parameterArrayMulti: Array<(string)> | null; + /** + * This is an array parameter that is sent as pipes format (pipe-separated values) + */ + parameterArrayPipes: Array<(string)> | null; + /** + * This is an array parameter that is sent as ssv format (space-separated values) + */ + parameterArraySSV: Array<(string)> | null; + /** + * This is an array parameter that is sent as tsv format (tab-separated values) + */ + parameterArrayTSV: Array<(string)> | null; + }; +}; + +export type TypesData = { + path?: { + /** + * This is a number parameter + */ + id?: number; + }; + query: { + /** + * This is an array parameter + */ + parameterArray: Array<(string)> | null; + /** + * This is a boolean parameter + */ + parameterBoolean: (boolean) | null; + /** + * This is a dictionary parameter + */ + parameterDictionary: { + [key: string]: unknown; + } | null; + /** + * This is an enum parameter + */ + parameterEnum: ('Success' | 'Warning' | 'Error') | null; + /** + * This is a number parameter + */ + parameterNumber: number; + /** + * This is an object parameter + */ + parameterObject: { + [key: string]: unknown; + } | null; + /** + * This is a string parameter + */ + parameterString: (string) | null; + }; +}; + +export type TypesResponse = (number | string | boolean | { + [key: string]: unknown; +}); + +export type TypesError = unknown; + +export type UploadFileData = { + body: (Blob | File); + path: { + /** + * api-version should be required in standalone clients + */ + 'api-version': (string) | null; + }; +}; + +export type UploadFileResponse = (boolean); + +export type UploadFileError = unknown; + +export type FileResponseData = { + path: { + /** + * api-version should be required in standalone clients + */ + 'api-version': string; + id: string; + }; +}; + +export type FileResponseResponse = ((Blob | File)); + +export type FileResponseError = unknown; + +export type ComplexTypesData = { + query: { + /** + * Parameter containing object + */ + parameterObject: { + first?: { + second?: { + third?: string; + }; + }; + }; + /** + * Parameter containing reference + */ + parameterReference: ModelWithString; + }; +}; + +export type ComplexTypesResponse = (Array); + +export type ComplexTypesError = (unknown); + +export type MultipartRequestData = { + body?: { + content?: (Blob | File); + data?: ((ModelWithString) | null); + }; +}; + +export type MultipartResponseResponse = ({ + file?: (Blob | File); + metadata?: { + foo?: string; + bar?: string; + }; +}); + +export type MultipartResponseError = unknown; + +export type ComplexParamsData = { + body?: { + readonly key: (string) | null; + name: (string) | null; + enabled?: boolean; + readonly type: 'Monkey' | 'Horse' | 'Bird'; + listOfModels?: Array | null; + listOfStrings?: Array<(string)> | null; + parameters: (ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary); + readonly user?: { + readonly id?: number; + readonly name?: (string) | null; + }; + }; + path: { + /** + * api-version should be required in standalone clients + */ + 'api-version': string; + id: number; + }; +}; + +export type ComplexParamsResponse = (ModelWithString); + +export type ComplexParamsError = unknown; + +export type CallWithResultFromHeaderResponse = (string); + +export type CallWithResultFromHeaderError = (unknown); + +export type TestErrorCodeData = { + query: { + /** + * Status code to return + */ + status: number; + }; +}; + +export type TestErrorCodeResponse = (unknown); + +export type TestErrorCodeError = (unknown); + +export type NonAsciiæøåÆøÅöôêÊ字符串Data = { + query: { + /** + * Dummy input param + */ + nonAsciiParamæøåÆØÅöôêÊ: number; + }; +}; + +export type NonAsciiæøåÆøÅöôêÊ字符串Response = (Array); + +export type NonAsciiæøåÆøÅöôêÊ字符串Error = unknown; + +export type PutWithFormUrlEncodedData = { + body: ArrayWithStrings; +}; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/vue-query/asClass/@tanstack/vue-query.gen.ts b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/vue-query/asClass/@tanstack/vue-query.gen.ts new file mode 100644 index 000000000..fbc84a28d --- /dev/null +++ b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/vue-query/asClass/@tanstack/vue-query.gen.ts @@ -0,0 +1,997 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import type { Options } from '@hey-api/client-fetch'; +import { queryOptions, type UseMutationOptions, type DefaultError, infiniteQueryOptions, type InfiniteData } from '@tanstack/vue-query'; +import type { CollectionFormatData, ComplexTypesData, ComplexParamsData, ComplexParamsError, ComplexParamsResponse, ImportData, ImportError, ImportResponse, GetApiVbyApiVersionSimpleOperationData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, DeprecatedCallData, CallWithDescriptionsData, TestErrorCodeData, TestErrorCodeError, TestErrorCodeResponse, FileResponseData, PostApiVbyApiVersionFormDataData, CallWithResultFromHeaderError, CallWithResultFromHeaderResponse, MultipartRequestData, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Error, NonAsciiæøåÆøÅöôêÊ字符串Response, PutWithFormUrlEncodedData, DeleteFooData3, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamData, PostCallWithOptionalParamError, PostCallWithOptionalParamResponse, PostApiVbyApiVersionRequestBodyData, CallWithDuplicateResponsesError, CallWithDuplicateResponsesResponse, CallWithResponsesError, CallWithResponsesResponse, TypesData, UploadFileData, UploadFileError, UploadFileResponse } from '../types.gen'; +import { client, CollectionFormatService, ComplexService, DefaultService, DefaultsService, DeprecatedService, DescriptionsService, DuplicateService, ErrorService, FileResponseService, FormDataService, HeaderService, MultipartService, MultipleTags1Service, NoContentService, NonAsciiÆøåÆøÅöôêÊService, ParametersService, RequestBodyService, ResponseService, SimpleService, TypesService, UploadService } from '../services.gen'; + +type QueryKey = [ + Pick & { + _id: string; + _infinite?: boolean; + } +]; + +const createQueryKey = (id: string, options?: TOptions, infinite?: boolean): QueryKey[0] => { + const params: QueryKey[0] = { _id: id, baseUrl: (options?.client ?? client).getConfig().baseUrl } as QueryKey[0]; + if (infinite) { + params._infinite = infinite; + } + if (options?.body) { + params.body = options.body; + } + if (options?.headers) { + params.headers = options.headers; + } + if (options?.path) { + params.path = options.path; + } + if (options?.query) { + params.query = options.query; + } + return params; +}; + +export const collectionFormatQueryKey = (options: Options) => [ + createQueryKey("collectionFormat", options) +]; + +export const collectionFormatOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await CollectionFormatService.collectionFormat({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: collectionFormatQueryKey(options) +}); }; + +export const complexTypesQueryKey = (options: Options) => [ + createQueryKey("complexTypes", options) +]; + +export const complexTypesOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await ComplexService.complexTypes({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: complexTypesQueryKey(options) +}); }; + +export const complexParamsMutation = () => { const mutationOptions: UseMutationOptions> = { + mutationFn: async (options) => { + const { data } = await ComplexService.complexParams({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const exportQueryKey = (options?: Options) => [ + createQueryKey("export", options) +]; + +export const exportOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await DefaultService.export({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: exportQueryKey(options) +}); }; + +export const importQueryKey = (options: Options) => [ + createQueryKey("import", options) +]; + +export const importOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await DefaultService.import({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: importQueryKey(options) +}); }; + +export const importMutation = () => { const mutationOptions: UseMutationOptions> = { + mutationFn: async (options) => { + const { data } = await DefaultService.import({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const getApiVbyApiVersionSimpleOperationQueryKey = (options: Options) => [ + createQueryKey("getApiVbyApiVersionSimpleOperation", options) +]; + +export const getApiVbyApiVersionSimpleOperationOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await DefaultService.getApiVbyApiVersionSimpleOperation({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: getApiVbyApiVersionSimpleOperationQueryKey(options) +}); }; + +export const callWithDefaultParametersQueryKey = (options?: Options) => [ + createQueryKey("callWithDefaultParameters", options) +]; + +export const callWithDefaultParametersOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await DefaultsService.callWithDefaultParameters({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: callWithDefaultParametersQueryKey(options) +}); }; + +export const callWithDefaultOptionalParametersQueryKey = (options?: Options) => [ + createQueryKey("callWithDefaultOptionalParameters", options) +]; + +export const callWithDefaultOptionalParametersOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await DefaultsService.callWithDefaultOptionalParameters({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: callWithDefaultOptionalParametersQueryKey(options) +}); }; + +export const callWithDefaultOptionalParametersMutation = () => { const mutationOptions: UseMutationOptions> = { + mutationFn: async (options) => { + const { data } = await DefaultsService.callWithDefaultOptionalParameters({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const callToTestOrderOfParamsMutation = () => { const mutationOptions: UseMutationOptions> = { + mutationFn: async (options) => { + const { data } = await DefaultsService.callToTestOrderOfParams({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const deprecatedCallQueryKey = (options: Options) => [ + createQueryKey("deprecatedCall", options) +]; + +export const deprecatedCallOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await DeprecatedService.deprecatedCall({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: deprecatedCallQueryKey(options) +}); }; + +export const deprecatedCallMutation = () => { const mutationOptions: UseMutationOptions> = { + mutationFn: async (options) => { + const { data } = await DeprecatedService.deprecatedCall({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const callWithDescriptionsQueryKey = (options?: Options) => [ + createQueryKey("callWithDescriptions", options) +]; + +export const callWithDescriptionsOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await DescriptionsService.callWithDescriptions({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: callWithDescriptionsQueryKey(options) +}); }; + +export const callWithDescriptionsMutation = () => { const mutationOptions: UseMutationOptions> = { + mutationFn: async (options) => { + const { data } = await DescriptionsService.callWithDescriptions({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const duplicateNameQueryKey = (options?: Options) => [ + createQueryKey("duplicateName", options) +]; + +export const duplicateNameOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await DuplicateService.duplicateName({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: duplicateNameQueryKey(options) +}); }; + +export const duplicateName1QueryKey = (options?: Options) => [ + createQueryKey("duplicateName1", options) +]; + +export const duplicateName1Options = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await DuplicateService.duplicateName1({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: duplicateName1QueryKey(options) +}); }; + +export const duplicateName1Mutation = () => { const mutationOptions: UseMutationOptions = { + mutationFn: async (options) => { + const { data } = await DuplicateService.duplicateName1({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const duplicateName2Mutation = () => { const mutationOptions: UseMutationOptions = { + mutationFn: async (options) => { + const { data } = await DuplicateService.duplicateName2({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const duplicateName3Mutation = () => { const mutationOptions: UseMutationOptions = { + mutationFn: async (options) => { + const { data } = await DuplicateService.duplicateName3({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const testErrorCodeQueryKey = (options: Options) => [ + createQueryKey("testErrorCode", options) +]; + +export const testErrorCodeOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await ErrorService.testErrorCode({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: testErrorCodeQueryKey(options) +}); }; + +export const testErrorCodeMutation = () => { const mutationOptions: UseMutationOptions> = { + mutationFn: async (options) => { + const { data } = await ErrorService.testErrorCode({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const fileResponseQueryKey = (options: Options) => [ + createQueryKey("fileResponse", options) +]; + +export const fileResponseOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await FileResponseService.fileResponse({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: fileResponseQueryKey(options) +}); }; + +export const postApiVbyApiVersionFormDataQueryKey = (options?: Options) => [ + createQueryKey("postApiVbyApiVersionFormData", options) +]; + +export const postApiVbyApiVersionFormDataOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await FormDataService.postApiVbyApiVersionFormData({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: postApiVbyApiVersionFormDataQueryKey(options) +}); }; + +export const postApiVbyApiVersionFormDataMutation = () => { const mutationOptions: UseMutationOptions> = { + mutationFn: async (options) => { + const { data } = await FormDataService.postApiVbyApiVersionFormData({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const callWithResultFromHeaderQueryKey = (options?: Options) => [ + createQueryKey("callWithResultFromHeader", options) +]; + +export const callWithResultFromHeaderOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await HeaderService.callWithResultFromHeader({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: callWithResultFromHeaderQueryKey(options) +}); }; + +export const callWithResultFromHeaderMutation = () => { const mutationOptions: UseMutationOptions = { + mutationFn: async (options) => { + const { data } = await HeaderService.callWithResultFromHeader({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const multipartRequestQueryKey = (options?: Options) => [ + createQueryKey("multipartRequest", options) +]; + +export const multipartRequestOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await MultipartService.multipartRequest({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: multipartRequestQueryKey(options) +}); }; + +export const multipartRequestMutation = () => { const mutationOptions: UseMutationOptions> = { + mutationFn: async (options) => { + const { data } = await MultipartService.multipartRequest({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const multipartResponseQueryKey = (options?: Options) => [ + createQueryKey("multipartResponse", options) +]; + +export const multipartResponseOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await MultipartService.multipartResponse({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: multipartResponseQueryKey(options) +}); }; + +export const dummyAQueryKey = (options?: Options) => [ + createQueryKey("dummyA", options) +]; + +export const dummyAOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await MultipleTags1Service.dummyA({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: dummyAQueryKey(options) +}); }; + +export const dummyBQueryKey = (options?: Options) => [ + createQueryKey("dummyB", options) +]; + +export const dummyBOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await MultipleTags1Service.dummyB({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: dummyBQueryKey(options) +}); }; + +export const callWithNoContentResponseQueryKey = (options?: Options) => [ + createQueryKey("callWithNoContentResponse", options) +]; + +export const callWithNoContentResponseOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await NoContentService.callWithNoContentResponse({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: callWithNoContentResponseQueryKey(options) +}); }; + +export const callWithResponseAndNoContentResponseQueryKey = (options?: Options) => [ + createQueryKey("callWithResponseAndNoContentResponse", options) +]; + +export const callWithResponseAndNoContentResponseOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await NoContentService.callWithResponseAndNoContentResponse({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: callWithResponseAndNoContentResponseQueryKey(options) +}); }; + +export const nonAsciiæøåÆøÅöôêÊ字符串QueryKey = (options: Options) => [ + createQueryKey("nonAsciiæøåÆøÅöôêÊ字符串", options) +]; + +export const nonAsciiæøåÆøÅöôêÊ字符串Options = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await NonAsciiÆøåÆøÅöôêÊService.nonAsciiæøåÆøÅöôêÊ字符串({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: nonAsciiæøåÆøÅöôêÊ字符串QueryKey(options) +}); }; + +export const nonAsciiæøåÆøÅöôêÊ字符串Mutation = () => { const mutationOptions: UseMutationOptions> = { + mutationFn: async (options) => { + const { data } = await NonAsciiÆøåÆøÅöôêÊService.nonAsciiæøåÆøÅöôêÊ字符串({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const putWithFormUrlEncodedMutation = () => { const mutationOptions: UseMutationOptions> = { + mutationFn: async (options) => { + const { data } = await NonAsciiÆøåÆøÅöôêÊService.putWithFormUrlEncoded({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const deleteFooMutation = () => { const mutationOptions: UseMutationOptions> = { + mutationFn: async (options) => { + const { data } = await ParametersService.deleteFoo({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const callWithParametersQueryKey = (options: Options) => [ + createQueryKey("callWithParameters", options) +]; + +export const callWithParametersOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await ParametersService.callWithParameters({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: callWithParametersQueryKey(options) +}); }; + +export const callWithParametersInfiniteQueryKey = (options: Options): QueryKey> => [ + createQueryKey("callWithParameters", options, true) +]; + +export const callWithParametersInfiniteOptions = (options: Options) => { return infiniteQueryOptions, QueryKey>, string | Pick>[0], 'body' | 'headers' | 'path' | 'query'>>( +// @ts-ignore +{ + queryFn: async ({ pageParam, queryKey }) => { + // @ts-ignore + const page: Pick>[0], 'body' | 'headers' | 'path' | 'query'> = typeof pageParam === "object" ? pageParam : { + query: { + cursor: pageParam + } + }; + const params: Partial> = {}; + if (page.body) { + params.body = { + ...queryKey[0].body as any, + ...page.body as any + }; + } + if (page.headers) { + params.headers = { + ...queryKey[0].headers, + ...page.headers + }; + } + if (page.path) { + params.path = { + ...queryKey[0].path, + ...page.path + }; + } + if (page.query) { + params.query = { + ...queryKey[0].query, + ...page.query + }; + } + const { data } = await ParametersService.callWithParameters({ + ...options, + ...queryKey[0], + ...params, + throwOnError: true + }); + return data; + }, + queryKey: callWithParametersInfiniteQueryKey(options) +}); }; + +export const callWithParametersMutation = () => { const mutationOptions: UseMutationOptions> = { + mutationFn: async (options) => { + const { data } = await ParametersService.callWithParameters({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const callWithWeirdParameterNamesQueryKey = (options: Options) => [ + createQueryKey("callWithWeirdParameterNames", options) +]; + +export const callWithWeirdParameterNamesOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await ParametersService.callWithWeirdParameterNames({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: callWithWeirdParameterNamesQueryKey(options) +}); }; + +export const callWithWeirdParameterNamesMutation = () => { const mutationOptions: UseMutationOptions> = { + mutationFn: async (options) => { + const { data } = await ParametersService.callWithWeirdParameterNames({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const getCallWithOptionalParamQueryKey = (options: Options) => [ + createQueryKey("getCallWithOptionalParam", options) +]; + +export const getCallWithOptionalParamOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await ParametersService.getCallWithOptionalParam({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: getCallWithOptionalParamQueryKey(options) +}); }; + +export const getCallWithOptionalParamInfiniteQueryKey = (options: Options): QueryKey> => [ + createQueryKey("getCallWithOptionalParam", options, true) +]; + +export const getCallWithOptionalParamInfiniteOptions = (options: Options) => { return infiniteQueryOptions, QueryKey>, number | Pick>[0], 'body' | 'headers' | 'path' | 'query'>>( +// @ts-ignore +{ + queryFn: async ({ pageParam, queryKey }) => { + // @ts-ignore + const page: Pick>[0], 'body' | 'headers' | 'path' | 'query'> = typeof pageParam === "object" ? pageParam : { + query: { + page: pageParam + } + }; + const params: Partial> = {}; + if (page.body) { + params.body = { + ...queryKey[0].body as any, + ...page.body as any + }; + } + if (page.headers) { + params.headers = { + ...queryKey[0].headers, + ...page.headers + }; + } + if (page.path) { + params.path = { + ...queryKey[0].path, + ...page.path + }; + } + if (page.query) { + params.query = { + ...queryKey[0].query, + ...page.query + }; + } + const { data } = await ParametersService.getCallWithOptionalParam({ + ...options, + ...queryKey[0], + ...params, + throwOnError: true + }); + return data; + }, + queryKey: getCallWithOptionalParamInfiniteQueryKey(options) +}); }; + +export const postCallWithOptionalParamQueryKey = (options: Options) => [ + createQueryKey("postCallWithOptionalParam", options) +]; + +export const postCallWithOptionalParamOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await ParametersService.postCallWithOptionalParam({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: postCallWithOptionalParamQueryKey(options) +}); }; + +export const postCallWithOptionalParamInfiniteQueryKey = (options: Options): QueryKey> => [ + createQueryKey("postCallWithOptionalParam", options, true) +]; + +export const postCallWithOptionalParamInfiniteOptions = (options: Options) => { return infiniteQueryOptions, QueryKey>, number | Pick>[0], 'body' | 'headers' | 'path' | 'query'>>( +// @ts-ignore +{ + queryFn: async ({ pageParam, queryKey }) => { + // @ts-ignore + const page: Pick>[0], 'body' | 'headers' | 'path' | 'query'> = typeof pageParam === "object" ? pageParam : { + body: { + offset: pageParam + } + }; + const params: Partial> = {}; + if (page.body) { + params.body = { + ...queryKey[0].body as any, + ...page.body as any + }; + } + if (page.headers) { + params.headers = { + ...queryKey[0].headers, + ...page.headers + }; + } + if (page.path) { + params.path = { + ...queryKey[0].path, + ...page.path + }; + } + if (page.query) { + params.query = { + ...queryKey[0].query, + ...page.query + }; + } + const { data } = await ParametersService.postCallWithOptionalParam({ + ...options, + ...queryKey[0], + ...params, + throwOnError: true + }); + return data; + }, + queryKey: postCallWithOptionalParamInfiniteQueryKey(options) +}); }; + +export const postCallWithOptionalParamMutation = () => { const mutationOptions: UseMutationOptions> = { + mutationFn: async (options) => { + const { data } = await ParametersService.postCallWithOptionalParam({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const postApiVbyApiVersionRequestBodyQueryKey = (options?: Options) => [ + createQueryKey("postApiVbyApiVersionRequestBody", options) +]; + +export const postApiVbyApiVersionRequestBodyOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await RequestBodyService.postApiVbyApiVersionRequestBody({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: postApiVbyApiVersionRequestBodyQueryKey(options) +}); }; + +export const postApiVbyApiVersionRequestBodyMutation = () => { const mutationOptions: UseMutationOptions> = { + mutationFn: async (options) => { + const { data } = await RequestBodyService.postApiVbyApiVersionRequestBody({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const callWithResponseQueryKey = (options?: Options) => [ + createQueryKey("callWithResponse", options) +]; + +export const callWithResponseOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await ResponseService.callWithResponse({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: callWithResponseQueryKey(options) +}); }; + +export const callWithDuplicateResponsesQueryKey = (options?: Options) => [ + createQueryKey("callWithDuplicateResponses", options) +]; + +export const callWithDuplicateResponsesOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await ResponseService.callWithDuplicateResponses({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: callWithDuplicateResponsesQueryKey(options) +}); }; + +export const callWithDuplicateResponsesMutation = () => { const mutationOptions: UseMutationOptions = { + mutationFn: async (options) => { + const { data } = await ResponseService.callWithDuplicateResponses({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const callWithResponsesMutation = () => { const mutationOptions: UseMutationOptions = { + mutationFn: async (options) => { + const { data } = await ResponseService.callWithResponses({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const apiVVersionOdataControllerCountQueryKey = (options?: Options) => [ + createQueryKey("apiVVersionOdataControllerCount", options) +]; + +export const apiVVersionOdataControllerCountOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await SimpleService.apiVVersionOdataControllerCount({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: apiVVersionOdataControllerCountQueryKey(options) +}); }; + +export const getCallWithoutParametersAndResponseQueryKey = (options?: Options) => [ + createQueryKey("getCallWithoutParametersAndResponse", options) +]; + +export const getCallWithoutParametersAndResponseOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await SimpleService.getCallWithoutParametersAndResponse({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: getCallWithoutParametersAndResponseQueryKey(options) +}); }; + +export const putCallWithoutParametersAndResponseMutation = () => { const mutationOptions: UseMutationOptions = { + mutationFn: async (options) => { + const { data } = await SimpleService.putCallWithoutParametersAndResponse({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const postCallWithoutParametersAndResponseQueryKey = (options?: Options) => [ + createQueryKey("postCallWithoutParametersAndResponse", options) +]; + +export const postCallWithoutParametersAndResponseOptions = (options?: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await SimpleService.postCallWithoutParametersAndResponse({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: postCallWithoutParametersAndResponseQueryKey(options) +}); }; + +export const postCallWithoutParametersAndResponseMutation = () => { const mutationOptions: UseMutationOptions = { + mutationFn: async (options) => { + const { data } = await SimpleService.postCallWithoutParametersAndResponse({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const deleteCallWithoutParametersAndResponseMutation = () => { const mutationOptions: UseMutationOptions = { + mutationFn: async (options) => { + const { data } = await SimpleService.deleteCallWithoutParametersAndResponse({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const patchCallWithoutParametersAndResponseMutation = () => { const mutationOptions: UseMutationOptions = { + mutationFn: async (options) => { + const { data } = await SimpleService.patchCallWithoutParametersAndResponse({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; + +export const typesQueryKey = (options: Options) => [ + createQueryKey("types", options) +]; + +export const typesOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await TypesService.types({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: typesQueryKey(options) +}); }; + +export const uploadFileQueryKey = (options: Options) => [ + createQueryKey("uploadFile", options) +]; + +export const uploadFileOptions = (options: Options) => { return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await UploadService.uploadFile({ + ...options, + ...queryKey[0], + throwOnError: true + }); + return data; + }, + queryKey: uploadFileQueryKey(options) +}); }; + +export const uploadFileMutation = () => { const mutationOptions: UseMutationOptions> = { + mutationFn: async (options) => { + const { data } = await UploadService.uploadFile({ + ...options, + throwOnError: true + }); + return data; + } +}; return mutationOptions; }; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-react-query_transform/index.ts.snap b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/vue-query/asClass/index.ts similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-react-query_transform/index.ts.snap rename to packages/openapi-ts/test/__snapshots__/plugins/@tanstack/vue-query/asClass/index.ts diff --git a/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/vue-query/asClass/services.gen.ts b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/vue-query/asClass/services.gen.ts new file mode 100644 index 000000000..2b3087c92 --- /dev/null +++ b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/vue-query/asClass/services.gen.ts @@ -0,0 +1,451 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { createClient, createConfig, type Options, formDataBodySerializer, urlSearchParamsBodySerializer } from '@hey-api/client-fetch'; +import type { ImportData, ImportError, ImportResponse, GetApiVbyApiVersionSimpleOperationData, GetApiVbyApiVersionSimpleOperationError, GetApiVbyApiVersionSimpleOperationResponse, ApiVversionOdataControllerCountError, ApiVversionOdataControllerCountResponse, DeleteFooData3, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamData, PostCallWithOptionalParamError, PostCallWithOptionalParamResponse, CallWithDescriptionsData, DeprecatedCallData, PostApiVbyApiVersionRequestBodyData, PostApiVbyApiVersionFormDataData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, CallWithNoContentResponseError, CallWithNoContentResponseResponse, CallWithResponseAndNoContentResponseError, CallWithResponseAndNoContentResponseResponse, CallWithResponseError, CallWithResponseResponse, CallWithDuplicateResponsesError, CallWithDuplicateResponsesResponse, CallWithResponsesError, CallWithResponsesResponse, DummyAError, DummyAResponse, DummyBError, DummyBResponse, CollectionFormatData, TypesData, TypesError, TypesResponse, UploadFileData, UploadFileError, UploadFileResponse, FileResponseData, FileResponseError, FileResponseResponse, ComplexTypesData, ComplexTypesError, ComplexTypesResponse, ComplexParamsData, ComplexParamsError, ComplexParamsResponse, MultipartRequestData, MultipartResponseError, MultipartResponseResponse, CallWithResultFromHeaderError, CallWithResultFromHeaderResponse, TestErrorCodeData, TestErrorCodeError, TestErrorCodeResponse, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Error, NonAsciiæøåÆøÅöôêÊ字符串Response, PutWithFormUrlEncodedData } from './types.gen'; + +export const client = createClient(createConfig()); + +export class DefaultService { + public static export(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/no-tag' + }); + } + + public static import(options: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/no-tag' + }); + } + + public static getApiVbyApiVersionSimpleOperation(options: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/simple:operation' + }); + } + +} + +export class SimpleService { + public static apiVVersionOdataControllerCount(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/simple/$count' + }); + } + + public static getCallWithoutParametersAndResponse(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/simple' + }); + } + + public static putCallWithoutParametersAndResponse(options?: Options) { + return (options?.client ?? client).put({ + ...options, + url: '/api/v{api-version}/simple' + }); + } + + public static postCallWithoutParametersAndResponse(options?: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/simple' + }); + } + + public static deleteCallWithoutParametersAndResponse(options?: Options) { + return (options?.client ?? client).delete({ + ...options, + url: '/api/v{api-version}/simple' + }); + } + + public static optionsCallWithoutParametersAndResponse(options?: Options) { + return (options?.client ?? client).options({ + ...options, + url: '/api/v{api-version}/simple' + }); + } + + public static headCallWithoutParametersAndResponse(options?: Options) { + return (options?.client ?? client).head({ + ...options, + url: '/api/v{api-version}/simple' + }); + } + + public static patchCallWithoutParametersAndResponse(options?: Options) { + return (options?.client ?? client).patch({ + ...options, + url: '/api/v{api-version}/simple' + }); + } + +} + +export class ParametersService { + public static deleteFoo(options: Options) { + return (options?.client ?? client).delete({ + ...options, + url: '/api/v{api-version}/foo/{foo_param}/bar/{BarParam}' + }); + } + + public static callWithParameters(options: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/parameters/{parameterPath}' + }); + } + + public static callWithWeirdParameterNames(options: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/parameters/{parameter.path.1}/{parameter-path-2}/{PARAMETER-PATH-3}' + }); + } + + public static getCallWithOptionalParam(options: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/parameters/' + }); + } + + public static postCallWithOptionalParam(options: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/parameters/' + }); + } + +} + +export class DescriptionsService { + public static callWithDescriptions(options?: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/descriptions/' + }); + } + +} + +export class DeprecatedService { + /** + * @deprecated + */ + public static deprecatedCall(options: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/parameters/deprecated' + }); + } + +} + +export class RequestBodyService { + public static postApiVbyApiVersionRequestBody(options?: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/requestBody/' + }); + } + +} + +export class FormDataService { + public static postApiVbyApiVersionFormData(options?: Options) { + return (options?.client ?? client).post({ + ...options, + ...formDataBodySerializer, + headers: { + 'Content-Type': null, + ...options?.headers + }, + url: '/api/v{api-version}/formData/' + }); + } + +} + +export class DefaultsService { + public static callWithDefaultParameters(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/defaults' + }); + } + + public static callWithDefaultOptionalParameters(options?: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/defaults' + }); + } + + public static callToTestOrderOfParams(options: Options) { + return (options?.client ?? client).put({ + ...options, + url: '/api/v{api-version}/defaults' + }); + } + +} + +export class DuplicateService { + public static duplicateName(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/duplicate' + }); + } + + public static duplicateName1(options?: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/duplicate' + }); + } + + public static duplicateName2(options?: Options) { + return (options?.client ?? client).put({ + ...options, + url: '/api/v{api-version}/duplicate' + }); + } + + public static duplicateName3(options?: Options) { + return (options?.client ?? client).delete({ + ...options, + url: '/api/v{api-version}/duplicate' + }); + } + +} + +export class NoContentService { + public static callWithNoContentResponse(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/no-content' + }); + } + + public static callWithResponseAndNoContentResponse(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/multiple-tags/response-and-no-content' + }); + } + +} + +export class ResponseService { + public static callWithResponseAndNoContentResponse(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/multiple-tags/response-and-no-content' + }); + } + + public static callWithResponse(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/response' + }); + } + + public static callWithDuplicateResponses(options?: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/response' + }); + } + + public static callWithResponses(options?: Options) { + return (options?.client ?? client).put({ + ...options, + url: '/api/v{api-version}/response' + }); + } + +} + +export class MultipleTags1Service { + public static dummyA(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/multiple-tags/a' + }); + } + + public static dummyB(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/multiple-tags/b' + }); + } + +} + +export class MultipleTags2Service { + public static dummyA(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/multiple-tags/a' + }); + } + + public static dummyB(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/multiple-tags/b' + }); + } + +} + +export class MultipleTags3Service { + public static dummyB(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/multiple-tags/b' + }); + } + +} + +export class CollectionFormatService { + public static collectionFormat(options: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/collectionFormat' + }); + } + +} + +export class TypesService { + public static types(options: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/types' + }); + } + +} + +export class UploadService { + public static uploadFile(options: Options) { + return (options?.client ?? client).post({ + ...options, + ...urlSearchParamsBodySerializer, + headers: { + 'Content-Type': 'application/x-www-form-urlencoded', + ...options?.headers + }, + url: '/api/v{api-version}/upload' + }); + } + +} + +export class FileResponseService { + public static fileResponse(options: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/file/{id}' + }); + } + +} + +export class ComplexService { + public static complexTypes(options: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/complex' + }); + } + + public static complexParams(options: Options) { + return (options?.client ?? client).put({ + ...options, + url: '/api/v{api-version}/complex/{id}' + }); + } + +} + +export class MultipartService { + public static multipartRequest(options?: Options) { + return (options?.client ?? client).post({ + ...options, + ...formDataBodySerializer, + headers: { + 'Content-Type': null, + ...options?.headers + }, + url: '/api/v{api-version}/multipart' + }); + } + + public static multipartResponse(options?: Options) { + return (options?.client ?? client).get({ + ...options, + url: '/api/v{api-version}/multipart' + }); + } + +} + +export class HeaderService { + public static callWithResultFromHeader(options?: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/header' + }); + } + +} + +export class ErrorService { + public static testErrorCode(options: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/error' + }); + } + +} + +export class NonAsciiÆøåÆøÅöôêÊService { + public static nonAsciiæøåÆøÅöôêÊ字符串(options: Options) { + return (options?.client ?? client).post({ + ...options, + url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串' + }); + } + + /** + * Login User + */ + public static putWithFormUrlEncoded(options: Options) { + return (options?.client ?? client).put({ + ...options, + ...urlSearchParamsBodySerializer, + headers: { + 'Content-Type': 'application/x-www-form-urlencoded', + ...options?.headers + }, + url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串' + }); + } + +} \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/vue-query/asClass/types.gen.ts b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/vue-query/asClass/types.gen.ts new file mode 100644 index 000000000..a48ba3ea4 --- /dev/null +++ b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/vue-query/asClass/types.gen.ts @@ -0,0 +1,1507 @@ +// This file is auto-generated by @hey-api/openapi-ts + +/** + * Model with number-only name + */ +export type _400 = string; + +/** + * Testing multiline comments in string: First line + * Second line + * + * Fourth line + */ +export type camelCaseCommentWithBreaks = number; + +/** + * Testing multiline comments in string: First line + * Second line + * + * Fourth line + */ +export type CommentWithBreaks = number; + +/** + * Testing backticks in string: `backticks` and ```multiple backticks``` should work + */ +export type CommentWithBackticks = number; + +/** + * Testing backticks and quotes in string: `backticks`, 'quotes', "double quotes" and ```multiple backticks``` should work + */ +export type CommentWithBackticksAndQuotes = number; + +/** + * Testing slashes in string: \backwards\\\ and /forwards/// should work + */ +export type CommentWithSlashes = number; + +/** + * Testing expression placeholders in string: ${expression} should work + */ +export type CommentWithExpressionPlaceholders = number; + +/** + * Testing quotes in string: 'single quote''' and "double quotes""" should work + */ +export type CommentWithQuotes = number; + +/** + * Testing reserved characters in string: * inline * and ** inline ** should work + */ +export type CommentWithReservedCharacters = number; + +/** + * This is a simple number + */ +export type SimpleInteger = number; + +/** + * This is a simple boolean + */ +export type SimpleBoolean = boolean; + +/** + * This is a simple string + */ +export type SimpleString = string; + +/** + * A string with non-ascii (unicode) characters valid in typescript identifiers (æøåÆØÅöÔèÈ字符串) + */ +export type NonAsciiStringæøåÆØÅöôêÊ字符串 = string; + +/** + * This is a simple file + */ +export type SimpleFile = (Blob | File); + +/** + * This is a simple reference + */ +export type SimpleReference = ModelWithString; + +/** + * This is a simple string + */ +export type SimpleStringWithPattern = (string) | null; + +/** + * This is a simple enum with strings + */ +export type EnumWithStrings = 'Success' | 'Warning' | 'Error' | "'Single Quote'" | '"Double Quotes"' | 'Non-ascii: øæåôöØÆÅÔÖ字符串'; + +export type EnumWithReplacedCharacters = "'Single Quote'" | '"Double Quotes"' | 'øæåôöØÆÅÔÖ字符串' | 3.1 | ''; + +/** + * This is a simple enum with numbers + */ +export type EnumWithNumbers = 1 | 2 | 3 | 1.1 | 1.2 | 1.3 | 100 | 200 | 300 | -100 | -200 | -300 | -1.1 | -1.2 | -1.3; + +/** + * Success=1,Warning=2,Error=3 + */ +export type EnumFromDescription = number; + +/** + * This is a simple enum with numbers + */ +export type EnumWithExtensions = 200 | 400 | 500; + +export type EnumWithXEnumNames = 0 | 1 | 2; + +/** + * This is a simple array with numbers + */ +export type ArrayWithNumbers = Array<(number)>; + +/** + * This is a simple array with booleans + */ +export type ArrayWithBooleans = Array<(boolean)>; + +/** + * This is a simple array with strings + */ +export type ArrayWithStrings = Array<(string)>; + +/** + * This is a simple array with references + */ +export type ArrayWithReferences = Array; + +/** + * This is a simple array containing an array + */ +export type ArrayWithArray = Array>; + +/** + * This is a simple array with properties + */ +export type ArrayWithProperties = Array<{ + '16x16'?: camelCaseCommentWithBreaks; + bar?: string; +}>; + +/** + * This is a simple array with any of properties + */ +export type ArrayWithAnyOfProperties = Array<({ + foo?: string; +} | { + bar?: string; +})>; + +export type AnyOfAnyAndNull = { + data?: (unknown | null); +}; + +/** + * This is a simple array with any of properties + */ +export type AnyOfArrays = { + results?: Array<({ + foo?: string; +} | { + bar?: string; +})>; +}; + +/** + * This is a string dictionary + */ +export type DictionaryWithString = { + [key: string]: (string); +}; + +export type DictionaryWithPropertiesAndAdditionalProperties = { + foo?: number; + bar?: boolean; + [key: string]: (string | number | boolean) | undefined; +}; + +/** + * This is a string reference + */ +export type DictionaryWithReference = { + [key: string]: ModelWithString; +}; + +/** + * This is a complex dictionary + */ +export type DictionaryWithArray = { + [key: string]: Array; +}; + +/** + * This is a string dictionary + */ +export type DictionaryWithDictionary = { + [key: string]: { + [key: string]: (string); + }; +}; + +/** + * This is a complex dictionary + */ +export type DictionaryWithProperties = { + [key: string]: { + foo?: string; + bar?: string; + }; +}; + +/** + * This is a model with one number property + */ +export type ModelWithInteger = { + /** + * This is a simple number property + */ + prop?: number; +}; + +/** + * This is a model with one boolean property + */ +export type ModelWithBoolean = { + /** + * This is a simple boolean property + */ + prop?: boolean; +}; + +/** + * This is a model with one string property + */ +export type ModelWithString = { + /** + * This is a simple string property + */ + prop?: string; +}; + +/** + * This is a model with one string property + */ +export type ModelWithStringError = { + /** + * This is a simple string property + */ + prop?: string; +}; + +/** + * `Comment` or `VoiceComment`. The JSON object for adding voice comments to tickets is different. See [Adding voice comments to tickets](/documentation/ticketing/managing-tickets/adding-voice-comments-to-tickets) + */ +export type Model_From_Zendesk = string; + +/** + * This is a model with one string property + */ +export type ModelWithNullableString = { + /** + * This is a simple string property + */ + nullableProp1?: (string) | null; + /** + * This is a simple string property + */ + nullableRequiredProp1: (string) | null; + /** + * This is a simple string property + */ + nullableProp2?: (string) | null; + /** + * This is a simple string property + */ + nullableRequiredProp2: (string) | null; + /** + * This is a simple enum with strings + */ + 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; +}; + +/** + * This is a simple enum with strings + */ +export type foo_bar_enum = 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; + +/** + * This is a model with one enum + */ +export type ModelWithEnum = { + /** + * This is a simple enum with strings + */ + 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; + /** + * These are the HTTP error code enums + */ + statusCode?: '100' | '200 FOO' | '300 FOO_BAR' | '400 foo-bar' | '500 foo.bar' | '600 foo&bar'; + /** + * Simple boolean enum + */ + bool?: boolean; +}; + +/** + * These are the HTTP error code enums + */ +export type statusCode = '100' | '200 FOO' | '300 FOO_BAR' | '400 foo-bar' | '500 foo.bar' | '600 foo&bar'; + +/** + * This is a model with one enum with escaped name + */ +export type ModelWithEnumWithHyphen = { + 'foo-bar-baz-qux'?: '3.0'; +}; + +export type foo_bar_baz_qux = '3.0'; + +/** + * This is a model with one enum + */ +export type ModelWithEnumFromDescription = { + /** + * Success=1,Warning=2,Error=3 + */ + test?: number; +}; + +/** + * This is a model with nested enums + */ +export type ModelWithNestedEnums = { + dictionaryWithEnum?: { + [key: string]: ('Success' | 'Warning' | 'Error'); + }; + dictionaryWithEnumFromDescription?: { + [key: string]: (number); + }; + arrayWithEnum?: Array<('Success' | 'Warning' | 'Error')>; + arrayWithDescription?: Array<(number)>; + /** + * This is a simple enum with strings + */ + 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; +}; + +/** + * This is a model with one property containing a reference + */ +export type ModelWithReference = { + prop?: ModelWithProperties; +}; + +/** + * This is a model with one property containing an array + */ +export type ModelWithArrayReadOnlyAndWriteOnly = { + prop?: Array; + propWithFile?: Array<((Blob | File))>; + propWithNumber?: Array<(number)>; +}; + +/** + * This is a model with one property containing an array + */ +export type ModelWithArray = { + prop?: Array; + propWithFile?: Array<((Blob | File))>; + propWithNumber?: Array<(number)>; +}; + +/** + * This is a model with one property containing a dictionary + */ +export type ModelWithDictionary = { + prop?: { + [key: string]: (string); + }; +}; + +/** + * This is a deprecated model with a deprecated property + * @deprecated + */ +export type DeprecatedModel = { + /** + * This is a deprecated property + * @deprecated + */ + prop?: string; +}; + +/** + * This is a model with one property containing a circular reference + */ +export type ModelWithCircularReference = { + prop?: ModelWithCircularReference; +}; + +/** + * This is a model with one property with a 'one of' relationship + */ +export type CompositionWithOneOf = { + propA?: (ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary); +}; + +/** + * This is a model with one property with a 'one of' relationship where the options are not $ref + */ +export type CompositionWithOneOfAnonymous = { + propA?: ({ + propA?: string; +} | string | number); +}; + +/** + * Circle + */ +export type ModelCircle = { + kind: 'circle'; + radius?: number; +}; + +/** + * Square + */ +export type ModelSquare = { + kind: 'square'; + sideLength?: number; +}; + +/** + * This is a model with one property with a 'one of' relationship where the options are not $ref + */ +export type CompositionWithOneOfDiscriminator = ModelCircle | ModelSquare; + +/** + * This is a model with one property with a 'any of' relationship + */ +export type CompositionWithAnyOf = { + propA?: (ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary); +}; + +/** + * This is a model with one property with a 'any of' relationship where the options are not $ref + */ +export type CompositionWithAnyOfAnonymous = { + propA?: ({ + propA?: string; +} | string | number); +}; + +/** + * This is a model with nested 'any of' property with a type null + */ +export type CompositionWithNestedAnyAndTypeNull = { + propA?: (Array<(ModelWithDictionary | null)> | Array<(ModelWithArray | null)>); +}; + +export type _3e_num_1Период = 'Bird' | 'Dog'; + +export type ConstValue = "ConstValue"; + +/** + * This is a model with one property with a 'any of' relationship where the options are not $ref + */ +export type CompositionWithNestedAnyOfAndNull = { + propA?: (Array<(_3e_num_1Период | ConstValue)> | null); +}; + +/** + * This is a model with one property with a 'one of' relationship + */ +export type CompositionWithOneOfAndNullable = { + propA?: (({ + boolean?: boolean; +} | ModelWithEnum | ModelWithArray | ModelWithDictionary) | null); +}; + +/** + * This is a model that contains a simple dictionary within composition + */ +export type CompositionWithOneOfAndSimpleDictionary = { + propA?: (boolean | { + [key: string]: (number); +}); +}; + +/** + * This is a model that contains a dictionary of simple arrays within composition + */ +export type CompositionWithOneOfAndSimpleArrayDictionary = { + propA?: (boolean | { + [key: string]: Array<(boolean)>; +}); +}; + +/** + * This is a model that contains a dictionary of complex arrays (composited) within composition + */ +export type CompositionWithOneOfAndComplexArrayDictionary = { + propA?: (boolean | { + [key: string]: Array<(number | string)>; +}); +}; + +/** + * This is a model with one property with a 'all of' relationship + */ +export type CompositionWithAllOfAndNullable = { + propA?: (({ + boolean?: boolean; +} & ModelWithEnum & ModelWithArray & ModelWithDictionary) | null); +}; + +/** + * This is a model with one property with a 'any of' relationship + */ +export type CompositionWithAnyOfAndNullable = { + propA?: (({ + boolean?: boolean; +} | ModelWithEnum | ModelWithArray | ModelWithDictionary) | null); +}; + +/** + * This is a base model with two simple optional properties + */ +export type CompositionBaseModel = { + firstName?: string; + lastname?: string; +}; + +/** + * This is a model that extends the base model + */ +export type CompositionExtendedModel = CompositionBaseModel & { + firstName: string; + lastname: string; + age: number; +}; + +/** + * This is a model with one nested property + */ +export type ModelWithProperties = { + required: string; + readonly requiredAndReadOnly: string; + requiredAndNullable: (string) | null; + string?: string; + number?: number; + boolean?: boolean; + reference?: ModelWithString; + 'property with space'?: string; + default?: string; + try?: string; + readonly '@namespace.string'?: string; + readonly '@namespace.integer'?: number; +}; + +/** + * This is a model with one nested property + */ +export type ModelWithNestedProperties = { + readonly first: { + readonly second: { + readonly third: (string) | null; + } | null; + } | null; +}; + +/** + * This is a model with duplicated properties + */ +export type ModelWithDuplicateProperties = { + prop?: ModelWithString; +}; + +/** + * This is a model with ordered properties + */ +export type ModelWithOrderedProperties = { + zebra?: string; + apple?: string; + hawaii?: string; +}; + +/** + * This is a model with duplicated imports + */ +export type ModelWithDuplicateImports = { + propA?: ModelWithString; + propB?: ModelWithString; + propC?: ModelWithString; +}; + +/** + * This is a model that extends another model + */ +export type ModelThatExtends = ModelWithString & { + propExtendsA?: string; + propExtendsB?: ModelWithString; +}; + +/** + * This is a model that extends another model + */ +export type ModelThatExtendsExtends = ModelWithString & ModelThatExtends & { + propExtendsC?: string; + propExtendsD?: ModelWithString; +}; + +/** + * This is a model that contains a some patterns + */ +export type ModelWithPattern = { + key: string; + name: string; + readonly enabled?: boolean; + readonly modified?: string; + id?: string; + text?: string; + patternWithSingleQuotes?: string; + patternWithNewline?: string; + patternWithBacktick?: string; +}; + +export type File = { + readonly id?: string; + readonly updated_at?: string; + readonly created_at?: string; + mime: string; + readonly file?: string; +}; + +export type _default = { + name?: string; +}; + +export type Pageable = { + page?: number; + size?: number; + sort?: Array<(string)>; +}; + +/** + * This is a free-form object without additionalProperties. + */ +export type FreeFormObjectWithoutAdditionalProperties = { + [key: string]: unknown; +}; + +/** + * This is a free-form object with additionalProperties: true. + */ +export type FreeFormObjectWithAdditionalPropertiesEqTrue = { + [key: string]: unknown; +}; + +/** + * This is a free-form object with additionalProperties: {}. + */ +export type FreeFormObjectWithAdditionalPropertiesEqEmptyObject = { + [key: string]: unknown; +}; + +export type ModelWithConst = { + String?: "String"; + number?: 0; + null?: null; + withType?: "Some string"; +}; + +/** + * This is a model with one property and additionalProperties: true + */ +export type ModelWithAdditionalPropertiesEqTrue = { + /** + * This is a simple string property + */ + prop?: string; + [key: string]: unknown | string; +}; + +export type NestedAnyOfArraysNullable = { + nullableArray?: (Array<(string | boolean)> | null); +}; + +export type CompositionWithOneOfAndProperties = ({ + foo: ParameterSimpleParameter; +} | { + bar: NonAsciiStringæøåÆØÅöôêÊ字符串; +}) & { + baz: (number) | null; + qux: number; +}; + +/** + * An object that can be null + */ +export type NullableObject = { + foo?: string; +} | null; + +/** + * Some % character + */ +export type CharactersInDescription = string; + +export type ModelWithNullableObject = { + data?: NullableObject; +}; + +export type ModelWithOneOfEnum = { + foo: 'Bar'; +} | { + foo: 'Baz'; +} | { + foo: 'Qux'; +} | { + content: string; + foo: 'Quux'; +} | { + content: [ + (string), + (string) + ]; + foo: 'Corge'; +}; + +export type foo = 'Bar'; + +export type ModelWithNestedArrayEnumsDataFoo = 'foo' | 'bar'; + +export type ModelWithNestedArrayEnumsDataBar = 'baz' | 'qux'; + +export type ModelWithNestedArrayEnumsData = { + foo?: Array; + bar?: Array; +}; + +export type ModelWithNestedArrayEnums = { + array_strings?: Array<(string)>; + data?: (ModelWithNestedArrayEnumsData); +}; + +export type ModelWithNestedCompositionEnums = { + foo?: (ModelWithNestedArrayEnumsDataFoo); +}; + +export type ModelWithReadOnlyAndWriteOnly = { + foo: string; + readonly bar: string; + baz: string; +}; + +export type ModelWithConstantSizeArray = [ + number, + number +]; + +export type ModelWithAnyOfConstantSizeArray = [ + (number | string), + (number | string), + (number | string) +]; + +export type ModelWithPrefixItemsConstantSizeArray = [ + ModelWithInteger, + (number | string), + string +]; + +export type ModelWithAnyOfConstantSizeArrayNullable = [ + ((number) | null | string), + ((number) | null | string), + ((number) | null | string) +]; + +export type ModelWithAnyOfConstantSizeArrayWithNSizeAndOptions = [ + (number | _import), + (number | _import) +]; + +export type ModelWithAnyOfConstantSizeArrayAndIntersect = [ + (number & string), + (number & string) +]; + +export type ModelWithNumericEnumUnion = { + /** + * Период + */ + value?: -10 | -1 | 0 | 1 | 3 | 6 | 12; +}; + +/** + * Период + */ +export type value = -10 | -1 | 0 | 1 | 3 | 6 | 12; + +/** + * Some description with `back ticks` + */ +export type ModelWithBackticksInDescription = { + /** + * The template `that` should be used for parsing and importing the contents of the CSV file. + * + *

There is one placeholder currently supported:

  • ${x} - refers to the n-th column in the CSV file, e.g. ${1}, ${2}, ...)

Example of a correct JSON template:

+ *
+     * [
+     * {
+     * "resourceType": "Asset",
+     * "identifier": {
+     * "name": "${1}",
+     * "domain": {
+     * "name": "${2}",
+     * "community": {
+     * "name": "Some Community"
+     * }
+     * }
+     * },
+     * "attributes" : {
+     * "00000000-0000-0000-0000-000000003115" : [ {
+     * "value" : "${3}"
+     * } ],
+     * "00000000-0000-0000-0000-000000000222" : [ {
+     * "value" : "${4}"
+     * } ]
+     * }
+     * }
+     * ]
+     * 
+ */ + template?: string; +}; + +export type ModelWithOneOfAndProperties = (ParameterSimpleParameter | NonAsciiStringæøåÆØÅöôêÊ字符串) & { + baz: (number) | null; + qux: number; +}; + +/** + * Model used to test deduplication strategy (unused) + */ +export type ParameterSimpleParameterUnused = string; + +/** + * Model used to test deduplication strategy + */ +export type PostServiceWithEmptyTagResponse = string; + +/** + * Model used to test deduplication strategy + */ +export type PostServiceWithEmptyTagResponse2 = string; + +/** + * Model used to test deduplication strategy + */ +export type DeleteFooData = string; + +/** + * Model used to test deduplication strategy + */ +export type DeleteFooData2 = string; + +/** + * Model with restricted keyword name + */ +export type _import = string; + +export type SchemaWithFormRestrictedKeys = { + description?: string; + 'x-enum-descriptions'?: string; + 'x-enum-varnames'?: string; + 'x-enumNames'?: string; + title?: string; + object?: { + description?: string; + 'x-enum-descriptions'?: string; + 'x-enum-varnames'?: string; + 'x-enumNames'?: string; + title?: string; + }; + array?: Array<({ + description?: string; + 'x-enum-descriptions'?: string; + 'x-enum-varnames'?: string; + 'x-enumNames'?: string; + title?: string; +})>; +}; + +/** + * This schema was giving PascalCase transformations a hard time + */ +export type io_k8s_apimachinery_pkg_apis_meta_v1_DeleteOptions = { + /** + * Must be fulfilled before a deletion is carried out. If not possible, a 409 Conflict status will be returned. + */ + preconditions?: (io_k8s_apimachinery_pkg_apis_meta_v1_Preconditions); +}; + +/** + * This schema was giving PascalCase transformations a hard time + */ +export type io_k8s_apimachinery_pkg_apis_meta_v1_Preconditions = { + /** + * Specifies the target ResourceVersion + */ + resourceVersion?: string; + /** + * Specifies the target UID. + */ + uid?: string; +}; + +export type AdditionalPropertiesUnknownIssue = { + [key: string]: (string | number); +}; + +export type AdditionalPropertiesUnknownIssue2 = { + [key: string]: (string | number); +}; + +export type AdditionalPropertiesUnknownIssue3 = string & { + entries: { + [key: string]: AdditionalPropertiesUnknownIssue; + }; +}; + +export type AdditionalPropertiesIntegerIssue = { + value: number; + [key: string]: (number) | undefined; +}; + +export type OneOfAllOfIssue = ((ConstValue | Generic_Schema_Duplicate_Issue_1_System_Boolean_) & _3e_num_1Период) | Generic_Schema_Duplicate_Issue_1_System_String_; + +export type Generic_Schema_Duplicate_Issue_1_System_Boolean_ = { + item?: boolean; + error?: (string) | null; + readonly hasError?: boolean; + data?: { + [key: string]: unknown; + }; +}; + +export type Generic_Schema_Duplicate_Issue_1_System_String_ = { + item?: (string) | null; + error?: (string) | null; + readonly hasError?: boolean; +}; + +/** + * This is a reusable parameter + */ +export type ParameterSimpleParameter = string; + +/** + * Parameter with illegal characters + */ +export type Parameterx_Foo_Bar = ModelWithString; + +export type ImportData = { + body: (ModelWithReadOnlyAndWriteOnly | ModelWithArrayReadOnlyAndWriteOnly); +}; + +export type ImportResponse = (Model_From_Zendesk | ModelWithReadOnlyAndWriteOnly); + +export type ImportError = unknown; + +export type GetApiVbyApiVersionSimpleOperationData = { + path: { + /** + * foo in method + */ + foo_param: string; + }; +}; + +export type GetApiVbyApiVersionSimpleOperationResponse = (number); + +export type GetApiVbyApiVersionSimpleOperationError = (ModelWithBoolean); + +export type ApiVversionOdataControllerCountResponse = (Model_From_Zendesk); + +export type ApiVversionOdataControllerCountError = unknown; + +export type DeleteFooData3 = { + headers: { + /** + * Parameter with illegal characters + */ + 'x-Foo-Bar': ModelWithString; + }; + path: { + /** + * bar in method + */ + BarParam: string; + /** + * foo in method + */ + foo_param: string; + }; +}; + +export type CallWithParametersData = { + /** + * This is the parameter that goes into the body + */ + body: { + [key: string]: unknown; + } | null; + headers: { + /** + * This is the parameter that goes into the header + */ + parameterHeader: (string) | null; + }; + path: { + /** + * api-version should be required in standalone clients + */ + 'api-version': (string) | null; + /** + * This is the parameter that goes into the path + */ + parameterPath: (string) | null; + }; + query: { + /** + * This is the parameter that goes into the query params + */ + cursor: (string) | null; + foo_all_of_enum: (ModelWithNestedArrayEnumsDataFoo); + foo_ref_enum?: ModelWithNestedArrayEnumsDataFoo; + }; +}; + +export type CallWithWeirdParameterNamesData = { + /** + * This is the parameter that goes into the body + */ + body: (ModelWithString) | null; + headers: { + /** + * This is the parameter that goes into the request header + */ + 'parameter.header': (string) | null; + }; + path: { + /** + * api-version should be required in standalone clients + */ + 'api-version': (string) | null; + /** + * This is the parameter that goes into the path + */ + 'parameter-path-2'?: string; + /** + * This is the parameter that goes into the path + */ + 'PARAMETER-PATH-3'?: string; + /** + * This is the parameter that goes into the path + */ + 'parameter.path.1'?: string; + }; + query: { + /** + * This is the parameter with a reserved keyword + */ + default?: string; + /** + * This is the parameter that goes into the request query params + */ + 'parameter-query': (string) | null; + }; +}; + +export type GetCallWithOptionalParamData = { + /** + * This is a required parameter + */ + body: ModelWithOneOfEnum; + query?: { + /** + * This is an optional parameter + */ + page?: number; + }; +}; + +export type PostCallWithOptionalParamData = { + /** + * This is an optional parameter + */ + body?: { + offset?: (number) | null; + }; + query: { + /** + * This is a required parameter + */ + parameter: Pageable; + }; +}; + +export type PostCallWithOptionalParamResponse = (number | void); + +export type PostCallWithOptionalParamError = unknown; + +export type CallWithDescriptionsData = { + query?: { + /** + * Testing backticks in string: `backticks` and ```multiple backticks``` should work + */ + parameterWithBackticks?: unknown; + /** + * Testing multiline comments in string: First line + * Second line + * + * Fourth line + */ + parameterWithBreaks?: unknown; + /** + * Testing expression placeholders in string: ${expression} should work + */ + parameterWithExpressionPlaceholders?: unknown; + /** + * Testing quotes in string: 'single quote''' and "double quotes""" should work + */ + parameterWithQuotes?: unknown; + /** + * Testing reserved characters in string: * inline * and ** inline ** should work + */ + parameterWithReservedCharacters?: unknown; + /** + * Testing slashes in string: \backwards\\\ and /forwards/// should work + */ + parameterWithSlashes?: unknown; + }; +}; + +export type DeprecatedCallData = { + headers: { + /** + * This parameter is deprecated + * @deprecated + */ + parameter: (DeprecatedModel) | null; + }; +}; + +export type PostApiVbyApiVersionRequestBodyData = { + /** + * A reusable request body + */ + body?: ModelWithString; + query?: { + /** + * This is a reusable parameter + */ + parameter?: string; + }; +}; + +export type PostApiVbyApiVersionFormDataData = { + /** + * A reusable request body + */ + body?: ModelWithString; + query?: { + /** + * This is a reusable parameter + */ + parameter?: string; + }; +}; + +export type CallWithDefaultParametersData = { + query?: { + /** + * This is a simple boolean with default value + */ + parameterBoolean?: (boolean) | null; + /** + * This is a simple enum with default value + */ + parameterEnum?: 'Success' | 'Warning' | 'Error'; + /** + * This is a simple model with default value + */ + parameterModel?: (ModelWithString) | null; + /** + * This is a simple number with default value + */ + parameterNumber?: (number) | null; + /** + * This is a simple string with default value + */ + parameterString?: (string) | null; + }; +}; + +export type CallWithDefaultOptionalParametersData = { + query?: { + /** + * This is a simple boolean that is optional with default value + */ + parameterBoolean?: boolean; + /** + * This is a simple enum that is optional with default value + */ + parameterEnum?: 'Success' | 'Warning' | 'Error'; + /** + * This is a simple model that is optional with default value + */ + parameterModel?: ModelWithString; + /** + * This is a simple number that is optional with default value + */ + parameterNumber?: number; + /** + * This is a simple string that is optional with default value + */ + parameterString?: string; + }; +}; + +export type CallToTestOrderOfParamsData = { + query: { + /** + * This is a optional string with default + */ + parameterOptionalStringWithDefault?: string; + /** + * This is a optional string with empty default + */ + parameterOptionalStringWithEmptyDefault?: string; + /** + * This is a optional string with no default + */ + parameterOptionalStringWithNoDefault?: string; + /** + * This is a string that can be null with default + */ + parameterStringNullableWithDefault?: (string) | null; + /** + * This is a string that can be null with no default + */ + parameterStringNullableWithNoDefault?: (string) | null; + /** + * This is a string with default + */ + parameterStringWithDefault: string; + /** + * This is a string with empty default + */ + parameterStringWithEmptyDefault: string; + /** + * This is a string with no default + */ + parameterStringWithNoDefault: string; + }; +}; + +export type CallWithNoContentResponseResponse = (void); + +export type CallWithNoContentResponseError = unknown; + +export type CallWithResponseAndNoContentResponseResponse = (number | void); + +export type CallWithResponseAndNoContentResponseError = unknown; + +export type CallWithResponseResponse = (_import); + +export type CallWithResponseError = unknown; + +export type CallWithDuplicateResponsesResponse = ((ModelWithBoolean & ModelWithInteger) | ModelWithString); + +export type CallWithDuplicateResponsesError = (ModelWithStringError | DictionaryWithArray | ModelWithBoolean); + +export type CallWithResponsesResponse = ({ + readonly '@namespace.string'?: string; + readonly '@namespace.integer'?: number; + readonly value?: Array; +} | ModelThatExtends | ModelThatExtendsExtends); + +export type CallWithResponsesError = (ModelWithStringError); + +export type DummyAResponse = (_400); + +export type DummyAError = unknown; + +export type DummyBResponse = (void); + +export type DummyBError = unknown; + +export type CollectionFormatData = { + query: { + /** + * This is an array parameter that is sent as csv format (comma-separated values) + */ + parameterArrayCSV: Array<(string)> | null; + /** + * This is an array parameter that is sent as multi format (multiple parameter instances) + */ + parameterArrayMulti: Array<(string)> | null; + /** + * This is an array parameter that is sent as pipes format (pipe-separated values) + */ + parameterArrayPipes: Array<(string)> | null; + /** + * This is an array parameter that is sent as ssv format (space-separated values) + */ + parameterArraySSV: Array<(string)> | null; + /** + * This is an array parameter that is sent as tsv format (tab-separated values) + */ + parameterArrayTSV: Array<(string)> | null; + }; +}; + +export type TypesData = { + path?: { + /** + * This is a number parameter + */ + id?: number; + }; + query: { + /** + * This is an array parameter + */ + parameterArray: Array<(string)> | null; + /** + * This is a boolean parameter + */ + parameterBoolean: (boolean) | null; + /** + * This is a dictionary parameter + */ + parameterDictionary: { + [key: string]: unknown; + } | null; + /** + * This is an enum parameter + */ + parameterEnum: ('Success' | 'Warning' | 'Error') | null; + /** + * This is a number parameter + */ + parameterNumber: number; + /** + * This is an object parameter + */ + parameterObject: { + [key: string]: unknown; + } | null; + /** + * This is a string parameter + */ + parameterString: (string) | null; + }; +}; + +export type TypesResponse = (number | string | boolean | { + [key: string]: unknown; +}); + +export type TypesError = unknown; + +export type UploadFileData = { + body: (Blob | File); + path: { + /** + * api-version should be required in standalone clients + */ + 'api-version': (string) | null; + }; +}; + +export type UploadFileResponse = (boolean); + +export type UploadFileError = unknown; + +export type FileResponseData = { + path: { + /** + * api-version should be required in standalone clients + */ + 'api-version': string; + id: string; + }; +}; + +export type FileResponseResponse = ((Blob | File)); + +export type FileResponseError = unknown; + +export type ComplexTypesData = { + query: { + /** + * Parameter containing object + */ + parameterObject: { + first?: { + second?: { + third?: string; + }; + }; + }; + /** + * Parameter containing reference + */ + parameterReference: ModelWithString; + }; +}; + +export type ComplexTypesResponse = (Array); + +export type ComplexTypesError = (unknown); + +export type ComplexParamsData = { + body?: { + readonly key: (string) | null; + name: (string) | null; + enabled?: boolean; + readonly type: 'Monkey' | 'Horse' | 'Bird'; + listOfModels?: Array | null; + listOfStrings?: Array<(string)> | null; + parameters: (ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary); + readonly user?: { + readonly id?: number; + readonly name?: (string) | null; + }; + }; + path: { + /** + * api-version should be required in standalone clients + */ + 'api-version': string; + id: number; + }; +}; + +export type ComplexParamsResponse = (ModelWithString); + +export type ComplexParamsError = unknown; + +export type MultipartRequestData = { + body?: { + content?: (Blob | File); + data?: ((ModelWithString) | null); + }; +}; + +export type MultipartResponseResponse = ({ + file?: (Blob | File); + metadata?: { + foo?: string; + bar?: string; + }; +}); + +export type MultipartResponseError = unknown; + +export type CallWithResultFromHeaderResponse = (string); + +export type CallWithResultFromHeaderError = (unknown); + +export type TestErrorCodeData = { + query: { + /** + * Status code to return + */ + status: number; + }; +}; + +export type TestErrorCodeResponse = (unknown); + +export type TestErrorCodeError = (unknown); + +export type NonAsciiæøåÆøÅöôêÊ字符串Data = { + query: { + /** + * Dummy input param + */ + nonAsciiParamæøåÆØÅöôêÊ: number; + }; +}; + +export type NonAsciiæøåÆøÅöôêÊ字符串Response = (Array); + +export type NonAsciiæøåÆøÅöôêÊ字符串Error = unknown; + +export type PutWithFormUrlEncodedData = { + body: ArrayWithStrings; +}; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-vue-query/@tanstack/vue-query.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/vue-query/axios/@tanstack/vue-query.gen.ts similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-vue-query/@tanstack/vue-query.gen.ts.snap rename to packages/openapi-ts/test/__snapshots__/plugins/@tanstack/vue-query/axios/@tanstack/vue-query.gen.ts diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-solid-query/index.ts.snap b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/vue-query/axios/index.ts similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-solid-query/index.ts.snap rename to packages/openapi-ts/test/__snapshots__/plugins/@tanstack/vue-query/axios/index.ts diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-vue-query/services.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/vue-query/axios/services.gen.ts similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-vue-query/services.gen.ts.snap rename to packages/openapi-ts/test/__snapshots__/plugins/@tanstack/vue-query/axios/services.gen.ts diff --git a/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/vue-query/axios/types.gen.ts b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/vue-query/axios/types.gen.ts new file mode 100644 index 000000000..1989b3f22 --- /dev/null +++ b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/vue-query/axios/types.gen.ts @@ -0,0 +1,1507 @@ +// This file is auto-generated by @hey-api/openapi-ts + +/** + * Model with number-only name + */ +export type _400 = string; + +/** + * Testing multiline comments in string: First line + * Second line + * + * Fourth line + */ +export type camelCaseCommentWithBreaks = number; + +/** + * Testing multiline comments in string: First line + * Second line + * + * Fourth line + */ +export type CommentWithBreaks = number; + +/** + * Testing backticks in string: `backticks` and ```multiple backticks``` should work + */ +export type CommentWithBackticks = number; + +/** + * Testing backticks and quotes in string: `backticks`, 'quotes', "double quotes" and ```multiple backticks``` should work + */ +export type CommentWithBackticksAndQuotes = number; + +/** + * Testing slashes in string: \backwards\\\ and /forwards/// should work + */ +export type CommentWithSlashes = number; + +/** + * Testing expression placeholders in string: ${expression} should work + */ +export type CommentWithExpressionPlaceholders = number; + +/** + * Testing quotes in string: 'single quote''' and "double quotes""" should work + */ +export type CommentWithQuotes = number; + +/** + * Testing reserved characters in string: * inline * and ** inline ** should work + */ +export type CommentWithReservedCharacters = number; + +/** + * This is a simple number + */ +export type SimpleInteger = number; + +/** + * This is a simple boolean + */ +export type SimpleBoolean = boolean; + +/** + * This is a simple string + */ +export type SimpleString = string; + +/** + * A string with non-ascii (unicode) characters valid in typescript identifiers (æøåÆØÅöÔèÈ字符串) + */ +export type NonAsciiStringæøåÆØÅöôêÊ字符串 = string; + +/** + * This is a simple file + */ +export type SimpleFile = (Blob | File); + +/** + * This is a simple reference + */ +export type SimpleReference = ModelWithString; + +/** + * This is a simple string + */ +export type SimpleStringWithPattern = (string) | null; + +/** + * This is a simple enum with strings + */ +export type EnumWithStrings = 'Success' | 'Warning' | 'Error' | "'Single Quote'" | '"Double Quotes"' | 'Non-ascii: øæåôöØÆÅÔÖ字符串'; + +export type EnumWithReplacedCharacters = "'Single Quote'" | '"Double Quotes"' | 'øæåôöØÆÅÔÖ字符串' | 3.1 | ''; + +/** + * This is a simple enum with numbers + */ +export type EnumWithNumbers = 1 | 2 | 3 | 1.1 | 1.2 | 1.3 | 100 | 200 | 300 | -100 | -200 | -300 | -1.1 | -1.2 | -1.3; + +/** + * Success=1,Warning=2,Error=3 + */ +export type EnumFromDescription = number; + +/** + * This is a simple enum with numbers + */ +export type EnumWithExtensions = 200 | 400 | 500; + +export type EnumWithXEnumNames = 0 | 1 | 2; + +/** + * This is a simple array with numbers + */ +export type ArrayWithNumbers = Array<(number)>; + +/** + * This is a simple array with booleans + */ +export type ArrayWithBooleans = Array<(boolean)>; + +/** + * This is a simple array with strings + */ +export type ArrayWithStrings = Array<(string)>; + +/** + * This is a simple array with references + */ +export type ArrayWithReferences = Array; + +/** + * This is a simple array containing an array + */ +export type ArrayWithArray = Array>; + +/** + * This is a simple array with properties + */ +export type ArrayWithProperties = Array<{ + '16x16'?: camelCaseCommentWithBreaks; + bar?: string; +}>; + +/** + * This is a simple array with any of properties + */ +export type ArrayWithAnyOfProperties = Array<({ + foo?: string; +} | { + bar?: string; +})>; + +export type AnyOfAnyAndNull = { + data?: (unknown | null); +}; + +/** + * This is a simple array with any of properties + */ +export type AnyOfArrays = { + results?: Array<({ + foo?: string; +} | { + bar?: string; +})>; +}; + +/** + * This is a string dictionary + */ +export type DictionaryWithString = { + [key: string]: (string); +}; + +export type DictionaryWithPropertiesAndAdditionalProperties = { + foo?: number; + bar?: boolean; + [key: string]: (string | number | boolean) | undefined; +}; + +/** + * This is a string reference + */ +export type DictionaryWithReference = { + [key: string]: ModelWithString; +}; + +/** + * This is a complex dictionary + */ +export type DictionaryWithArray = { + [key: string]: Array; +}; + +/** + * This is a string dictionary + */ +export type DictionaryWithDictionary = { + [key: string]: { + [key: string]: (string); + }; +}; + +/** + * This is a complex dictionary + */ +export type DictionaryWithProperties = { + [key: string]: { + foo?: string; + bar?: string; + }; +}; + +/** + * This is a model with one number property + */ +export type ModelWithInteger = { + /** + * This is a simple number property + */ + prop?: number; +}; + +/** + * This is a model with one boolean property + */ +export type ModelWithBoolean = { + /** + * This is a simple boolean property + */ + prop?: boolean; +}; + +/** + * This is a model with one string property + */ +export type ModelWithString = { + /** + * This is a simple string property + */ + prop?: string; +}; + +/** + * This is a model with one string property + */ +export type ModelWithStringError = { + /** + * This is a simple string property + */ + prop?: string; +}; + +/** + * `Comment` or `VoiceComment`. The JSON object for adding voice comments to tickets is different. See [Adding voice comments to tickets](/documentation/ticketing/managing-tickets/adding-voice-comments-to-tickets) + */ +export type Model_From_Zendesk = string; + +/** + * This is a model with one string property + */ +export type ModelWithNullableString = { + /** + * This is a simple string property + */ + nullableProp1?: (string) | null; + /** + * This is a simple string property + */ + nullableRequiredProp1: (string) | null; + /** + * This is a simple string property + */ + nullableProp2?: (string) | null; + /** + * This is a simple string property + */ + nullableRequiredProp2: (string) | null; + /** + * This is a simple enum with strings + */ + 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; +}; + +/** + * This is a simple enum with strings + */ +export type foo_bar_enum = 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; + +/** + * This is a model with one enum + */ +export type ModelWithEnum = { + /** + * This is a simple enum with strings + */ + 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; + /** + * These are the HTTP error code enums + */ + statusCode?: '100' | '200 FOO' | '300 FOO_BAR' | '400 foo-bar' | '500 foo.bar' | '600 foo&bar'; + /** + * Simple boolean enum + */ + bool?: boolean; +}; + +/** + * These are the HTTP error code enums + */ +export type statusCode = '100' | '200 FOO' | '300 FOO_BAR' | '400 foo-bar' | '500 foo.bar' | '600 foo&bar'; + +/** + * This is a model with one enum with escaped name + */ +export type ModelWithEnumWithHyphen = { + 'foo-bar-baz-qux'?: '3.0'; +}; + +export type foo_bar_baz_qux = '3.0'; + +/** + * This is a model with one enum + */ +export type ModelWithEnumFromDescription = { + /** + * Success=1,Warning=2,Error=3 + */ + test?: number; +}; + +/** + * This is a model with nested enums + */ +export type ModelWithNestedEnums = { + dictionaryWithEnum?: { + [key: string]: ('Success' | 'Warning' | 'Error'); + }; + dictionaryWithEnumFromDescription?: { + [key: string]: (number); + }; + arrayWithEnum?: Array<('Success' | 'Warning' | 'Error')>; + arrayWithDescription?: Array<(number)>; + /** + * This is a simple enum with strings + */ + 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; +}; + +/** + * This is a model with one property containing a reference + */ +export type ModelWithReference = { + prop?: ModelWithProperties; +}; + +/** + * This is a model with one property containing an array + */ +export type ModelWithArrayReadOnlyAndWriteOnly = { + prop?: Array; + propWithFile?: Array<((Blob | File))>; + propWithNumber?: Array<(number)>; +}; + +/** + * This is a model with one property containing an array + */ +export type ModelWithArray = { + prop?: Array; + propWithFile?: Array<((Blob | File))>; + propWithNumber?: Array<(number)>; +}; + +/** + * This is a model with one property containing a dictionary + */ +export type ModelWithDictionary = { + prop?: { + [key: string]: (string); + }; +}; + +/** + * This is a deprecated model with a deprecated property + * @deprecated + */ +export type DeprecatedModel = { + /** + * This is a deprecated property + * @deprecated + */ + prop?: string; +}; + +/** + * This is a model with one property containing a circular reference + */ +export type ModelWithCircularReference = { + prop?: ModelWithCircularReference; +}; + +/** + * This is a model with one property with a 'one of' relationship + */ +export type CompositionWithOneOf = { + propA?: (ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary); +}; + +/** + * This is a model with one property with a 'one of' relationship where the options are not $ref + */ +export type CompositionWithOneOfAnonymous = { + propA?: ({ + propA?: string; +} | string | number); +}; + +/** + * Circle + */ +export type ModelCircle = { + kind: 'circle'; + radius?: number; +}; + +/** + * Square + */ +export type ModelSquare = { + kind: 'square'; + sideLength?: number; +}; + +/** + * This is a model with one property with a 'one of' relationship where the options are not $ref + */ +export type CompositionWithOneOfDiscriminator = ModelCircle | ModelSquare; + +/** + * This is a model with one property with a 'any of' relationship + */ +export type CompositionWithAnyOf = { + propA?: (ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary); +}; + +/** + * This is a model with one property with a 'any of' relationship where the options are not $ref + */ +export type CompositionWithAnyOfAnonymous = { + propA?: ({ + propA?: string; +} | string | number); +}; + +/** + * This is a model with nested 'any of' property with a type null + */ +export type CompositionWithNestedAnyAndTypeNull = { + propA?: (Array<(ModelWithDictionary | null)> | Array<(ModelWithArray | null)>); +}; + +export type _3e_num_1Период = 'Bird' | 'Dog'; + +export type ConstValue = "ConstValue"; + +/** + * This is a model with one property with a 'any of' relationship where the options are not $ref + */ +export type CompositionWithNestedAnyOfAndNull = { + propA?: (Array<(_3e_num_1Период | ConstValue)> | null); +}; + +/** + * This is a model with one property with a 'one of' relationship + */ +export type CompositionWithOneOfAndNullable = { + propA?: (({ + boolean?: boolean; +} | ModelWithEnum | ModelWithArray | ModelWithDictionary) | null); +}; + +/** + * This is a model that contains a simple dictionary within composition + */ +export type CompositionWithOneOfAndSimpleDictionary = { + propA?: (boolean | { + [key: string]: (number); +}); +}; + +/** + * This is a model that contains a dictionary of simple arrays within composition + */ +export type CompositionWithOneOfAndSimpleArrayDictionary = { + propA?: (boolean | { + [key: string]: Array<(boolean)>; +}); +}; + +/** + * This is a model that contains a dictionary of complex arrays (composited) within composition + */ +export type CompositionWithOneOfAndComplexArrayDictionary = { + propA?: (boolean | { + [key: string]: Array<(number | string)>; +}); +}; + +/** + * This is a model with one property with a 'all of' relationship + */ +export type CompositionWithAllOfAndNullable = { + propA?: (({ + boolean?: boolean; +} & ModelWithEnum & ModelWithArray & ModelWithDictionary) | null); +}; + +/** + * This is a model with one property with a 'any of' relationship + */ +export type CompositionWithAnyOfAndNullable = { + propA?: (({ + boolean?: boolean; +} | ModelWithEnum | ModelWithArray | ModelWithDictionary) | null); +}; + +/** + * This is a base model with two simple optional properties + */ +export type CompositionBaseModel = { + firstName?: string; + lastname?: string; +}; + +/** + * This is a model that extends the base model + */ +export type CompositionExtendedModel = CompositionBaseModel & { + firstName: string; + lastname: string; + age: number; +}; + +/** + * This is a model with one nested property + */ +export type ModelWithProperties = { + required: string; + readonly requiredAndReadOnly: string; + requiredAndNullable: (string) | null; + string?: string; + number?: number; + boolean?: boolean; + reference?: ModelWithString; + 'property with space'?: string; + default?: string; + try?: string; + readonly '@namespace.string'?: string; + readonly '@namespace.integer'?: number; +}; + +/** + * This is a model with one nested property + */ +export type ModelWithNestedProperties = { + readonly first: { + readonly second: { + readonly third: (string) | null; + } | null; + } | null; +}; + +/** + * This is a model with duplicated properties + */ +export type ModelWithDuplicateProperties = { + prop?: ModelWithString; +}; + +/** + * This is a model with ordered properties + */ +export type ModelWithOrderedProperties = { + zebra?: string; + apple?: string; + hawaii?: string; +}; + +/** + * This is a model with duplicated imports + */ +export type ModelWithDuplicateImports = { + propA?: ModelWithString; + propB?: ModelWithString; + propC?: ModelWithString; +}; + +/** + * This is a model that extends another model + */ +export type ModelThatExtends = ModelWithString & { + propExtendsA?: string; + propExtendsB?: ModelWithString; +}; + +/** + * This is a model that extends another model + */ +export type ModelThatExtendsExtends = ModelWithString & ModelThatExtends & { + propExtendsC?: string; + propExtendsD?: ModelWithString; +}; + +/** + * This is a model that contains a some patterns + */ +export type ModelWithPattern = { + key: string; + name: string; + readonly enabled?: boolean; + readonly modified?: string; + id?: string; + text?: string; + patternWithSingleQuotes?: string; + patternWithNewline?: string; + patternWithBacktick?: string; +}; + +export type File = { + readonly id?: string; + readonly updated_at?: string; + readonly created_at?: string; + mime: string; + readonly file?: string; +}; + +export type _default = { + name?: string; +}; + +export type Pageable = { + page?: number; + size?: number; + sort?: Array<(string)>; +}; + +/** + * This is a free-form object without additionalProperties. + */ +export type FreeFormObjectWithoutAdditionalProperties = { + [key: string]: unknown; +}; + +/** + * This is a free-form object with additionalProperties: true. + */ +export type FreeFormObjectWithAdditionalPropertiesEqTrue = { + [key: string]: unknown; +}; + +/** + * This is a free-form object with additionalProperties: {}. + */ +export type FreeFormObjectWithAdditionalPropertiesEqEmptyObject = { + [key: string]: unknown; +}; + +export type ModelWithConst = { + String?: "String"; + number?: 0; + null?: null; + withType?: "Some string"; +}; + +/** + * This is a model with one property and additionalProperties: true + */ +export type ModelWithAdditionalPropertiesEqTrue = { + /** + * This is a simple string property + */ + prop?: string; + [key: string]: unknown | string; +}; + +export type NestedAnyOfArraysNullable = { + nullableArray?: (Array<(string | boolean)> | null); +}; + +export type CompositionWithOneOfAndProperties = ({ + foo: ParameterSimpleParameter; +} | { + bar: NonAsciiStringæøåÆØÅöôêÊ字符串; +}) & { + baz: (number) | null; + qux: number; +}; + +/** + * An object that can be null + */ +export type NullableObject = { + foo?: string; +} | null; + +/** + * Some % character + */ +export type CharactersInDescription = string; + +export type ModelWithNullableObject = { + data?: NullableObject; +}; + +export type ModelWithOneOfEnum = { + foo: 'Bar'; +} | { + foo: 'Baz'; +} | { + foo: 'Qux'; +} | { + content: string; + foo: 'Quux'; +} | { + content: [ + (string), + (string) + ]; + foo: 'Corge'; +}; + +export type foo = 'Bar'; + +export type ModelWithNestedArrayEnumsDataFoo = 'foo' | 'bar'; + +export type ModelWithNestedArrayEnumsDataBar = 'baz' | 'qux'; + +export type ModelWithNestedArrayEnumsData = { + foo?: Array; + bar?: Array; +}; + +export type ModelWithNestedArrayEnums = { + array_strings?: Array<(string)>; + data?: (ModelWithNestedArrayEnumsData); +}; + +export type ModelWithNestedCompositionEnums = { + foo?: (ModelWithNestedArrayEnumsDataFoo); +}; + +export type ModelWithReadOnlyAndWriteOnly = { + foo: string; + readonly bar: string; + baz: string; +}; + +export type ModelWithConstantSizeArray = [ + number, + number +]; + +export type ModelWithAnyOfConstantSizeArray = [ + (number | string), + (number | string), + (number | string) +]; + +export type ModelWithPrefixItemsConstantSizeArray = [ + ModelWithInteger, + (number | string), + string +]; + +export type ModelWithAnyOfConstantSizeArrayNullable = [ + ((number) | null | string), + ((number) | null | string), + ((number) | null | string) +]; + +export type ModelWithAnyOfConstantSizeArrayWithNSizeAndOptions = [ + (number | _import), + (number | _import) +]; + +export type ModelWithAnyOfConstantSizeArrayAndIntersect = [ + (number & string), + (number & string) +]; + +export type ModelWithNumericEnumUnion = { + /** + * Период + */ + value?: -10 | -1 | 0 | 1 | 3 | 6 | 12; +}; + +/** + * Период + */ +export type value = -10 | -1 | 0 | 1 | 3 | 6 | 12; + +/** + * Some description with `back ticks` + */ +export type ModelWithBackticksInDescription = { + /** + * The template `that` should be used for parsing and importing the contents of the CSV file. + * + *

There is one placeholder currently supported:

  • ${x} - refers to the n-th column in the CSV file, e.g. ${1}, ${2}, ...)

Example of a correct JSON template:

+ *
+     * [
+     * {
+     * "resourceType": "Asset",
+     * "identifier": {
+     * "name": "${1}",
+     * "domain": {
+     * "name": "${2}",
+     * "community": {
+     * "name": "Some Community"
+     * }
+     * }
+     * },
+     * "attributes" : {
+     * "00000000-0000-0000-0000-000000003115" : [ {
+     * "value" : "${3}"
+     * } ],
+     * "00000000-0000-0000-0000-000000000222" : [ {
+     * "value" : "${4}"
+     * } ]
+     * }
+     * }
+     * ]
+     * 
+ */ + template?: string; +}; + +export type ModelWithOneOfAndProperties = (ParameterSimpleParameter | NonAsciiStringæøåÆØÅöôêÊ字符串) & { + baz: (number) | null; + qux: number; +}; + +/** + * Model used to test deduplication strategy (unused) + */ +export type ParameterSimpleParameterUnused = string; + +/** + * Model used to test deduplication strategy + */ +export type PostServiceWithEmptyTagResponse = string; + +/** + * Model used to test deduplication strategy + */ +export type PostServiceWithEmptyTagResponse2 = string; + +/** + * Model used to test deduplication strategy + */ +export type DeleteFooData = string; + +/** + * Model used to test deduplication strategy + */ +export type DeleteFooData2 = string; + +/** + * Model with restricted keyword name + */ +export type _import = string; + +export type SchemaWithFormRestrictedKeys = { + description?: string; + 'x-enum-descriptions'?: string; + 'x-enum-varnames'?: string; + 'x-enumNames'?: string; + title?: string; + object?: { + description?: string; + 'x-enum-descriptions'?: string; + 'x-enum-varnames'?: string; + 'x-enumNames'?: string; + title?: string; + }; + array?: Array<({ + description?: string; + 'x-enum-descriptions'?: string; + 'x-enum-varnames'?: string; + 'x-enumNames'?: string; + title?: string; +})>; +}; + +/** + * This schema was giving PascalCase transformations a hard time + */ +export type io_k8s_apimachinery_pkg_apis_meta_v1_DeleteOptions = { + /** + * Must be fulfilled before a deletion is carried out. If not possible, a 409 Conflict status will be returned. + */ + preconditions?: (io_k8s_apimachinery_pkg_apis_meta_v1_Preconditions); +}; + +/** + * This schema was giving PascalCase transformations a hard time + */ +export type io_k8s_apimachinery_pkg_apis_meta_v1_Preconditions = { + /** + * Specifies the target ResourceVersion + */ + resourceVersion?: string; + /** + * Specifies the target UID. + */ + uid?: string; +}; + +export type AdditionalPropertiesUnknownIssue = { + [key: string]: (string | number); +}; + +export type AdditionalPropertiesUnknownIssue2 = { + [key: string]: (string | number); +}; + +export type AdditionalPropertiesUnknownIssue3 = string & { + entries: { + [key: string]: AdditionalPropertiesUnknownIssue; + }; +}; + +export type AdditionalPropertiesIntegerIssue = { + value: number; + [key: string]: (number) | undefined; +}; + +export type OneOfAllOfIssue = ((ConstValue | Generic_Schema_Duplicate_Issue_1_System_Boolean_) & _3e_num_1Период) | Generic_Schema_Duplicate_Issue_1_System_String_; + +export type Generic_Schema_Duplicate_Issue_1_System_Boolean_ = { + item?: boolean; + error?: (string) | null; + readonly hasError?: boolean; + data?: { + [key: string]: unknown; + }; +}; + +export type Generic_Schema_Duplicate_Issue_1_System_String_ = { + item?: (string) | null; + error?: (string) | null; + readonly hasError?: boolean; +}; + +/** + * This is a reusable parameter + */ +export type ParameterSimpleParameter = string; + +/** + * Parameter with illegal characters + */ +export type Parameterx_Foo_Bar = ModelWithString; + +export type ImportData = { + body: (ModelWithReadOnlyAndWriteOnly | ModelWithArrayReadOnlyAndWriteOnly); +}; + +export type ImportResponse = (Model_From_Zendesk | ModelWithReadOnlyAndWriteOnly); + +export type ImportError = unknown; + +export type ApiVversionOdataControllerCountResponse = (Model_From_Zendesk); + +export type ApiVversionOdataControllerCountError = unknown; + +export type GetApiVbyApiVersionSimpleOperationData = { + path: { + /** + * foo in method + */ + foo_param: string; + }; +}; + +export type GetApiVbyApiVersionSimpleOperationResponse = (number); + +export type GetApiVbyApiVersionSimpleOperationError = (ModelWithBoolean); + +export type DeleteFooData3 = { + headers: { + /** + * Parameter with illegal characters + */ + 'x-Foo-Bar': ModelWithString; + }; + path: { + /** + * bar in method + */ + BarParam: string; + /** + * foo in method + */ + foo_param: string; + }; +}; + +export type CallWithDescriptionsData = { + query?: { + /** + * Testing backticks in string: `backticks` and ```multiple backticks``` should work + */ + parameterWithBackticks?: unknown; + /** + * Testing multiline comments in string: First line + * Second line + * + * Fourth line + */ + parameterWithBreaks?: unknown; + /** + * Testing expression placeholders in string: ${expression} should work + */ + parameterWithExpressionPlaceholders?: unknown; + /** + * Testing quotes in string: 'single quote''' and "double quotes""" should work + */ + parameterWithQuotes?: unknown; + /** + * Testing reserved characters in string: * inline * and ** inline ** should work + */ + parameterWithReservedCharacters?: unknown; + /** + * Testing slashes in string: \backwards\\\ and /forwards/// should work + */ + parameterWithSlashes?: unknown; + }; +}; + +export type DeprecatedCallData = { + headers: { + /** + * This parameter is deprecated + * @deprecated + */ + parameter: (DeprecatedModel) | null; + }; +}; + +export type CallWithParametersData = { + /** + * This is the parameter that goes into the body + */ + body: { + [key: string]: unknown; + } | null; + headers: { + /** + * This is the parameter that goes into the header + */ + parameterHeader: (string) | null; + }; + path: { + /** + * api-version should be required in standalone clients + */ + 'api-version': (string) | null; + /** + * This is the parameter that goes into the path + */ + parameterPath: (string) | null; + }; + query: { + /** + * This is the parameter that goes into the query params + */ + cursor: (string) | null; + foo_all_of_enum: (ModelWithNestedArrayEnumsDataFoo); + foo_ref_enum?: ModelWithNestedArrayEnumsDataFoo; + }; +}; + +export type CallWithWeirdParameterNamesData = { + /** + * This is the parameter that goes into the body + */ + body: (ModelWithString) | null; + headers: { + /** + * This is the parameter that goes into the request header + */ + 'parameter.header': (string) | null; + }; + path: { + /** + * api-version should be required in standalone clients + */ + 'api-version': (string) | null; + /** + * This is the parameter that goes into the path + */ + 'parameter-path-2'?: string; + /** + * This is the parameter that goes into the path + */ + 'PARAMETER-PATH-3'?: string; + /** + * This is the parameter that goes into the path + */ + 'parameter.path.1'?: string; + }; + query: { + /** + * This is the parameter with a reserved keyword + */ + default?: string; + /** + * This is the parameter that goes into the request query params + */ + 'parameter-query': (string) | null; + }; +}; + +export type GetCallWithOptionalParamData = { + /** + * This is a required parameter + */ + body: ModelWithOneOfEnum; + query?: { + /** + * This is an optional parameter + */ + page?: number; + }; +}; + +export type PostCallWithOptionalParamData = { + /** + * This is an optional parameter + */ + body?: { + offset?: (number) | null; + }; + query: { + /** + * This is a required parameter + */ + parameter: Pageable; + }; +}; + +export type PostCallWithOptionalParamResponse = (number | void); + +export type PostCallWithOptionalParamError = unknown; + +export type PostApiVbyApiVersionRequestBodyData = { + /** + * A reusable request body + */ + body?: ModelWithString; + query?: { + /** + * This is a reusable parameter + */ + parameter?: string; + }; +}; + +export type PostApiVbyApiVersionFormDataData = { + /** + * A reusable request body + */ + body?: ModelWithString; + query?: { + /** + * This is a reusable parameter + */ + parameter?: string; + }; +}; + +export type CallWithDefaultParametersData = { + query?: { + /** + * This is a simple boolean with default value + */ + parameterBoolean?: (boolean) | null; + /** + * This is a simple enum with default value + */ + parameterEnum?: 'Success' | 'Warning' | 'Error'; + /** + * This is a simple model with default value + */ + parameterModel?: (ModelWithString) | null; + /** + * This is a simple number with default value + */ + parameterNumber?: (number) | null; + /** + * This is a simple string with default value + */ + parameterString?: (string) | null; + }; +}; + +export type CallWithDefaultOptionalParametersData = { + query?: { + /** + * This is a simple boolean that is optional with default value + */ + parameterBoolean?: boolean; + /** + * This is a simple enum that is optional with default value + */ + parameterEnum?: 'Success' | 'Warning' | 'Error'; + /** + * This is a simple model that is optional with default value + */ + parameterModel?: ModelWithString; + /** + * This is a simple number that is optional with default value + */ + parameterNumber?: number; + /** + * This is a simple string that is optional with default value + */ + parameterString?: string; + }; +}; + +export type CallToTestOrderOfParamsData = { + query: { + /** + * This is a optional string with default + */ + parameterOptionalStringWithDefault?: string; + /** + * This is a optional string with empty default + */ + parameterOptionalStringWithEmptyDefault?: string; + /** + * This is a optional string with no default + */ + parameterOptionalStringWithNoDefault?: string; + /** + * This is a string that can be null with default + */ + parameterStringNullableWithDefault?: (string) | null; + /** + * This is a string that can be null with no default + */ + parameterStringNullableWithNoDefault?: (string) | null; + /** + * This is a string with default + */ + parameterStringWithDefault: string; + /** + * This is a string with empty default + */ + parameterStringWithEmptyDefault: string; + /** + * This is a string with no default + */ + parameterStringWithNoDefault: string; + }; +}; + +export type CallWithNoContentResponseResponse = (void); + +export type CallWithNoContentResponseError = unknown; + +export type CallWithResponseAndNoContentResponseResponse = (number | void); + +export type CallWithResponseAndNoContentResponseError = unknown; + +export type DummyAResponse = (_400); + +export type DummyAError = unknown; + +export type DummyBResponse = (void); + +export type DummyBError = unknown; + +export type CallWithResponseResponse = (_import); + +export type CallWithResponseError = unknown; + +export type CallWithDuplicateResponsesResponse = ((ModelWithBoolean & ModelWithInteger) | ModelWithString); + +export type CallWithDuplicateResponsesError = (ModelWithStringError | DictionaryWithArray | ModelWithBoolean); + +export type CallWithResponsesResponse = ({ + readonly '@namespace.string'?: string; + readonly '@namespace.integer'?: number; + readonly value?: Array; +} | ModelThatExtends | ModelThatExtendsExtends); + +export type CallWithResponsesError = (ModelWithStringError); + +export type CollectionFormatData = { + query: { + /** + * This is an array parameter that is sent as csv format (comma-separated values) + */ + parameterArrayCSV: Array<(string)> | null; + /** + * This is an array parameter that is sent as multi format (multiple parameter instances) + */ + parameterArrayMulti: Array<(string)> | null; + /** + * This is an array parameter that is sent as pipes format (pipe-separated values) + */ + parameterArrayPipes: Array<(string)> | null; + /** + * This is an array parameter that is sent as ssv format (space-separated values) + */ + parameterArraySSV: Array<(string)> | null; + /** + * This is an array parameter that is sent as tsv format (tab-separated values) + */ + parameterArrayTSV: Array<(string)> | null; + }; +}; + +export type TypesData = { + path?: { + /** + * This is a number parameter + */ + id?: number; + }; + query: { + /** + * This is an array parameter + */ + parameterArray: Array<(string)> | null; + /** + * This is a boolean parameter + */ + parameterBoolean: (boolean) | null; + /** + * This is a dictionary parameter + */ + parameterDictionary: { + [key: string]: unknown; + } | null; + /** + * This is an enum parameter + */ + parameterEnum: ('Success' | 'Warning' | 'Error') | null; + /** + * This is a number parameter + */ + parameterNumber: number; + /** + * This is an object parameter + */ + parameterObject: { + [key: string]: unknown; + } | null; + /** + * This is a string parameter + */ + parameterString: (string) | null; + }; +}; + +export type TypesResponse = (number | string | boolean | { + [key: string]: unknown; +}); + +export type TypesError = unknown; + +export type UploadFileData = { + body: (Blob | File); + path: { + /** + * api-version should be required in standalone clients + */ + 'api-version': (string) | null; + }; +}; + +export type UploadFileResponse = (boolean); + +export type UploadFileError = unknown; + +export type FileResponseData = { + path: { + /** + * api-version should be required in standalone clients + */ + 'api-version': string; + id: string; + }; +}; + +export type FileResponseResponse = ((Blob | File)); + +export type FileResponseError = unknown; + +export type ComplexTypesData = { + query: { + /** + * Parameter containing object + */ + parameterObject: { + first?: { + second?: { + third?: string; + }; + }; + }; + /** + * Parameter containing reference + */ + parameterReference: ModelWithString; + }; +}; + +export type ComplexTypesResponse = (Array); + +export type ComplexTypesError = (unknown); + +export type MultipartRequestData = { + body?: { + content?: (Blob | File); + data?: ((ModelWithString) | null); + }; +}; + +export type MultipartResponseResponse = ({ + file?: (Blob | File); + metadata?: { + foo?: string; + bar?: string; + }; +}); + +export type MultipartResponseError = unknown; + +export type ComplexParamsData = { + body?: { + readonly key: (string) | null; + name: (string) | null; + enabled?: boolean; + readonly type: 'Monkey' | 'Horse' | 'Bird'; + listOfModels?: Array | null; + listOfStrings?: Array<(string)> | null; + parameters: (ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary); + readonly user?: { + readonly id?: number; + readonly name?: (string) | null; + }; + }; + path: { + /** + * api-version should be required in standalone clients + */ + 'api-version': string; + id: number; + }; +}; + +export type ComplexParamsResponse = (ModelWithString); + +export type ComplexParamsError = unknown; + +export type CallWithResultFromHeaderResponse = (string); + +export type CallWithResultFromHeaderError = (unknown); + +export type TestErrorCodeData = { + query: { + /** + * Status code to return + */ + status: number; + }; +}; + +export type TestErrorCodeResponse = (unknown); + +export type TestErrorCodeError = (unknown); + +export type NonAsciiæøåÆøÅöôêÊ字符串Data = { + query: { + /** + * Dummy input param + */ + nonAsciiParamæøåÆØÅöôêÊ: number; + }; +}; + +export type NonAsciiæøåÆøÅöôêÊ字符串Response = (Array); + +export type NonAsciiæøåÆøÅöôêÊ字符串Error = unknown; + +export type PutWithFormUrlEncodedData = { + body: ArrayWithStrings; +}; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-vue-query/@tanstack/vue-query.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/vue-query/fetch/@tanstack/vue-query.gen.ts similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-vue-query/@tanstack/vue-query.gen.ts.snap rename to packages/openapi-ts/test/__snapshots__/plugins/@tanstack/vue-query/fetch/@tanstack/vue-query.gen.ts diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-solid-query_transform/index.ts.snap b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/vue-query/fetch/index.ts similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-solid-query_transform/index.ts.snap rename to packages/openapi-ts/test/__snapshots__/plugins/@tanstack/vue-query/fetch/index.ts diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-vue-query/services.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/vue-query/fetch/services.gen.ts similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-vue-query/services.gen.ts.snap rename to packages/openapi-ts/test/__snapshots__/plugins/@tanstack/vue-query/fetch/services.gen.ts diff --git a/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/vue-query/fetch/types.gen.ts b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/vue-query/fetch/types.gen.ts new file mode 100644 index 000000000..1989b3f22 --- /dev/null +++ b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/vue-query/fetch/types.gen.ts @@ -0,0 +1,1507 @@ +// This file is auto-generated by @hey-api/openapi-ts + +/** + * Model with number-only name + */ +export type _400 = string; + +/** + * Testing multiline comments in string: First line + * Second line + * + * Fourth line + */ +export type camelCaseCommentWithBreaks = number; + +/** + * Testing multiline comments in string: First line + * Second line + * + * Fourth line + */ +export type CommentWithBreaks = number; + +/** + * Testing backticks in string: `backticks` and ```multiple backticks``` should work + */ +export type CommentWithBackticks = number; + +/** + * Testing backticks and quotes in string: `backticks`, 'quotes', "double quotes" and ```multiple backticks``` should work + */ +export type CommentWithBackticksAndQuotes = number; + +/** + * Testing slashes in string: \backwards\\\ and /forwards/// should work + */ +export type CommentWithSlashes = number; + +/** + * Testing expression placeholders in string: ${expression} should work + */ +export type CommentWithExpressionPlaceholders = number; + +/** + * Testing quotes in string: 'single quote''' and "double quotes""" should work + */ +export type CommentWithQuotes = number; + +/** + * Testing reserved characters in string: * inline * and ** inline ** should work + */ +export type CommentWithReservedCharacters = number; + +/** + * This is a simple number + */ +export type SimpleInteger = number; + +/** + * This is a simple boolean + */ +export type SimpleBoolean = boolean; + +/** + * This is a simple string + */ +export type SimpleString = string; + +/** + * A string with non-ascii (unicode) characters valid in typescript identifiers (æøåÆØÅöÔèÈ字符串) + */ +export type NonAsciiStringæøåÆØÅöôêÊ字符串 = string; + +/** + * This is a simple file + */ +export type SimpleFile = (Blob | File); + +/** + * This is a simple reference + */ +export type SimpleReference = ModelWithString; + +/** + * This is a simple string + */ +export type SimpleStringWithPattern = (string) | null; + +/** + * This is a simple enum with strings + */ +export type EnumWithStrings = 'Success' | 'Warning' | 'Error' | "'Single Quote'" | '"Double Quotes"' | 'Non-ascii: øæåôöØÆÅÔÖ字符串'; + +export type EnumWithReplacedCharacters = "'Single Quote'" | '"Double Quotes"' | 'øæåôöØÆÅÔÖ字符串' | 3.1 | ''; + +/** + * This is a simple enum with numbers + */ +export type EnumWithNumbers = 1 | 2 | 3 | 1.1 | 1.2 | 1.3 | 100 | 200 | 300 | -100 | -200 | -300 | -1.1 | -1.2 | -1.3; + +/** + * Success=1,Warning=2,Error=3 + */ +export type EnumFromDescription = number; + +/** + * This is a simple enum with numbers + */ +export type EnumWithExtensions = 200 | 400 | 500; + +export type EnumWithXEnumNames = 0 | 1 | 2; + +/** + * This is a simple array with numbers + */ +export type ArrayWithNumbers = Array<(number)>; + +/** + * This is a simple array with booleans + */ +export type ArrayWithBooleans = Array<(boolean)>; + +/** + * This is a simple array with strings + */ +export type ArrayWithStrings = Array<(string)>; + +/** + * This is a simple array with references + */ +export type ArrayWithReferences = Array; + +/** + * This is a simple array containing an array + */ +export type ArrayWithArray = Array>; + +/** + * This is a simple array with properties + */ +export type ArrayWithProperties = Array<{ + '16x16'?: camelCaseCommentWithBreaks; + bar?: string; +}>; + +/** + * This is a simple array with any of properties + */ +export type ArrayWithAnyOfProperties = Array<({ + foo?: string; +} | { + bar?: string; +})>; + +export type AnyOfAnyAndNull = { + data?: (unknown | null); +}; + +/** + * This is a simple array with any of properties + */ +export type AnyOfArrays = { + results?: Array<({ + foo?: string; +} | { + bar?: string; +})>; +}; + +/** + * This is a string dictionary + */ +export type DictionaryWithString = { + [key: string]: (string); +}; + +export type DictionaryWithPropertiesAndAdditionalProperties = { + foo?: number; + bar?: boolean; + [key: string]: (string | number | boolean) | undefined; +}; + +/** + * This is a string reference + */ +export type DictionaryWithReference = { + [key: string]: ModelWithString; +}; + +/** + * This is a complex dictionary + */ +export type DictionaryWithArray = { + [key: string]: Array; +}; + +/** + * This is a string dictionary + */ +export type DictionaryWithDictionary = { + [key: string]: { + [key: string]: (string); + }; +}; + +/** + * This is a complex dictionary + */ +export type DictionaryWithProperties = { + [key: string]: { + foo?: string; + bar?: string; + }; +}; + +/** + * This is a model with one number property + */ +export type ModelWithInteger = { + /** + * This is a simple number property + */ + prop?: number; +}; + +/** + * This is a model with one boolean property + */ +export type ModelWithBoolean = { + /** + * This is a simple boolean property + */ + prop?: boolean; +}; + +/** + * This is a model with one string property + */ +export type ModelWithString = { + /** + * This is a simple string property + */ + prop?: string; +}; + +/** + * This is a model with one string property + */ +export type ModelWithStringError = { + /** + * This is a simple string property + */ + prop?: string; +}; + +/** + * `Comment` or `VoiceComment`. The JSON object for adding voice comments to tickets is different. See [Adding voice comments to tickets](/documentation/ticketing/managing-tickets/adding-voice-comments-to-tickets) + */ +export type Model_From_Zendesk = string; + +/** + * This is a model with one string property + */ +export type ModelWithNullableString = { + /** + * This is a simple string property + */ + nullableProp1?: (string) | null; + /** + * This is a simple string property + */ + nullableRequiredProp1: (string) | null; + /** + * This is a simple string property + */ + nullableProp2?: (string) | null; + /** + * This is a simple string property + */ + nullableRequiredProp2: (string) | null; + /** + * This is a simple enum with strings + */ + 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; +}; + +/** + * This is a simple enum with strings + */ +export type foo_bar_enum = 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; + +/** + * This is a model with one enum + */ +export type ModelWithEnum = { + /** + * This is a simple enum with strings + */ + 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; + /** + * These are the HTTP error code enums + */ + statusCode?: '100' | '200 FOO' | '300 FOO_BAR' | '400 foo-bar' | '500 foo.bar' | '600 foo&bar'; + /** + * Simple boolean enum + */ + bool?: boolean; +}; + +/** + * These are the HTTP error code enums + */ +export type statusCode = '100' | '200 FOO' | '300 FOO_BAR' | '400 foo-bar' | '500 foo.bar' | '600 foo&bar'; + +/** + * This is a model with one enum with escaped name + */ +export type ModelWithEnumWithHyphen = { + 'foo-bar-baz-qux'?: '3.0'; +}; + +export type foo_bar_baz_qux = '3.0'; + +/** + * This is a model with one enum + */ +export type ModelWithEnumFromDescription = { + /** + * Success=1,Warning=2,Error=3 + */ + test?: number; +}; + +/** + * This is a model with nested enums + */ +export type ModelWithNestedEnums = { + dictionaryWithEnum?: { + [key: string]: ('Success' | 'Warning' | 'Error'); + }; + dictionaryWithEnumFromDescription?: { + [key: string]: (number); + }; + arrayWithEnum?: Array<('Success' | 'Warning' | 'Error')>; + arrayWithDescription?: Array<(number)>; + /** + * This is a simple enum with strings + */ + 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; +}; + +/** + * This is a model with one property containing a reference + */ +export type ModelWithReference = { + prop?: ModelWithProperties; +}; + +/** + * This is a model with one property containing an array + */ +export type ModelWithArrayReadOnlyAndWriteOnly = { + prop?: Array; + propWithFile?: Array<((Blob | File))>; + propWithNumber?: Array<(number)>; +}; + +/** + * This is a model with one property containing an array + */ +export type ModelWithArray = { + prop?: Array; + propWithFile?: Array<((Blob | File))>; + propWithNumber?: Array<(number)>; +}; + +/** + * This is a model with one property containing a dictionary + */ +export type ModelWithDictionary = { + prop?: { + [key: string]: (string); + }; +}; + +/** + * This is a deprecated model with a deprecated property + * @deprecated + */ +export type DeprecatedModel = { + /** + * This is a deprecated property + * @deprecated + */ + prop?: string; +}; + +/** + * This is a model with one property containing a circular reference + */ +export type ModelWithCircularReference = { + prop?: ModelWithCircularReference; +}; + +/** + * This is a model with one property with a 'one of' relationship + */ +export type CompositionWithOneOf = { + propA?: (ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary); +}; + +/** + * This is a model with one property with a 'one of' relationship where the options are not $ref + */ +export type CompositionWithOneOfAnonymous = { + propA?: ({ + propA?: string; +} | string | number); +}; + +/** + * Circle + */ +export type ModelCircle = { + kind: 'circle'; + radius?: number; +}; + +/** + * Square + */ +export type ModelSquare = { + kind: 'square'; + sideLength?: number; +}; + +/** + * This is a model with one property with a 'one of' relationship where the options are not $ref + */ +export type CompositionWithOneOfDiscriminator = ModelCircle | ModelSquare; + +/** + * This is a model with one property with a 'any of' relationship + */ +export type CompositionWithAnyOf = { + propA?: (ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary); +}; + +/** + * This is a model with one property with a 'any of' relationship where the options are not $ref + */ +export type CompositionWithAnyOfAnonymous = { + propA?: ({ + propA?: string; +} | string | number); +}; + +/** + * This is a model with nested 'any of' property with a type null + */ +export type CompositionWithNestedAnyAndTypeNull = { + propA?: (Array<(ModelWithDictionary | null)> | Array<(ModelWithArray | null)>); +}; + +export type _3e_num_1Период = 'Bird' | 'Dog'; + +export type ConstValue = "ConstValue"; + +/** + * This is a model with one property with a 'any of' relationship where the options are not $ref + */ +export type CompositionWithNestedAnyOfAndNull = { + propA?: (Array<(_3e_num_1Период | ConstValue)> | null); +}; + +/** + * This is a model with one property with a 'one of' relationship + */ +export type CompositionWithOneOfAndNullable = { + propA?: (({ + boolean?: boolean; +} | ModelWithEnum | ModelWithArray | ModelWithDictionary) | null); +}; + +/** + * This is a model that contains a simple dictionary within composition + */ +export type CompositionWithOneOfAndSimpleDictionary = { + propA?: (boolean | { + [key: string]: (number); +}); +}; + +/** + * This is a model that contains a dictionary of simple arrays within composition + */ +export type CompositionWithOneOfAndSimpleArrayDictionary = { + propA?: (boolean | { + [key: string]: Array<(boolean)>; +}); +}; + +/** + * This is a model that contains a dictionary of complex arrays (composited) within composition + */ +export type CompositionWithOneOfAndComplexArrayDictionary = { + propA?: (boolean | { + [key: string]: Array<(number | string)>; +}); +}; + +/** + * This is a model with one property with a 'all of' relationship + */ +export type CompositionWithAllOfAndNullable = { + propA?: (({ + boolean?: boolean; +} & ModelWithEnum & ModelWithArray & ModelWithDictionary) | null); +}; + +/** + * This is a model with one property with a 'any of' relationship + */ +export type CompositionWithAnyOfAndNullable = { + propA?: (({ + boolean?: boolean; +} | ModelWithEnum | ModelWithArray | ModelWithDictionary) | null); +}; + +/** + * This is a base model with two simple optional properties + */ +export type CompositionBaseModel = { + firstName?: string; + lastname?: string; +}; + +/** + * This is a model that extends the base model + */ +export type CompositionExtendedModel = CompositionBaseModel & { + firstName: string; + lastname: string; + age: number; +}; + +/** + * This is a model with one nested property + */ +export type ModelWithProperties = { + required: string; + readonly requiredAndReadOnly: string; + requiredAndNullable: (string) | null; + string?: string; + number?: number; + boolean?: boolean; + reference?: ModelWithString; + 'property with space'?: string; + default?: string; + try?: string; + readonly '@namespace.string'?: string; + readonly '@namespace.integer'?: number; +}; + +/** + * This is a model with one nested property + */ +export type ModelWithNestedProperties = { + readonly first: { + readonly second: { + readonly third: (string) | null; + } | null; + } | null; +}; + +/** + * This is a model with duplicated properties + */ +export type ModelWithDuplicateProperties = { + prop?: ModelWithString; +}; + +/** + * This is a model with ordered properties + */ +export type ModelWithOrderedProperties = { + zebra?: string; + apple?: string; + hawaii?: string; +}; + +/** + * This is a model with duplicated imports + */ +export type ModelWithDuplicateImports = { + propA?: ModelWithString; + propB?: ModelWithString; + propC?: ModelWithString; +}; + +/** + * This is a model that extends another model + */ +export type ModelThatExtends = ModelWithString & { + propExtendsA?: string; + propExtendsB?: ModelWithString; +}; + +/** + * This is a model that extends another model + */ +export type ModelThatExtendsExtends = ModelWithString & ModelThatExtends & { + propExtendsC?: string; + propExtendsD?: ModelWithString; +}; + +/** + * This is a model that contains a some patterns + */ +export type ModelWithPattern = { + key: string; + name: string; + readonly enabled?: boolean; + readonly modified?: string; + id?: string; + text?: string; + patternWithSingleQuotes?: string; + patternWithNewline?: string; + patternWithBacktick?: string; +}; + +export type File = { + readonly id?: string; + readonly updated_at?: string; + readonly created_at?: string; + mime: string; + readonly file?: string; +}; + +export type _default = { + name?: string; +}; + +export type Pageable = { + page?: number; + size?: number; + sort?: Array<(string)>; +}; + +/** + * This is a free-form object without additionalProperties. + */ +export type FreeFormObjectWithoutAdditionalProperties = { + [key: string]: unknown; +}; + +/** + * This is a free-form object with additionalProperties: true. + */ +export type FreeFormObjectWithAdditionalPropertiesEqTrue = { + [key: string]: unknown; +}; + +/** + * This is a free-form object with additionalProperties: {}. + */ +export type FreeFormObjectWithAdditionalPropertiesEqEmptyObject = { + [key: string]: unknown; +}; + +export type ModelWithConst = { + String?: "String"; + number?: 0; + null?: null; + withType?: "Some string"; +}; + +/** + * This is a model with one property and additionalProperties: true + */ +export type ModelWithAdditionalPropertiesEqTrue = { + /** + * This is a simple string property + */ + prop?: string; + [key: string]: unknown | string; +}; + +export type NestedAnyOfArraysNullable = { + nullableArray?: (Array<(string | boolean)> | null); +}; + +export type CompositionWithOneOfAndProperties = ({ + foo: ParameterSimpleParameter; +} | { + bar: NonAsciiStringæøåÆØÅöôêÊ字符串; +}) & { + baz: (number) | null; + qux: number; +}; + +/** + * An object that can be null + */ +export type NullableObject = { + foo?: string; +} | null; + +/** + * Some % character + */ +export type CharactersInDescription = string; + +export type ModelWithNullableObject = { + data?: NullableObject; +}; + +export type ModelWithOneOfEnum = { + foo: 'Bar'; +} | { + foo: 'Baz'; +} | { + foo: 'Qux'; +} | { + content: string; + foo: 'Quux'; +} | { + content: [ + (string), + (string) + ]; + foo: 'Corge'; +}; + +export type foo = 'Bar'; + +export type ModelWithNestedArrayEnumsDataFoo = 'foo' | 'bar'; + +export type ModelWithNestedArrayEnumsDataBar = 'baz' | 'qux'; + +export type ModelWithNestedArrayEnumsData = { + foo?: Array; + bar?: Array; +}; + +export type ModelWithNestedArrayEnums = { + array_strings?: Array<(string)>; + data?: (ModelWithNestedArrayEnumsData); +}; + +export type ModelWithNestedCompositionEnums = { + foo?: (ModelWithNestedArrayEnumsDataFoo); +}; + +export type ModelWithReadOnlyAndWriteOnly = { + foo: string; + readonly bar: string; + baz: string; +}; + +export type ModelWithConstantSizeArray = [ + number, + number +]; + +export type ModelWithAnyOfConstantSizeArray = [ + (number | string), + (number | string), + (number | string) +]; + +export type ModelWithPrefixItemsConstantSizeArray = [ + ModelWithInteger, + (number | string), + string +]; + +export type ModelWithAnyOfConstantSizeArrayNullable = [ + ((number) | null | string), + ((number) | null | string), + ((number) | null | string) +]; + +export type ModelWithAnyOfConstantSizeArrayWithNSizeAndOptions = [ + (number | _import), + (number | _import) +]; + +export type ModelWithAnyOfConstantSizeArrayAndIntersect = [ + (number & string), + (number & string) +]; + +export type ModelWithNumericEnumUnion = { + /** + * Период + */ + value?: -10 | -1 | 0 | 1 | 3 | 6 | 12; +}; + +/** + * Период + */ +export type value = -10 | -1 | 0 | 1 | 3 | 6 | 12; + +/** + * Some description with `back ticks` + */ +export type ModelWithBackticksInDescription = { + /** + * The template `that` should be used for parsing and importing the contents of the CSV file. + * + *

There is one placeholder currently supported:

  • ${x} - refers to the n-th column in the CSV file, e.g. ${1}, ${2}, ...)

Example of a correct JSON template:

+ *
+     * [
+     * {
+     * "resourceType": "Asset",
+     * "identifier": {
+     * "name": "${1}",
+     * "domain": {
+     * "name": "${2}",
+     * "community": {
+     * "name": "Some Community"
+     * }
+     * }
+     * },
+     * "attributes" : {
+     * "00000000-0000-0000-0000-000000003115" : [ {
+     * "value" : "${3}"
+     * } ],
+     * "00000000-0000-0000-0000-000000000222" : [ {
+     * "value" : "${4}"
+     * } ]
+     * }
+     * }
+     * ]
+     * 
+ */ + template?: string; +}; + +export type ModelWithOneOfAndProperties = (ParameterSimpleParameter | NonAsciiStringæøåÆØÅöôêÊ字符串) & { + baz: (number) | null; + qux: number; +}; + +/** + * Model used to test deduplication strategy (unused) + */ +export type ParameterSimpleParameterUnused = string; + +/** + * Model used to test deduplication strategy + */ +export type PostServiceWithEmptyTagResponse = string; + +/** + * Model used to test deduplication strategy + */ +export type PostServiceWithEmptyTagResponse2 = string; + +/** + * Model used to test deduplication strategy + */ +export type DeleteFooData = string; + +/** + * Model used to test deduplication strategy + */ +export type DeleteFooData2 = string; + +/** + * Model with restricted keyword name + */ +export type _import = string; + +export type SchemaWithFormRestrictedKeys = { + description?: string; + 'x-enum-descriptions'?: string; + 'x-enum-varnames'?: string; + 'x-enumNames'?: string; + title?: string; + object?: { + description?: string; + 'x-enum-descriptions'?: string; + 'x-enum-varnames'?: string; + 'x-enumNames'?: string; + title?: string; + }; + array?: Array<({ + description?: string; + 'x-enum-descriptions'?: string; + 'x-enum-varnames'?: string; + 'x-enumNames'?: string; + title?: string; +})>; +}; + +/** + * This schema was giving PascalCase transformations a hard time + */ +export type io_k8s_apimachinery_pkg_apis_meta_v1_DeleteOptions = { + /** + * Must be fulfilled before a deletion is carried out. If not possible, a 409 Conflict status will be returned. + */ + preconditions?: (io_k8s_apimachinery_pkg_apis_meta_v1_Preconditions); +}; + +/** + * This schema was giving PascalCase transformations a hard time + */ +export type io_k8s_apimachinery_pkg_apis_meta_v1_Preconditions = { + /** + * Specifies the target ResourceVersion + */ + resourceVersion?: string; + /** + * Specifies the target UID. + */ + uid?: string; +}; + +export type AdditionalPropertiesUnknownIssue = { + [key: string]: (string | number); +}; + +export type AdditionalPropertiesUnknownIssue2 = { + [key: string]: (string | number); +}; + +export type AdditionalPropertiesUnknownIssue3 = string & { + entries: { + [key: string]: AdditionalPropertiesUnknownIssue; + }; +}; + +export type AdditionalPropertiesIntegerIssue = { + value: number; + [key: string]: (number) | undefined; +}; + +export type OneOfAllOfIssue = ((ConstValue | Generic_Schema_Duplicate_Issue_1_System_Boolean_) & _3e_num_1Период) | Generic_Schema_Duplicate_Issue_1_System_String_; + +export type Generic_Schema_Duplicate_Issue_1_System_Boolean_ = { + item?: boolean; + error?: (string) | null; + readonly hasError?: boolean; + data?: { + [key: string]: unknown; + }; +}; + +export type Generic_Schema_Duplicate_Issue_1_System_String_ = { + item?: (string) | null; + error?: (string) | null; + readonly hasError?: boolean; +}; + +/** + * This is a reusable parameter + */ +export type ParameterSimpleParameter = string; + +/** + * Parameter with illegal characters + */ +export type Parameterx_Foo_Bar = ModelWithString; + +export type ImportData = { + body: (ModelWithReadOnlyAndWriteOnly | ModelWithArrayReadOnlyAndWriteOnly); +}; + +export type ImportResponse = (Model_From_Zendesk | ModelWithReadOnlyAndWriteOnly); + +export type ImportError = unknown; + +export type ApiVversionOdataControllerCountResponse = (Model_From_Zendesk); + +export type ApiVversionOdataControllerCountError = unknown; + +export type GetApiVbyApiVersionSimpleOperationData = { + path: { + /** + * foo in method + */ + foo_param: string; + }; +}; + +export type GetApiVbyApiVersionSimpleOperationResponse = (number); + +export type GetApiVbyApiVersionSimpleOperationError = (ModelWithBoolean); + +export type DeleteFooData3 = { + headers: { + /** + * Parameter with illegal characters + */ + 'x-Foo-Bar': ModelWithString; + }; + path: { + /** + * bar in method + */ + BarParam: string; + /** + * foo in method + */ + foo_param: string; + }; +}; + +export type CallWithDescriptionsData = { + query?: { + /** + * Testing backticks in string: `backticks` and ```multiple backticks``` should work + */ + parameterWithBackticks?: unknown; + /** + * Testing multiline comments in string: First line + * Second line + * + * Fourth line + */ + parameterWithBreaks?: unknown; + /** + * Testing expression placeholders in string: ${expression} should work + */ + parameterWithExpressionPlaceholders?: unknown; + /** + * Testing quotes in string: 'single quote''' and "double quotes""" should work + */ + parameterWithQuotes?: unknown; + /** + * Testing reserved characters in string: * inline * and ** inline ** should work + */ + parameterWithReservedCharacters?: unknown; + /** + * Testing slashes in string: \backwards\\\ and /forwards/// should work + */ + parameterWithSlashes?: unknown; + }; +}; + +export type DeprecatedCallData = { + headers: { + /** + * This parameter is deprecated + * @deprecated + */ + parameter: (DeprecatedModel) | null; + }; +}; + +export type CallWithParametersData = { + /** + * This is the parameter that goes into the body + */ + body: { + [key: string]: unknown; + } | null; + headers: { + /** + * This is the parameter that goes into the header + */ + parameterHeader: (string) | null; + }; + path: { + /** + * api-version should be required in standalone clients + */ + 'api-version': (string) | null; + /** + * This is the parameter that goes into the path + */ + parameterPath: (string) | null; + }; + query: { + /** + * This is the parameter that goes into the query params + */ + cursor: (string) | null; + foo_all_of_enum: (ModelWithNestedArrayEnumsDataFoo); + foo_ref_enum?: ModelWithNestedArrayEnumsDataFoo; + }; +}; + +export type CallWithWeirdParameterNamesData = { + /** + * This is the parameter that goes into the body + */ + body: (ModelWithString) | null; + headers: { + /** + * This is the parameter that goes into the request header + */ + 'parameter.header': (string) | null; + }; + path: { + /** + * api-version should be required in standalone clients + */ + 'api-version': (string) | null; + /** + * This is the parameter that goes into the path + */ + 'parameter-path-2'?: string; + /** + * This is the parameter that goes into the path + */ + 'PARAMETER-PATH-3'?: string; + /** + * This is the parameter that goes into the path + */ + 'parameter.path.1'?: string; + }; + query: { + /** + * This is the parameter with a reserved keyword + */ + default?: string; + /** + * This is the parameter that goes into the request query params + */ + 'parameter-query': (string) | null; + }; +}; + +export type GetCallWithOptionalParamData = { + /** + * This is a required parameter + */ + body: ModelWithOneOfEnum; + query?: { + /** + * This is an optional parameter + */ + page?: number; + }; +}; + +export type PostCallWithOptionalParamData = { + /** + * This is an optional parameter + */ + body?: { + offset?: (number) | null; + }; + query: { + /** + * This is a required parameter + */ + parameter: Pageable; + }; +}; + +export type PostCallWithOptionalParamResponse = (number | void); + +export type PostCallWithOptionalParamError = unknown; + +export type PostApiVbyApiVersionRequestBodyData = { + /** + * A reusable request body + */ + body?: ModelWithString; + query?: { + /** + * This is a reusable parameter + */ + parameter?: string; + }; +}; + +export type PostApiVbyApiVersionFormDataData = { + /** + * A reusable request body + */ + body?: ModelWithString; + query?: { + /** + * This is a reusable parameter + */ + parameter?: string; + }; +}; + +export type CallWithDefaultParametersData = { + query?: { + /** + * This is a simple boolean with default value + */ + parameterBoolean?: (boolean) | null; + /** + * This is a simple enum with default value + */ + parameterEnum?: 'Success' | 'Warning' | 'Error'; + /** + * This is a simple model with default value + */ + parameterModel?: (ModelWithString) | null; + /** + * This is a simple number with default value + */ + parameterNumber?: (number) | null; + /** + * This is a simple string with default value + */ + parameterString?: (string) | null; + }; +}; + +export type CallWithDefaultOptionalParametersData = { + query?: { + /** + * This is a simple boolean that is optional with default value + */ + parameterBoolean?: boolean; + /** + * This is a simple enum that is optional with default value + */ + parameterEnum?: 'Success' | 'Warning' | 'Error'; + /** + * This is a simple model that is optional with default value + */ + parameterModel?: ModelWithString; + /** + * This is a simple number that is optional with default value + */ + parameterNumber?: number; + /** + * This is a simple string that is optional with default value + */ + parameterString?: string; + }; +}; + +export type CallToTestOrderOfParamsData = { + query: { + /** + * This is a optional string with default + */ + parameterOptionalStringWithDefault?: string; + /** + * This is a optional string with empty default + */ + parameterOptionalStringWithEmptyDefault?: string; + /** + * This is a optional string with no default + */ + parameterOptionalStringWithNoDefault?: string; + /** + * This is a string that can be null with default + */ + parameterStringNullableWithDefault?: (string) | null; + /** + * This is a string that can be null with no default + */ + parameterStringNullableWithNoDefault?: (string) | null; + /** + * This is a string with default + */ + parameterStringWithDefault: string; + /** + * This is a string with empty default + */ + parameterStringWithEmptyDefault: string; + /** + * This is a string with no default + */ + parameterStringWithNoDefault: string; + }; +}; + +export type CallWithNoContentResponseResponse = (void); + +export type CallWithNoContentResponseError = unknown; + +export type CallWithResponseAndNoContentResponseResponse = (number | void); + +export type CallWithResponseAndNoContentResponseError = unknown; + +export type DummyAResponse = (_400); + +export type DummyAError = unknown; + +export type DummyBResponse = (void); + +export type DummyBError = unknown; + +export type CallWithResponseResponse = (_import); + +export type CallWithResponseError = unknown; + +export type CallWithDuplicateResponsesResponse = ((ModelWithBoolean & ModelWithInteger) | ModelWithString); + +export type CallWithDuplicateResponsesError = (ModelWithStringError | DictionaryWithArray | ModelWithBoolean); + +export type CallWithResponsesResponse = ({ + readonly '@namespace.string'?: string; + readonly '@namespace.integer'?: number; + readonly value?: Array; +} | ModelThatExtends | ModelThatExtendsExtends); + +export type CallWithResponsesError = (ModelWithStringError); + +export type CollectionFormatData = { + query: { + /** + * This is an array parameter that is sent as csv format (comma-separated values) + */ + parameterArrayCSV: Array<(string)> | null; + /** + * This is an array parameter that is sent as multi format (multiple parameter instances) + */ + parameterArrayMulti: Array<(string)> | null; + /** + * This is an array parameter that is sent as pipes format (pipe-separated values) + */ + parameterArrayPipes: Array<(string)> | null; + /** + * This is an array parameter that is sent as ssv format (space-separated values) + */ + parameterArraySSV: Array<(string)> | null; + /** + * This is an array parameter that is sent as tsv format (tab-separated values) + */ + parameterArrayTSV: Array<(string)> | null; + }; +}; + +export type TypesData = { + path?: { + /** + * This is a number parameter + */ + id?: number; + }; + query: { + /** + * This is an array parameter + */ + parameterArray: Array<(string)> | null; + /** + * This is a boolean parameter + */ + parameterBoolean: (boolean) | null; + /** + * This is a dictionary parameter + */ + parameterDictionary: { + [key: string]: unknown; + } | null; + /** + * This is an enum parameter + */ + parameterEnum: ('Success' | 'Warning' | 'Error') | null; + /** + * This is a number parameter + */ + parameterNumber: number; + /** + * This is an object parameter + */ + parameterObject: { + [key: string]: unknown; + } | null; + /** + * This is a string parameter + */ + parameterString: (string) | null; + }; +}; + +export type TypesResponse = (number | string | boolean | { + [key: string]: unknown; +}); + +export type TypesError = unknown; + +export type UploadFileData = { + body: (Blob | File); + path: { + /** + * api-version should be required in standalone clients + */ + 'api-version': (string) | null; + }; +}; + +export type UploadFileResponse = (boolean); + +export type UploadFileError = unknown; + +export type FileResponseData = { + path: { + /** + * api-version should be required in standalone clients + */ + 'api-version': string; + id: string; + }; +}; + +export type FileResponseResponse = ((Blob | File)); + +export type FileResponseError = unknown; + +export type ComplexTypesData = { + query: { + /** + * Parameter containing object + */ + parameterObject: { + first?: { + second?: { + third?: string; + }; + }; + }; + /** + * Parameter containing reference + */ + parameterReference: ModelWithString; + }; +}; + +export type ComplexTypesResponse = (Array); + +export type ComplexTypesError = (unknown); + +export type MultipartRequestData = { + body?: { + content?: (Blob | File); + data?: ((ModelWithString) | null); + }; +}; + +export type MultipartResponseResponse = ({ + file?: (Blob | File); + metadata?: { + foo?: string; + bar?: string; + }; +}); + +export type MultipartResponseError = unknown; + +export type ComplexParamsData = { + body?: { + readonly key: (string) | null; + name: (string) | null; + enabled?: boolean; + readonly type: 'Monkey' | 'Horse' | 'Bird'; + listOfModels?: Array | null; + listOfStrings?: Array<(string)> | null; + parameters: (ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary); + readonly user?: { + readonly id?: number; + readonly name?: (string) | null; + }; + }; + path: { + /** + * api-version should be required in standalone clients + */ + 'api-version': string; + id: number; + }; +}; + +export type ComplexParamsResponse = (ModelWithString); + +export type ComplexParamsError = unknown; + +export type CallWithResultFromHeaderResponse = (string); + +export type CallWithResultFromHeaderError = (unknown); + +export type TestErrorCodeData = { + query: { + /** + * Status code to return + */ + status: number; + }; +}; + +export type TestErrorCodeResponse = (unknown); + +export type TestErrorCodeError = (unknown); + +export type NonAsciiæøåÆøÅöôêÊ字符串Data = { + query: { + /** + * Dummy input param + */ + nonAsciiParamæøåÆØÅöôêÊ: number; + }; +}; + +export type NonAsciiæøåÆøÅöôêÊ字符串Response = (Array); + +export type NonAsciiæøåÆøÅöôêÊ字符串Error = unknown; + +export type PutWithFormUrlEncodedData = { + body: ArrayWithStrings; +}; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-react-query_transform/@tanstack/react-query.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-react-query_transform/@tanstack/react-query.gen.ts.snap deleted file mode 100644 index 7bf74f876..000000000 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-react-query_transform/@tanstack/react-query.gen.ts.snap +++ /dev/null @@ -1,110 +0,0 @@ -// This file is auto-generated by @hey-api/openapi-ts - -import type { Options } from '@hey-api/client-axios'; -import { queryOptions, type UseMutationOptions } from '@tanstack/react-query'; -import type { ParentModelWithDatesError, ParentModelWithDatesResponse, ModelWithDatesError, ModelWithDatesResponse, ModelWithDatesArrayError, ModelWithDatesArrayResponse, ArrayOfDatesError, ArrayOfDatesResponse, DateError, DateResponse, MultipleResponsesError, MultipleResponsesResponse } from '../types.gen'; -import type { AxiosError } from 'axios'; -import { client, parentModelWithDates, modelWithDates, modelWithDatesArray, arrayOfDates, date, multipleResponses } from '../services.gen'; - -type QueryKey = [ - Pick & { - _id: string; - _infinite?: boolean; - } -]; - -const createQueryKey = (id: string, options?: TOptions, infinite?: boolean): QueryKey[0] => { - const params: QueryKey[0] = { _id: id, baseURL: (options?.client ?? client).getConfig().baseURL } as QueryKey[0]; - if (infinite) { - params._infinite = infinite; - } - if (options?.body) { - params.body = options.body; - } - if (options?.headers) { - params.headers = options.headers; - } - if (options?.path) { - params.path = options.path; - } - if (options?.query) { - params.query = options.query; - } - return params; -}; - -export const parentModelWithDatesQueryKey = (options?: Options) => [ - createQueryKey("parentModelWithDates", options) -]; - -export const parentModelWithDatesOptions = (options?: Options) => { return queryOptions({ - queryFn: async ({ queryKey }) => { - const { data } = await parentModelWithDates({ - ...options, - ...queryKey[0], - throwOnError: true - }); - return data; - }, - queryKey: parentModelWithDatesQueryKey(options) -}); }; - -export const parentModelWithDatesMutation = () => { const mutationOptions: UseMutationOptions, Options> = { - mutationFn: async (options) => { - const { data } = await parentModelWithDates({ - ...options, - throwOnError: true - }); - return data; - } -}; return mutationOptions; }; - -export const modelWithDatesMutation = () => { const mutationOptions: UseMutationOptions, Options> = { - mutationFn: async (options) => { - const { data } = await modelWithDates({ - ...options, - throwOnError: true - }); - return data; - } -}; return mutationOptions; }; - -export const modelWithDatesArrayMutation = () => { const mutationOptions: UseMutationOptions, Options> = { - mutationFn: async (options) => { - const { data } = await modelWithDatesArray({ - ...options, - throwOnError: true - }); - return data; - } -}; return mutationOptions; }; - -export const arrayOfDatesMutation = () => { const mutationOptions: UseMutationOptions, Options> = { - mutationFn: async (options) => { - const { data } = await arrayOfDates({ - ...options, - throwOnError: true - }); - return data; - } -}; return mutationOptions; }; - -export const dateMutation = () => { const mutationOptions: UseMutationOptions, Options> = { - mutationFn: async (options) => { - const { data } = await date({ - ...options, - throwOnError: true - }); - return data; - } -}; return mutationOptions; }; - -export const multipleResponsesMutation = () => { const mutationOptions: UseMutationOptions, Options> = { - mutationFn: async (options) => { - const { data } = await multipleResponses({ - ...options, - throwOnError: true - }); - return data; - } -}; return mutationOptions; }; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-react-query_transform/services.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-react-query_transform/services.gen.ts.snap deleted file mode 100644 index e41163f6d..000000000 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-react-query_transform/services.gen.ts.snap +++ /dev/null @@ -1,39 +0,0 @@ -// This file is auto-generated by @hey-api/openapi-ts - -import { createClient, createConfig, type Options } from '@hey-api/client-axios'; -import { type ParentModelWithDatesError, type ParentModelWithDatesResponse, type ModelWithDatesError, type ModelWithDatesResponse, type ModelWithDatesArrayError, type ModelWithDatesArrayResponse, type ArrayOfDatesError, type ArrayOfDatesResponse, type DateError, type DateResponse, type MultipleResponsesError, type MultipleResponsesResponse, ParentModelWithDatesResponseTransformer, ModelWithDatesResponseTransformer, ModelWithDatesArrayResponseTransformer } from './types.gen'; - -export const client = createClient(createConfig()); - -export const parentModelWithDates = (options?: Options) => { return (options?.client ?? client).post({ - ...options, - url: '/api/model-with-dates', - responseTransformer: ParentModelWithDatesResponseTransformer -}); }; - -export const modelWithDates = (options?: Options) => { return (options?.client ?? client).put({ - ...options, - url: '/api/model-with-dates', - responseTransformer: ModelWithDatesResponseTransformer -}); }; - -export const modelWithDatesArray = (options?: Options) => { return (options?.client ?? client).put({ - ...options, - url: '/api/model-with-dates-array', - responseTransformer: ModelWithDatesArrayResponseTransformer -}); }; - -export const arrayOfDates = (options?: Options) => { return (options?.client ?? client).put({ - ...options, - url: '/api/array-of-dates' -}); }; - -export const date = (options?: Options) => { return (options?.client ?? client).put({ - ...options, - url: '/api/date' -}); }; - -export const multipleResponses = (options?: Options) => { return (options?.client ?? client).put({ - ...options, - url: '/api/multiple-responses' -}); }; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-react-query_transform/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-react-query_transform/types.gen.ts.snap deleted file mode 100644 index 4f5b1d77e..000000000 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-react-query_transform/types.gen.ts.snap +++ /dev/null @@ -1,118 +0,0 @@ -// This file is auto-generated by @hey-api/openapi-ts - -/** - * This is a model that contains a some dates - */ -export type SimpleModel = { - id: number; - name: string; - readonly enabled: boolean; -}; - -/** - * This is a model that contains a some dates - */ -export type ModelWithDates = { - id: number; - name: string; - readonly enabled: boolean; - readonly modified: Date; - readonly expires?: Date; -}; - -/** - * This is a model that contains a some dates and arrays - */ -export type ParentModelWithDates = { - id: number; - readonly modified?: Date; - items?: Array; - item?: ModelWithDates; - 'nullable-date'?: Array<(Date | null)>; - simpleItems?: Array; - simpleItem?: SimpleModel; - dates?: Array<(Date)>; - strings?: Array<(string)>; -}; - -export type ParentModelWithDatesResponse = (ParentModelWithDates | unknown); - -export type ParentModelWithDatesError = unknown; - -export type ModelWithDatesResponse = (ModelWithDates); - -export type ModelWithDatesError = unknown; - -export type ModelWithDatesArrayResponse = (Array); - -export type ModelWithDatesArrayError = unknown; - -export type ArrayOfDatesResponse = (Array<(Date)>); - -export type ArrayOfDatesError = unknown; - -export type DateResponse = (Date); - -export type DateError = unknown; - -export type MultipleResponsesResponse = (Array | Array); - -export type MultipleResponsesError = unknown; - -export type ParentModelWithDatesResponseTransformer = (data: any) => Promise; - -export type ParentModelWithDatesModelResponseTransformer = (data: any) => ParentModelWithDates; - -export type ModelWithDatesModelResponseTransformer = (data: any) => ModelWithDates; - -export const ModelWithDatesModelResponseTransformer: ModelWithDatesModelResponseTransformer = data => { - if (data?.modified) { - data.modified = new Date(data.modified); - } - if (data?.expires) { - data.expires = new Date(data.expires); - } - return data; -}; - -export const ParentModelWithDatesModelResponseTransformer: ParentModelWithDatesModelResponseTransformer = data => { - if (data?.modified) { - data.modified = new Date(data.modified); - } - if (Array.isArray(data?.items)) { - data.items.forEach(ModelWithDatesModelResponseTransformer); - } - if (data?.item) { - ModelWithDatesModelResponseTransformer(data.item); - } - if (Array.isArray(data?.['nullable-date'])) { - data['nullable-date'] = data['nullable-date'].map(item => item ? new Date(item) : item); - } - if (Array.isArray(data?.dates)) { - data.dates = data.dates.map(item => item ? new Date(item) : item); - } - return data; -}; - -export const ParentModelWithDatesResponseTransformer: ParentModelWithDatesResponseTransformer = async (data) => { - if (data) { - ParentModelWithDatesModelResponseTransformer(data); - } - return data; -}; - -export type ModelWithDatesResponseTransformer = (data: any) => Promise; - -export const ModelWithDatesResponseTransformer: ModelWithDatesResponseTransformer = async (data) => { - ModelWithDatesModelResponseTransformer(data); - return data; -}; - -export type ModelWithDatesArrayResponseTransformer = (data: any) => Promise; - -export const ModelWithDatesArrayResponseTransformer: ModelWithDatesArrayResponseTransformer = async (data) => { - if (Array.isArray(data)) { - data.forEach(ModelWithDatesModelResponseTransformer); - } - return data; -}; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-solid-query_transform/@tanstack/solid-query.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-solid-query_transform/@tanstack/solid-query.gen.ts.snap deleted file mode 100644 index 4218ca2c0..000000000 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-solid-query_transform/@tanstack/solid-query.gen.ts.snap +++ /dev/null @@ -1,110 +0,0 @@ -// This file is auto-generated by @hey-api/openapi-ts - -import type { Options } from '@hey-api/client-axios'; -import { queryOptions, type MutationOptions } from '@tanstack/solid-query'; -import type { ParentModelWithDatesError, ParentModelWithDatesResponse, ModelWithDatesError, ModelWithDatesResponse, ModelWithDatesArrayError, ModelWithDatesArrayResponse, ArrayOfDatesError, ArrayOfDatesResponse, DateError, DateResponse, MultipleResponsesError, MultipleResponsesResponse } from '../types.gen'; -import type { AxiosError } from 'axios'; -import { client, parentModelWithDates, modelWithDates, modelWithDatesArray, arrayOfDates, date, multipleResponses } from '../services.gen'; - -type QueryKey = [ - Pick & { - _id: string; - _infinite?: boolean; - } -]; - -const createQueryKey = (id: string, options?: TOptions, infinite?: boolean): QueryKey[0] => { - const params: QueryKey[0] = { _id: id, baseURL: (options?.client ?? client).getConfig().baseURL } as QueryKey[0]; - if (infinite) { - params._infinite = infinite; - } - if (options?.body) { - params.body = options.body; - } - if (options?.headers) { - params.headers = options.headers; - } - if (options?.path) { - params.path = options.path; - } - if (options?.query) { - params.query = options.query; - } - return params; -}; - -export const parentModelWithDatesQueryKey = (options?: Options) => [ - createQueryKey("parentModelWithDates", options) -]; - -export const parentModelWithDatesOptions = (options?: Options) => { return queryOptions({ - queryFn: async ({ queryKey }) => { - const { data } = await parentModelWithDates({ - ...options, - ...queryKey[0], - throwOnError: true - }); - return data; - }, - queryKey: parentModelWithDatesQueryKey(options) -}); }; - -export const parentModelWithDatesMutation = () => { const mutationOptions: MutationOptions, Options> = { - mutationFn: async (options) => { - const { data } = await parentModelWithDates({ - ...options, - throwOnError: true - }); - return data; - } -}; return mutationOptions; }; - -export const modelWithDatesMutation = () => { const mutationOptions: MutationOptions, Options> = { - mutationFn: async (options) => { - const { data } = await modelWithDates({ - ...options, - throwOnError: true - }); - return data; - } -}; return mutationOptions; }; - -export const modelWithDatesArrayMutation = () => { const mutationOptions: MutationOptions, Options> = { - mutationFn: async (options) => { - const { data } = await modelWithDatesArray({ - ...options, - throwOnError: true - }); - return data; - } -}; return mutationOptions; }; - -export const arrayOfDatesMutation = () => { const mutationOptions: MutationOptions, Options> = { - mutationFn: async (options) => { - const { data } = await arrayOfDates({ - ...options, - throwOnError: true - }); - return data; - } -}; return mutationOptions; }; - -export const dateMutation = () => { const mutationOptions: MutationOptions, Options> = { - mutationFn: async (options) => { - const { data } = await date({ - ...options, - throwOnError: true - }); - return data; - } -}; return mutationOptions; }; - -export const multipleResponsesMutation = () => { const mutationOptions: MutationOptions, Options> = { - mutationFn: async (options) => { - const { data } = await multipleResponses({ - ...options, - throwOnError: true - }); - return data; - } -}; return mutationOptions; }; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-solid-query_transform/services.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-solid-query_transform/services.gen.ts.snap deleted file mode 100644 index e41163f6d..000000000 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-solid-query_transform/services.gen.ts.snap +++ /dev/null @@ -1,39 +0,0 @@ -// This file is auto-generated by @hey-api/openapi-ts - -import { createClient, createConfig, type Options } from '@hey-api/client-axios'; -import { type ParentModelWithDatesError, type ParentModelWithDatesResponse, type ModelWithDatesError, type ModelWithDatesResponse, type ModelWithDatesArrayError, type ModelWithDatesArrayResponse, type ArrayOfDatesError, type ArrayOfDatesResponse, type DateError, type DateResponse, type MultipleResponsesError, type MultipleResponsesResponse, ParentModelWithDatesResponseTransformer, ModelWithDatesResponseTransformer, ModelWithDatesArrayResponseTransformer } from './types.gen'; - -export const client = createClient(createConfig()); - -export const parentModelWithDates = (options?: Options) => { return (options?.client ?? client).post({ - ...options, - url: '/api/model-with-dates', - responseTransformer: ParentModelWithDatesResponseTransformer -}); }; - -export const modelWithDates = (options?: Options) => { return (options?.client ?? client).put({ - ...options, - url: '/api/model-with-dates', - responseTransformer: ModelWithDatesResponseTransformer -}); }; - -export const modelWithDatesArray = (options?: Options) => { return (options?.client ?? client).put({ - ...options, - url: '/api/model-with-dates-array', - responseTransformer: ModelWithDatesArrayResponseTransformer -}); }; - -export const arrayOfDates = (options?: Options) => { return (options?.client ?? client).put({ - ...options, - url: '/api/array-of-dates' -}); }; - -export const date = (options?: Options) => { return (options?.client ?? client).put({ - ...options, - url: '/api/date' -}); }; - -export const multipleResponses = (options?: Options) => { return (options?.client ?? client).put({ - ...options, - url: '/api/multiple-responses' -}); }; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-solid-query_transform/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-solid-query_transform/types.gen.ts.snap deleted file mode 100644 index 4f5b1d77e..000000000 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-solid-query_transform/types.gen.ts.snap +++ /dev/null @@ -1,118 +0,0 @@ -// This file is auto-generated by @hey-api/openapi-ts - -/** - * This is a model that contains a some dates - */ -export type SimpleModel = { - id: number; - name: string; - readonly enabled: boolean; -}; - -/** - * This is a model that contains a some dates - */ -export type ModelWithDates = { - id: number; - name: string; - readonly enabled: boolean; - readonly modified: Date; - readonly expires?: Date; -}; - -/** - * This is a model that contains a some dates and arrays - */ -export type ParentModelWithDates = { - id: number; - readonly modified?: Date; - items?: Array; - item?: ModelWithDates; - 'nullable-date'?: Array<(Date | null)>; - simpleItems?: Array; - simpleItem?: SimpleModel; - dates?: Array<(Date)>; - strings?: Array<(string)>; -}; - -export type ParentModelWithDatesResponse = (ParentModelWithDates | unknown); - -export type ParentModelWithDatesError = unknown; - -export type ModelWithDatesResponse = (ModelWithDates); - -export type ModelWithDatesError = unknown; - -export type ModelWithDatesArrayResponse = (Array); - -export type ModelWithDatesArrayError = unknown; - -export type ArrayOfDatesResponse = (Array<(Date)>); - -export type ArrayOfDatesError = unknown; - -export type DateResponse = (Date); - -export type DateError = unknown; - -export type MultipleResponsesResponse = (Array | Array); - -export type MultipleResponsesError = unknown; - -export type ParentModelWithDatesResponseTransformer = (data: any) => Promise; - -export type ParentModelWithDatesModelResponseTransformer = (data: any) => ParentModelWithDates; - -export type ModelWithDatesModelResponseTransformer = (data: any) => ModelWithDates; - -export const ModelWithDatesModelResponseTransformer: ModelWithDatesModelResponseTransformer = data => { - if (data?.modified) { - data.modified = new Date(data.modified); - } - if (data?.expires) { - data.expires = new Date(data.expires); - } - return data; -}; - -export const ParentModelWithDatesModelResponseTransformer: ParentModelWithDatesModelResponseTransformer = data => { - if (data?.modified) { - data.modified = new Date(data.modified); - } - if (Array.isArray(data?.items)) { - data.items.forEach(ModelWithDatesModelResponseTransformer); - } - if (data?.item) { - ModelWithDatesModelResponseTransformer(data.item); - } - if (Array.isArray(data?.['nullable-date'])) { - data['nullable-date'] = data['nullable-date'].map(item => item ? new Date(item) : item); - } - if (Array.isArray(data?.dates)) { - data.dates = data.dates.map(item => item ? new Date(item) : item); - } - return data; -}; - -export const ParentModelWithDatesResponseTransformer: ParentModelWithDatesResponseTransformer = async (data) => { - if (data) { - ParentModelWithDatesModelResponseTransformer(data); - } - return data; -}; - -export type ModelWithDatesResponseTransformer = (data: any) => Promise; - -export const ModelWithDatesResponseTransformer: ModelWithDatesResponseTransformer = async (data) => { - ModelWithDatesModelResponseTransformer(data); - return data; -}; - -export type ModelWithDatesArrayResponseTransformer = (data: any) => Promise; - -export const ModelWithDatesArrayResponseTransformer: ModelWithDatesArrayResponseTransformer = async (data) => { - if (Array.isArray(data)) { - data.forEach(ModelWithDatesModelResponseTransformer); - } - return data; -}; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-svelte-query_transform/@tanstack/svelte-query.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-svelte-query_transform/@tanstack/svelte-query.gen.ts.snap deleted file mode 100644 index f92598833..000000000 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-svelte-query_transform/@tanstack/svelte-query.gen.ts.snap +++ /dev/null @@ -1,110 +0,0 @@ -// This file is auto-generated by @hey-api/openapi-ts - -import type { Options } from '@hey-api/client-axios'; -import { queryOptions, type MutationOptions } from '@tanstack/svelte-query'; -import type { ParentModelWithDatesError, ParentModelWithDatesResponse, ModelWithDatesError, ModelWithDatesResponse, ModelWithDatesArrayError, ModelWithDatesArrayResponse, ArrayOfDatesError, ArrayOfDatesResponse, DateError, DateResponse, MultipleResponsesError, MultipleResponsesResponse } from '../types.gen'; -import type { AxiosError } from 'axios'; -import { client, parentModelWithDates, modelWithDates, modelWithDatesArray, arrayOfDates, date, multipleResponses } from '../services.gen'; - -type QueryKey = [ - Pick & { - _id: string; - _infinite?: boolean; - } -]; - -const createQueryKey = (id: string, options?: TOptions, infinite?: boolean): QueryKey[0] => { - const params: QueryKey[0] = { _id: id, baseURL: (options?.client ?? client).getConfig().baseURL } as QueryKey[0]; - if (infinite) { - params._infinite = infinite; - } - if (options?.body) { - params.body = options.body; - } - if (options?.headers) { - params.headers = options.headers; - } - if (options?.path) { - params.path = options.path; - } - if (options?.query) { - params.query = options.query; - } - return params; -}; - -export const parentModelWithDatesQueryKey = (options?: Options) => [ - createQueryKey("parentModelWithDates", options) -]; - -export const parentModelWithDatesOptions = (options?: Options) => { return queryOptions({ - queryFn: async ({ queryKey }) => { - const { data } = await parentModelWithDates({ - ...options, - ...queryKey[0], - throwOnError: true - }); - return data; - }, - queryKey: parentModelWithDatesQueryKey(options) -}); }; - -export const parentModelWithDatesMutation = () => { const mutationOptions: MutationOptions, Options> = { - mutationFn: async (options) => { - const { data } = await parentModelWithDates({ - ...options, - throwOnError: true - }); - return data; - } -}; return mutationOptions; }; - -export const modelWithDatesMutation = () => { const mutationOptions: MutationOptions, Options> = { - mutationFn: async (options) => { - const { data } = await modelWithDates({ - ...options, - throwOnError: true - }); - return data; - } -}; return mutationOptions; }; - -export const modelWithDatesArrayMutation = () => { const mutationOptions: MutationOptions, Options> = { - mutationFn: async (options) => { - const { data } = await modelWithDatesArray({ - ...options, - throwOnError: true - }); - return data; - } -}; return mutationOptions; }; - -export const arrayOfDatesMutation = () => { const mutationOptions: MutationOptions, Options> = { - mutationFn: async (options) => { - const { data } = await arrayOfDates({ - ...options, - throwOnError: true - }); - return data; - } -}; return mutationOptions; }; - -export const dateMutation = () => { const mutationOptions: MutationOptions, Options> = { - mutationFn: async (options) => { - const { data } = await date({ - ...options, - throwOnError: true - }); - return data; - } -}; return mutationOptions; }; - -export const multipleResponsesMutation = () => { const mutationOptions: MutationOptions, Options> = { - mutationFn: async (options) => { - const { data } = await multipleResponses({ - ...options, - throwOnError: true - }); - return data; - } -}; return mutationOptions; }; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-svelte-query_transform/services.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-svelte-query_transform/services.gen.ts.snap deleted file mode 100644 index e41163f6d..000000000 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-svelte-query_transform/services.gen.ts.snap +++ /dev/null @@ -1,39 +0,0 @@ -// This file is auto-generated by @hey-api/openapi-ts - -import { createClient, createConfig, type Options } from '@hey-api/client-axios'; -import { type ParentModelWithDatesError, type ParentModelWithDatesResponse, type ModelWithDatesError, type ModelWithDatesResponse, type ModelWithDatesArrayError, type ModelWithDatesArrayResponse, type ArrayOfDatesError, type ArrayOfDatesResponse, type DateError, type DateResponse, type MultipleResponsesError, type MultipleResponsesResponse, ParentModelWithDatesResponseTransformer, ModelWithDatesResponseTransformer, ModelWithDatesArrayResponseTransformer } from './types.gen'; - -export const client = createClient(createConfig()); - -export const parentModelWithDates = (options?: Options) => { return (options?.client ?? client).post({ - ...options, - url: '/api/model-with-dates', - responseTransformer: ParentModelWithDatesResponseTransformer -}); }; - -export const modelWithDates = (options?: Options) => { return (options?.client ?? client).put({ - ...options, - url: '/api/model-with-dates', - responseTransformer: ModelWithDatesResponseTransformer -}); }; - -export const modelWithDatesArray = (options?: Options) => { return (options?.client ?? client).put({ - ...options, - url: '/api/model-with-dates-array', - responseTransformer: ModelWithDatesArrayResponseTransformer -}); }; - -export const arrayOfDates = (options?: Options) => { return (options?.client ?? client).put({ - ...options, - url: '/api/array-of-dates' -}); }; - -export const date = (options?: Options) => { return (options?.client ?? client).put({ - ...options, - url: '/api/date' -}); }; - -export const multipleResponses = (options?: Options) => { return (options?.client ?? client).put({ - ...options, - url: '/api/multiple-responses' -}); }; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-svelte-query_transform/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-svelte-query_transform/types.gen.ts.snap deleted file mode 100644 index 4f5b1d77e..000000000 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-svelte-query_transform/types.gen.ts.snap +++ /dev/null @@ -1,118 +0,0 @@ -// This file is auto-generated by @hey-api/openapi-ts - -/** - * This is a model that contains a some dates - */ -export type SimpleModel = { - id: number; - name: string; - readonly enabled: boolean; -}; - -/** - * This is a model that contains a some dates - */ -export type ModelWithDates = { - id: number; - name: string; - readonly enabled: boolean; - readonly modified: Date; - readonly expires?: Date; -}; - -/** - * This is a model that contains a some dates and arrays - */ -export type ParentModelWithDates = { - id: number; - readonly modified?: Date; - items?: Array; - item?: ModelWithDates; - 'nullable-date'?: Array<(Date | null)>; - simpleItems?: Array; - simpleItem?: SimpleModel; - dates?: Array<(Date)>; - strings?: Array<(string)>; -}; - -export type ParentModelWithDatesResponse = (ParentModelWithDates | unknown); - -export type ParentModelWithDatesError = unknown; - -export type ModelWithDatesResponse = (ModelWithDates); - -export type ModelWithDatesError = unknown; - -export type ModelWithDatesArrayResponse = (Array); - -export type ModelWithDatesArrayError = unknown; - -export type ArrayOfDatesResponse = (Array<(Date)>); - -export type ArrayOfDatesError = unknown; - -export type DateResponse = (Date); - -export type DateError = unknown; - -export type MultipleResponsesResponse = (Array | Array); - -export type MultipleResponsesError = unknown; - -export type ParentModelWithDatesResponseTransformer = (data: any) => Promise; - -export type ParentModelWithDatesModelResponseTransformer = (data: any) => ParentModelWithDates; - -export type ModelWithDatesModelResponseTransformer = (data: any) => ModelWithDates; - -export const ModelWithDatesModelResponseTransformer: ModelWithDatesModelResponseTransformer = data => { - if (data?.modified) { - data.modified = new Date(data.modified); - } - if (data?.expires) { - data.expires = new Date(data.expires); - } - return data; -}; - -export const ParentModelWithDatesModelResponseTransformer: ParentModelWithDatesModelResponseTransformer = data => { - if (data?.modified) { - data.modified = new Date(data.modified); - } - if (Array.isArray(data?.items)) { - data.items.forEach(ModelWithDatesModelResponseTransformer); - } - if (data?.item) { - ModelWithDatesModelResponseTransformer(data.item); - } - if (Array.isArray(data?.['nullable-date'])) { - data['nullable-date'] = data['nullable-date'].map(item => item ? new Date(item) : item); - } - if (Array.isArray(data?.dates)) { - data.dates = data.dates.map(item => item ? new Date(item) : item); - } - return data; -}; - -export const ParentModelWithDatesResponseTransformer: ParentModelWithDatesResponseTransformer = async (data) => { - if (data) { - ParentModelWithDatesModelResponseTransformer(data); - } - return data; -}; - -export type ModelWithDatesResponseTransformer = (data: any) => Promise; - -export const ModelWithDatesResponseTransformer: ModelWithDatesResponseTransformer = async (data) => { - ModelWithDatesModelResponseTransformer(data); - return data; -}; - -export type ModelWithDatesArrayResponseTransformer = (data: any) => Promise; - -export const ModelWithDatesArrayResponseTransformer: ModelWithDatesArrayResponseTransformer = async (data) => { - if (Array.isArray(data)) { - data.forEach(ModelWithDatesModelResponseTransformer); - } - return data; -}; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-vue-query_transform/@tanstack/vue-query.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-vue-query_transform/@tanstack/vue-query.gen.ts.snap deleted file mode 100644 index c3cdb4906..000000000 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-vue-query_transform/@tanstack/vue-query.gen.ts.snap +++ /dev/null @@ -1,110 +0,0 @@ -// This file is auto-generated by @hey-api/openapi-ts - -import type { Options } from '@hey-api/client-axios'; -import { queryOptions, type UseMutationOptions } from '@tanstack/vue-query'; -import type { ParentModelWithDatesError, ParentModelWithDatesResponse, ModelWithDatesError, ModelWithDatesResponse, ModelWithDatesArrayError, ModelWithDatesArrayResponse, ArrayOfDatesError, ArrayOfDatesResponse, DateError, DateResponse, MultipleResponsesError, MultipleResponsesResponse } from '../types.gen'; -import type { AxiosError } from 'axios'; -import { client, parentModelWithDates, modelWithDates, modelWithDatesArray, arrayOfDates, date, multipleResponses } from '../services.gen'; - -type QueryKey = [ - Pick & { - _id: string; - _infinite?: boolean; - } -]; - -const createQueryKey = (id: string, options?: TOptions, infinite?: boolean): QueryKey[0] => { - const params: QueryKey[0] = { _id: id, baseURL: (options?.client ?? client).getConfig().baseURL } as QueryKey[0]; - if (infinite) { - params._infinite = infinite; - } - if (options?.body) { - params.body = options.body; - } - if (options?.headers) { - params.headers = options.headers; - } - if (options?.path) { - params.path = options.path; - } - if (options?.query) { - params.query = options.query; - } - return params; -}; - -export const parentModelWithDatesQueryKey = (options?: Options) => [ - createQueryKey("parentModelWithDates", options) -]; - -export const parentModelWithDatesOptions = (options?: Options) => { return queryOptions({ - queryFn: async ({ queryKey }) => { - const { data } = await parentModelWithDates({ - ...options, - ...queryKey[0], - throwOnError: true - }); - return data; - }, - queryKey: parentModelWithDatesQueryKey(options) -}); }; - -export const parentModelWithDatesMutation = () => { const mutationOptions: UseMutationOptions, Options> = { - mutationFn: async (options) => { - const { data } = await parentModelWithDates({ - ...options, - throwOnError: true - }); - return data; - } -}; return mutationOptions; }; - -export const modelWithDatesMutation = () => { const mutationOptions: UseMutationOptions, Options> = { - mutationFn: async (options) => { - const { data } = await modelWithDates({ - ...options, - throwOnError: true - }); - return data; - } -}; return mutationOptions; }; - -export const modelWithDatesArrayMutation = () => { const mutationOptions: UseMutationOptions, Options> = { - mutationFn: async (options) => { - const { data } = await modelWithDatesArray({ - ...options, - throwOnError: true - }); - return data; - } -}; return mutationOptions; }; - -export const arrayOfDatesMutation = () => { const mutationOptions: UseMutationOptions, Options> = { - mutationFn: async (options) => { - const { data } = await arrayOfDates({ - ...options, - throwOnError: true - }); - return data; - } -}; return mutationOptions; }; - -export const dateMutation = () => { const mutationOptions: UseMutationOptions, Options> = { - mutationFn: async (options) => { - const { data } = await date({ - ...options, - throwOnError: true - }); - return data; - } -}; return mutationOptions; }; - -export const multipleResponsesMutation = () => { const mutationOptions: UseMutationOptions, Options> = { - mutationFn: async (options) => { - const { data } = await multipleResponses({ - ...options, - throwOnError: true - }); - return data; - } -}; return mutationOptions; }; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-vue-query_transform/services.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-vue-query_transform/services.gen.ts.snap deleted file mode 100644 index e41163f6d..000000000 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-vue-query_transform/services.gen.ts.snap +++ /dev/null @@ -1,39 +0,0 @@ -// This file is auto-generated by @hey-api/openapi-ts - -import { createClient, createConfig, type Options } from '@hey-api/client-axios'; -import { type ParentModelWithDatesError, type ParentModelWithDatesResponse, type ModelWithDatesError, type ModelWithDatesResponse, type ModelWithDatesArrayError, type ModelWithDatesArrayResponse, type ArrayOfDatesError, type ArrayOfDatesResponse, type DateError, type DateResponse, type MultipleResponsesError, type MultipleResponsesResponse, ParentModelWithDatesResponseTransformer, ModelWithDatesResponseTransformer, ModelWithDatesArrayResponseTransformer } from './types.gen'; - -export const client = createClient(createConfig()); - -export const parentModelWithDates = (options?: Options) => { return (options?.client ?? client).post({ - ...options, - url: '/api/model-with-dates', - responseTransformer: ParentModelWithDatesResponseTransformer -}); }; - -export const modelWithDates = (options?: Options) => { return (options?.client ?? client).put({ - ...options, - url: '/api/model-with-dates', - responseTransformer: ModelWithDatesResponseTransformer -}); }; - -export const modelWithDatesArray = (options?: Options) => { return (options?.client ?? client).put({ - ...options, - url: '/api/model-with-dates-array', - responseTransformer: ModelWithDatesArrayResponseTransformer -}); }; - -export const arrayOfDates = (options?: Options) => { return (options?.client ?? client).put({ - ...options, - url: '/api/array-of-dates' -}); }; - -export const date = (options?: Options) => { return (options?.client ?? client).put({ - ...options, - url: '/api/date' -}); }; - -export const multipleResponses = (options?: Options) => { return (options?.client ?? client).put({ - ...options, - url: '/api/multiple-responses' -}); }; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-vue-query_transform/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-vue-query_transform/types.gen.ts.snap deleted file mode 100644 index 4f5b1d77e..000000000 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-plugin-tanstack-vue-query_transform/types.gen.ts.snap +++ /dev/null @@ -1,118 +0,0 @@ -// This file is auto-generated by @hey-api/openapi-ts - -/** - * This is a model that contains a some dates - */ -export type SimpleModel = { - id: number; - name: string; - readonly enabled: boolean; -}; - -/** - * This is a model that contains a some dates - */ -export type ModelWithDates = { - id: number; - name: string; - readonly enabled: boolean; - readonly modified: Date; - readonly expires?: Date; -}; - -/** - * This is a model that contains a some dates and arrays - */ -export type ParentModelWithDates = { - id: number; - readonly modified?: Date; - items?: Array; - item?: ModelWithDates; - 'nullable-date'?: Array<(Date | null)>; - simpleItems?: Array; - simpleItem?: SimpleModel; - dates?: Array<(Date)>; - strings?: Array<(string)>; -}; - -export type ParentModelWithDatesResponse = (ParentModelWithDates | unknown); - -export type ParentModelWithDatesError = unknown; - -export type ModelWithDatesResponse = (ModelWithDates); - -export type ModelWithDatesError = unknown; - -export type ModelWithDatesArrayResponse = (Array); - -export type ModelWithDatesArrayError = unknown; - -export type ArrayOfDatesResponse = (Array<(Date)>); - -export type ArrayOfDatesError = unknown; - -export type DateResponse = (Date); - -export type DateError = unknown; - -export type MultipleResponsesResponse = (Array | Array); - -export type MultipleResponsesError = unknown; - -export type ParentModelWithDatesResponseTransformer = (data: any) => Promise; - -export type ParentModelWithDatesModelResponseTransformer = (data: any) => ParentModelWithDates; - -export type ModelWithDatesModelResponseTransformer = (data: any) => ModelWithDates; - -export const ModelWithDatesModelResponseTransformer: ModelWithDatesModelResponseTransformer = data => { - if (data?.modified) { - data.modified = new Date(data.modified); - } - if (data?.expires) { - data.expires = new Date(data.expires); - } - return data; -}; - -export const ParentModelWithDatesModelResponseTransformer: ParentModelWithDatesModelResponseTransformer = data => { - if (data?.modified) { - data.modified = new Date(data.modified); - } - if (Array.isArray(data?.items)) { - data.items.forEach(ModelWithDatesModelResponseTransformer); - } - if (data?.item) { - ModelWithDatesModelResponseTransformer(data.item); - } - if (Array.isArray(data?.['nullable-date'])) { - data['nullable-date'] = data['nullable-date'].map(item => item ? new Date(item) : item); - } - if (Array.isArray(data?.dates)) { - data.dates = data.dates.map(item => item ? new Date(item) : item); - } - return data; -}; - -export const ParentModelWithDatesResponseTransformer: ParentModelWithDatesResponseTransformer = async (data) => { - if (data) { - ParentModelWithDatesModelResponseTransformer(data); - } - return data; -}; - -export type ModelWithDatesResponseTransformer = (data: any) => Promise; - -export const ModelWithDatesResponseTransformer: ModelWithDatesResponseTransformer = async (data) => { - ModelWithDatesModelResponseTransformer(data); - return data; -}; - -export type ModelWithDatesArrayResponseTransformer = (data: any) => Promise; - -export const ModelWithDatesArrayResponseTransformer: ModelWithDatesArrayResponseTransformer = async (data) => { - if (Array.isArray(data)) { - data.forEach(ModelWithDatesModelResponseTransformer); - } - return data; -}; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-react-query/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-react-query/types.gen.ts.snap deleted file mode 100644 index c0c16d891..000000000 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-react-query/types.gen.ts.snap +++ /dev/null @@ -1,1630 +0,0 @@ -// This file is auto-generated by @hey-api/openapi-ts - -/** - * Model with number-only name - */ -export type _400 = string; - -/** - * Testing multiline comments in string: First line - * Second line - * - * Fourth line - */ -export type camelCaseCommentWithBreaks = number; - -/** - * Testing multiline comments in string: First line - * Second line - * - * Fourth line - */ -export type CommentWithBreaks = number; - -/** - * Testing backticks in string: `backticks` and ```multiple backticks``` should work - */ -export type CommentWithBackticks = number; - -/** - * Testing backticks and quotes in string: `backticks`, 'quotes', "double quotes" and ```multiple backticks``` should work - */ -export type CommentWithBackticksAndQuotes = number; - -/** - * Testing slashes in string: \backwards\\\ and /forwards/// should work - */ -export type CommentWithSlashes = number; - -/** - * Testing expression placeholders in string: ${expression} should work - */ -export type CommentWithExpressionPlaceholders = number; - -/** - * Testing quotes in string: 'single quote''' and "double quotes""" should work - */ -export type CommentWithQuotes = number; - -/** - * Testing reserved characters in string: * inline * and ** inline ** should work - */ -export type CommentWithReservedCharacters = number; - -/** - * This is a simple number - */ -export type SimpleInteger = number; - -/** - * This is a simple boolean - */ -export type SimpleBoolean = boolean; - -/** - * This is a simple string - */ -export type SimpleString = string; - -/** - * A string with non-ascii (unicode) characters valid in typescript identifiers (æøåÆØÅöÔèÈ字符串) - */ -export type NonAsciiStringæøåÆØÅöôêÊ字符串 = string; - -/** - * This is a simple file - */ -export type SimpleFile = (Blob | File); - -/** - * This is a simple reference - */ -export type SimpleReference = ModelWithString; - -/** - * This is a simple string - */ -export type SimpleStringWithPattern = (string) | null; - -/** - * This is a simple enum with strings - */ -export type EnumWithStrings = 'Success' | 'Warning' | 'Error' | "'Single Quote'" | '"Double Quotes"' | 'Non-ascii: øæåôöØÆÅÔÖ字符串'; - -/** - * This is a simple enum with strings - */ -export const EnumWithStrings = { - SUCCESS: 'Success', - WARNING: 'Warning', - ERROR: 'Error', - _SINGLE_QUOTE_: "'Single Quote'", - _DOUBLE_QUOTES_: '"Double Quotes"', - 'NON_ASCII__ØÆÅÔÖ_ØÆÅÔÖ字符串': 'Non-ascii: øæåôöØÆÅÔÖ字符串' -} as const; - -export type EnumWithReplacedCharacters = "'Single Quote'" | '"Double Quotes"' | 'øæåôöØÆÅÔÖ字符串' | 3.1 | ''; - -export const EnumWithReplacedCharacters = { - _SINGLE_QUOTE_: "'Single Quote'", - _DOUBLE_QUOTES_: '"Double Quotes"', - 'ØÆÅÔÖ_ØÆÅÔÖ字符串': 'øæåôöØÆÅÔÖ字符串', - '_3.1': 3.1, - EMPTY_STRING: '' -} as const; - -/** - * This is a simple enum with numbers - */ -export type EnumWithNumbers = 1 | 2 | 3 | 1.1 | 1.2 | 1.3 | 100 | 200 | 300 | -100 | -200 | -300 | -1.1 | -1.2 | -1.3; - -/** - * This is a simple enum with numbers - */ -export const EnumWithNumbers = { - '_1': 1, - '_2': 2, - '_3': 3, - '_1.1': 1.1, - '_1.2': 1.2, - '_1.3': 1.3, - '_100': 100, - '_200': 200, - '_300': 300, - '_-100': -100, - '_-200': -200, - '_-300': -300, - '_-1.1': -1.1, - '_-1.2': -1.2, - '_-1.3': -1.3 -} as const; - -/** - * Success=1,Warning=2,Error=3 - */ -export type EnumFromDescription = number; - -/** - * This is a simple enum with numbers - */ -export type EnumWithExtensions = 200 | 400 | 500; - -/** - * This is a simple enum with numbers - */ -export const EnumWithExtensions = { - /** - * Used when the status of something is successful - */ - CUSTOM_SUCCESS: 200, - /** - * Used when the status of something has a warning - */ - CUSTOM_WARNING: 400, - /** - * Used when the status of something has an error - */ - CUSTOM_ERROR: 500 -} as const; - -export type EnumWithXEnumNames = 0 | 1 | 2; - -export const EnumWithXEnumNames = { - zero: 0, - one: 1, - two: 2 -} as const; - -/** - * This is a simple array with numbers - */ -export type ArrayWithNumbers = Array<(number)>; - -/** - * This is a simple array with booleans - */ -export type ArrayWithBooleans = Array<(boolean)>; - -/** - * This is a simple array with strings - */ -export type ArrayWithStrings = Array<(string)>; - -/** - * This is a simple array with references - */ -export type ArrayWithReferences = Array; - -/** - * This is a simple array containing an array - */ -export type ArrayWithArray = Array>; - -/** - * This is a simple array with properties - */ -export type ArrayWithProperties = Array<{ - '16x16'?: camelCaseCommentWithBreaks; - bar?: string; -}>; - -/** - * This is a simple array with any of properties - */ -export type ArrayWithAnyOfProperties = Array<({ - foo?: string; -} | { - bar?: string; -})>; - -export type AnyOfAnyAndNull = { - data?: (unknown | null); -}; - -/** - * This is a simple array with any of properties - */ -export type AnyOfArrays = { - results?: Array<({ - foo?: string; -} | { - bar?: string; -})>; -}; - -/** - * This is a string dictionary - */ -export type DictionaryWithString = { - [key: string]: (string); -}; - -export type DictionaryWithPropertiesAndAdditionalProperties = { - foo?: number; - bar?: boolean; - [key: string]: (string | number | boolean) | undefined; -}; - -/** - * This is a string reference - */ -export type DictionaryWithReference = { - [key: string]: ModelWithString; -}; - -/** - * This is a complex dictionary - */ -export type DictionaryWithArray = { - [key: string]: Array; -}; - -/** - * This is a string dictionary - */ -export type DictionaryWithDictionary = { - [key: string]: { - [key: string]: (string); - }; -}; - -/** - * This is a complex dictionary - */ -export type DictionaryWithProperties = { - [key: string]: { - foo?: string; - bar?: string; - }; -}; - -/** - * This is a model with one number property - */ -export type ModelWithInteger = { - /** - * This is a simple number property - */ - prop?: number; -}; - -/** - * This is a model with one boolean property - */ -export type ModelWithBoolean = { - /** - * This is a simple boolean property - */ - prop?: boolean; -}; - -/** - * This is a model with one string property - */ -export type ModelWithString = { - /** - * This is a simple string property - */ - prop?: string; -}; - -/** - * This is a model with one string property - */ -export type ModelWithStringError = { - /** - * This is a simple string property - */ - prop?: string; -}; - -/** - * `Comment` or `VoiceComment`. The JSON object for adding voice comments to tickets is different. See [Adding voice comments to tickets](/documentation/ticketing/managing-tickets/adding-voice-comments-to-tickets) - */ -export type Model_From_Zendesk = string; - -/** - * This is a model with one string property - */ -export type ModelWithNullableString = { - /** - * This is a simple string property - */ - nullableProp1?: (string) | null; - /** - * This is a simple string property - */ - nullableRequiredProp1: (string) | null; - /** - * This is a simple string property - */ - nullableProp2?: (string) | null; - /** - * This is a simple string property - */ - nullableRequiredProp2: (string) | null; - /** - * This is a simple enum with strings - */ - 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; -}; - -/** - * This is a simple enum with strings - */ -export type foo_bar_enum = 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; - -/** - * This is a simple enum with strings - */ -export const foo_bar_enum = { - SUCCESS: 'Success', - WARNING: 'Warning', - ERROR: 'Error', - 'ØÆÅ字符串': 'ØÆÅ字符串' -} as const; - -/** - * This is a model with one enum - */ -export type ModelWithEnum = { - /** - * This is a simple enum with strings - */ - 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; - /** - * These are the HTTP error code enums - */ - statusCode?: '100' | '200 FOO' | '300 FOO_BAR' | '400 foo-bar' | '500 foo.bar' | '600 foo&bar'; - /** - * Simple boolean enum - */ - bool?: boolean; -}; - -/** - * These are the HTTP error code enums - */ -export type statusCode = '100' | '200 FOO' | '300 FOO_BAR' | '400 foo-bar' | '500 foo.bar' | '600 foo&bar'; - -/** - * These are the HTTP error code enums - */ -export const statusCode = { - _100: '100', - _200_FOO: '200 FOO', - _300_FOO_BAR: '300 FOO_BAR', - _400_FOO_BAR: '400 foo-bar', - _500_FOO_BAR: '500 foo.bar', - _600_FOO_BAR: '600 foo&bar' -} as const; - -/** - * This is a model with one enum with escaped name - */ -export type ModelWithEnumWithHyphen = { - 'foo-bar-baz-qux'?: '3.0'; -}; - -export type foo_bar_baz_qux = '3.0'; - -export const foo_bar_baz_qux = { - _3_0: '3.0' -} as const; - -/** - * This is a model with one enum - */ -export type ModelWithEnumFromDescription = { - /** - * Success=1,Warning=2,Error=3 - */ - test?: number; -}; - -/** - * This is a model with nested enums - */ -export type ModelWithNestedEnums = { - dictionaryWithEnum?: { - [key: string]: ('Success' | 'Warning' | 'Error'); - }; - dictionaryWithEnumFromDescription?: { - [key: string]: (number); - }; - arrayWithEnum?: Array<('Success' | 'Warning' | 'Error')>; - arrayWithDescription?: Array<(number)>; - /** - * This is a simple enum with strings - */ - 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; -}; - -/** - * This is a model with one property containing a reference - */ -export type ModelWithReference = { - prop?: ModelWithProperties; -}; - -/** - * This is a model with one property containing an array - */ -export type ModelWithArrayReadOnlyAndWriteOnly = { - prop?: Array; - propWithFile?: Array<((Blob | File))>; - propWithNumber?: Array<(number)>; -}; - -/** - * This is a model with one property containing an array - */ -export type ModelWithArray = { - prop?: Array; - propWithFile?: Array<((Blob | File))>; - propWithNumber?: Array<(number)>; -}; - -/** - * This is a model with one property containing a dictionary - */ -export type ModelWithDictionary = { - prop?: { - [key: string]: (string); - }; -}; - -/** - * This is a deprecated model with a deprecated property - * @deprecated - */ -export type DeprecatedModel = { - /** - * This is a deprecated property - * @deprecated - */ - prop?: string; -}; - -/** - * This is a model with one property containing a circular reference - */ -export type ModelWithCircularReference = { - prop?: ModelWithCircularReference; -}; - -/** - * This is a model with one property with a 'one of' relationship - */ -export type CompositionWithOneOf = { - propA?: (ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary); -}; - -/** - * This is a model with one property with a 'one of' relationship where the options are not $ref - */ -export type CompositionWithOneOfAnonymous = { - propA?: ({ - propA?: string; -} | string | number); -}; - -/** - * Circle - */ -export type ModelCircle = { - kind: 'circle'; - radius?: number; -}; - -/** - * Square - */ -export type ModelSquare = { - kind: 'square'; - sideLength?: number; -}; - -/** - * This is a model with one property with a 'one of' relationship where the options are not $ref - */ -export type CompositionWithOneOfDiscriminator = ModelCircle | ModelSquare; - -/** - * This is a model with one property with a 'any of' relationship - */ -export type CompositionWithAnyOf = { - propA?: (ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary); -}; - -/** - * This is a model with one property with a 'any of' relationship where the options are not $ref - */ -export type CompositionWithAnyOfAnonymous = { - propA?: ({ - propA?: string; -} | string | number); -}; - -/** - * This is a model with nested 'any of' property with a type null - */ -export type CompositionWithNestedAnyAndTypeNull = { - propA?: (Array<(ModelWithDictionary | null)> | Array<(ModelWithArray | null)>); -}; - -export type _3e_num_1Период = 'Bird' | 'Dog'; - -export const _3e_num_1Период = { - BIRD: 'Bird', - DOG: 'Dog' -} as const; - -export type ConstValue = "ConstValue"; - -/** - * This is a model with one property with a 'any of' relationship where the options are not $ref - */ -export type CompositionWithNestedAnyOfAndNull = { - propA?: (Array<(_3e_num_1Период | ConstValue)> | null); -}; - -/** - * This is a model with one property with a 'one of' relationship - */ -export type CompositionWithOneOfAndNullable = { - propA?: (({ - boolean?: boolean; -} | ModelWithEnum | ModelWithArray | ModelWithDictionary) | null); -}; - -/** - * This is a model that contains a simple dictionary within composition - */ -export type CompositionWithOneOfAndSimpleDictionary = { - propA?: (boolean | { - [key: string]: (number); -}); -}; - -/** - * This is a model that contains a dictionary of simple arrays within composition - */ -export type CompositionWithOneOfAndSimpleArrayDictionary = { - propA?: (boolean | { - [key: string]: Array<(boolean)>; -}); -}; - -/** - * This is a model that contains a dictionary of complex arrays (composited) within composition - */ -export type CompositionWithOneOfAndComplexArrayDictionary = { - propA?: (boolean | { - [key: string]: Array<(number | string)>; -}); -}; - -/** - * This is a model with one property with a 'all of' relationship - */ -export type CompositionWithAllOfAndNullable = { - propA?: (({ - boolean?: boolean; -} & ModelWithEnum & ModelWithArray & ModelWithDictionary) | null); -}; - -/** - * This is a model with one property with a 'any of' relationship - */ -export type CompositionWithAnyOfAndNullable = { - propA?: (({ - boolean?: boolean; -} | ModelWithEnum | ModelWithArray | ModelWithDictionary) | null); -}; - -/** - * This is a base model with two simple optional properties - */ -export type CompositionBaseModel = { - firstName?: string; - lastname?: string; -}; - -/** - * This is a model that extends the base model - */ -export type CompositionExtendedModel = CompositionBaseModel & { - firstName: string; - lastname: string; - age: number; -}; - -/** - * This is a model with one nested property - */ -export type ModelWithProperties = { - required: string; - readonly requiredAndReadOnly: string; - requiredAndNullable: (string) | null; - string?: string; - number?: number; - boolean?: boolean; - reference?: ModelWithString; - 'property with space'?: string; - default?: string; - try?: string; - readonly '@namespace.string'?: string; - readonly '@namespace.integer'?: number; -}; - -/** - * This is a model with one nested property - */ -export type ModelWithNestedProperties = { - readonly first: { - readonly second: { - readonly third: (string) | null; - } | null; - } | null; -}; - -/** - * This is a model with duplicated properties - */ -export type ModelWithDuplicateProperties = { - prop?: ModelWithString; -}; - -/** - * This is a model with ordered properties - */ -export type ModelWithOrderedProperties = { - zebra?: string; - apple?: string; - hawaii?: string; -}; - -/** - * This is a model with duplicated imports - */ -export type ModelWithDuplicateImports = { - propA?: ModelWithString; - propB?: ModelWithString; - propC?: ModelWithString; -}; - -/** - * This is a model that extends another model - */ -export type ModelThatExtends = ModelWithString & { - propExtendsA?: string; - propExtendsB?: ModelWithString; -}; - -/** - * This is a model that extends another model - */ -export type ModelThatExtendsExtends = ModelWithString & ModelThatExtends & { - propExtendsC?: string; - propExtendsD?: ModelWithString; -}; - -/** - * This is a model that contains a some patterns - */ -export type ModelWithPattern = { - key: string; - name: string; - readonly enabled?: boolean; - readonly modified?: string; - id?: string; - text?: string; - patternWithSingleQuotes?: string; - patternWithNewline?: string; - patternWithBacktick?: string; -}; - -export type File = { - readonly id?: string; - readonly updated_at?: string; - readonly created_at?: string; - mime: string; - readonly file?: string; -}; - -export type _default = { - name?: string; -}; - -export type Pageable = { - page?: number; - size?: number; - sort?: Array<(string)>; -}; - -/** - * This is a free-form object without additionalProperties. - */ -export type FreeFormObjectWithoutAdditionalProperties = { - [key: string]: unknown; -}; - -/** - * This is a free-form object with additionalProperties: true. - */ -export type FreeFormObjectWithAdditionalPropertiesEqTrue = { - [key: string]: unknown; -}; - -/** - * This is a free-form object with additionalProperties: {}. - */ -export type FreeFormObjectWithAdditionalPropertiesEqEmptyObject = { - [key: string]: unknown; -}; - -export type ModelWithConst = { - String?: "String"; - number?: 0; - null?: null; - withType?: "Some string"; -}; - -/** - * This is a model with one property and additionalProperties: true - */ -export type ModelWithAdditionalPropertiesEqTrue = { - /** - * This is a simple string property - */ - prop?: string; - [key: string]: unknown | string; -}; - -export type NestedAnyOfArraysNullable = { - nullableArray?: (Array<(string | boolean)> | null); -}; - -export type CompositionWithOneOfAndProperties = ({ - foo: ParameterSimpleParameter; -} | { - bar: NonAsciiStringæøåÆØÅöôêÊ字符串; -}) & { - baz: (number) | null; - qux: number; -}; - -/** - * An object that can be null - */ -export type NullableObject = { - foo?: string; -} | null; - -/** - * Some % character - */ -export type CharactersInDescription = string; - -export type ModelWithNullableObject = { - data?: NullableObject; -}; - -export type ModelWithOneOfEnum = { - foo: 'Bar'; -} | { - foo: 'Baz'; -} | { - foo: 'Qux'; -} | { - content: string; - foo: 'Quux'; -} | { - content: [ - (string), - (string) - ]; - foo: 'Corge'; -}; - -export type foo = 'Bar'; - -export const foo = { - BAR: 'Bar' -} as const; - -export type ModelWithNestedArrayEnumsDataFoo = 'foo' | 'bar'; - -export const ModelWithNestedArrayEnumsDataFoo = { - FOO: 'foo', - BAR: 'bar' -} as const; - -export type ModelWithNestedArrayEnumsDataBar = 'baz' | 'qux'; - -export const ModelWithNestedArrayEnumsDataBar = { - BAZ: 'baz', - QUX: 'qux' -} as const; - -export type ModelWithNestedArrayEnumsData = { - foo?: Array; - bar?: Array; -}; - -export type ModelWithNestedArrayEnums = { - array_strings?: Array<(string)>; - data?: (ModelWithNestedArrayEnumsData); -}; - -export type ModelWithNestedCompositionEnums = { - foo?: (ModelWithNestedArrayEnumsDataFoo); -}; - -export type ModelWithReadOnlyAndWriteOnly = { - foo: string; - readonly bar: string; - baz: string; -}; - -export type ModelWithConstantSizeArray = [ - number, - number -]; - -export type ModelWithAnyOfConstantSizeArray = [ - (number | string), - (number | string), - (number | string) -]; - -export type ModelWithPrefixItemsConstantSizeArray = [ - ModelWithInteger, - (number | string), - string -]; - -export type ModelWithAnyOfConstantSizeArrayNullable = [ - ((number) | null | string), - ((number) | null | string), - ((number) | null | string) -]; - -export type ModelWithAnyOfConstantSizeArrayWithNSizeAndOptions = [ - (number | _import), - (number | _import) -]; - -export type ModelWithAnyOfConstantSizeArrayAndIntersect = [ - (number & string), - (number & string) -]; - -export type ModelWithNumericEnumUnion = { - /** - * Период - */ - value?: -10 | -1 | 0 | 1 | 3 | 6 | 12; -}; - -/** - * Период - */ -export type value = -10 | -1 | 0 | 1 | 3 | 6 | 12; - -/** - * Период - */ -export const value = { - '_-10': -10, - '_-1': -1, - '_0': 0, - '_1': 1, - '_3': 3, - '_6': 6, - '_12': 12 -} as const; - -/** - * Some description with `back ticks` - */ -export type ModelWithBackticksInDescription = { - /** - * The template `that` should be used for parsing and importing the contents of the CSV file. - * - *

There is one placeholder currently supported:

  • ${x} - refers to the n-th column in the CSV file, e.g. ${1}, ${2}, ...)

Example of a correct JSON template:

- *
-     * [
-     * {
-     * "resourceType": "Asset",
-     * "identifier": {
-     * "name": "${1}",
-     * "domain": {
-     * "name": "${2}",
-     * "community": {
-     * "name": "Some Community"
-     * }
-     * }
-     * },
-     * "attributes" : {
-     * "00000000-0000-0000-0000-000000003115" : [ {
-     * "value" : "${3}"
-     * } ],
-     * "00000000-0000-0000-0000-000000000222" : [ {
-     * "value" : "${4}"
-     * } ]
-     * }
-     * }
-     * ]
-     * 
- */ - template?: string; -}; - -export type ModelWithOneOfAndProperties = (ParameterSimpleParameter | NonAsciiStringæøåÆØÅöôêÊ字符串) & { - baz: (number) | null; - qux: number; -}; - -/** - * Model used to test deduplication strategy (unused) - */ -export type ParameterSimpleParameterUnused = string; - -/** - * Model used to test deduplication strategy - */ -export type PostServiceWithEmptyTagResponse = string; - -/** - * Model used to test deduplication strategy - */ -export type PostServiceWithEmptyTagResponse2 = string; - -/** - * Model used to test deduplication strategy - */ -export type DeleteFooData = string; - -/** - * Model used to test deduplication strategy - */ -export type DeleteFooData2 = string; - -/** - * Model with restricted keyword name - */ -export type _import = string; - -export type SchemaWithFormRestrictedKeys = { - description?: string; - 'x-enum-descriptions'?: string; - 'x-enum-varnames'?: string; - 'x-enumNames'?: string; - title?: string; - object?: { - description?: string; - 'x-enum-descriptions'?: string; - 'x-enum-varnames'?: string; - 'x-enumNames'?: string; - title?: string; - }; - array?: Array<({ - description?: string; - 'x-enum-descriptions'?: string; - 'x-enum-varnames'?: string; - 'x-enumNames'?: string; - title?: string; -})>; -}; - -/** - * This schema was giving PascalCase transformations a hard time - */ -export type io_k8s_apimachinery_pkg_apis_meta_v1_DeleteOptions = { - /** - * Must be fulfilled before a deletion is carried out. If not possible, a 409 Conflict status will be returned. - */ - preconditions?: (io_k8s_apimachinery_pkg_apis_meta_v1_Preconditions); -}; - -/** - * This schema was giving PascalCase transformations a hard time - */ -export type io_k8s_apimachinery_pkg_apis_meta_v1_Preconditions = { - /** - * Specifies the target ResourceVersion - */ - resourceVersion?: string; - /** - * Specifies the target UID. - */ - uid?: string; -}; - -export type AdditionalPropertiesUnknownIssue = { - [key: string]: (string | number); -}; - -export type AdditionalPropertiesUnknownIssue2 = { - [key: string]: (string | number); -}; - -export type AdditionalPropertiesUnknownIssue3 = string & { - entries: { - [key: string]: AdditionalPropertiesUnknownIssue; - }; -}; - -export type AdditionalPropertiesIntegerIssue = { - value: number; - [key: string]: (number) | undefined; -}; - -export type OneOfAllOfIssue = ((ConstValue | Generic_Schema_Duplicate_Issue_1_System_Boolean_) & _3e_num_1Период) | Generic_Schema_Duplicate_Issue_1_System_String_; - -export type Generic_Schema_Duplicate_Issue_1_System_Boolean_ = { - item?: boolean; - error?: (string) | null; - readonly hasError?: boolean; - data?: { - [key: string]: unknown; - }; -}; - -export type Generic_Schema_Duplicate_Issue_1_System_String_ = { - item?: (string) | null; - error?: (string) | null; - readonly hasError?: boolean; -}; - -/** - * This is a reusable parameter - */ -export type ParameterSimpleParameter = string; - -/** - * Parameter with illegal characters - */ -export type Parameterx_Foo_Bar = ModelWithString; - -export type ImportData = { - body: (ModelWithReadOnlyAndWriteOnly | ModelWithArrayReadOnlyAndWriteOnly); -}; - -export type ImportResponse = (Model_From_Zendesk | ModelWithReadOnlyAndWriteOnly); - -export type ImportError = unknown; - -export type ApiVversionOdataControllerCountResponse = (Model_From_Zendesk); - -export type ApiVversionOdataControllerCountError = unknown; - -export type GetApiVbyApiVersionSimpleOperationData = { - path: { - /** - * foo in method - */ - foo_param: string; - }; -}; - -export type GetApiVbyApiVersionSimpleOperationResponse = (number); - -export type GetApiVbyApiVersionSimpleOperationError = (ModelWithBoolean); - -export type DeleteFooData3 = { - headers: { - /** - * Parameter with illegal characters - */ - 'x-Foo-Bar': ModelWithString; - }; - path: { - /** - * bar in method - */ - BarParam: string; - /** - * foo in method - */ - foo_param: string; - }; -}; - -export type CallWithDescriptionsData = { - query?: { - /** - * Testing backticks in string: `backticks` and ```multiple backticks``` should work - */ - parameterWithBackticks?: unknown; - /** - * Testing multiline comments in string: First line - * Second line - * - * Fourth line - */ - parameterWithBreaks?: unknown; - /** - * Testing expression placeholders in string: ${expression} should work - */ - parameterWithExpressionPlaceholders?: unknown; - /** - * Testing quotes in string: 'single quote''' and "double quotes""" should work - */ - parameterWithQuotes?: unknown; - /** - * Testing reserved characters in string: * inline * and ** inline ** should work - */ - parameterWithReservedCharacters?: unknown; - /** - * Testing slashes in string: \backwards\\\ and /forwards/// should work - */ - parameterWithSlashes?: unknown; - }; -}; - -export type DeprecatedCallData = { - headers: { - /** - * This parameter is deprecated - * @deprecated - */ - parameter: (DeprecatedModel) | null; - }; -}; - -export type CallWithParametersData = { - /** - * This is the parameter that goes into the body - */ - body: { - [key: string]: unknown; - } | null; - headers: { - /** - * This is the parameter that goes into the header - */ - parameterHeader: (string) | null; - }; - path: { - /** - * api-version should be required in standalone clients - */ - 'api-version': (string) | null; - /** - * This is the parameter that goes into the path - */ - parameterPath: (string) | null; - }; - query: { - /** - * This is the parameter that goes into the query params - */ - cursor: (string) | null; - foo_all_of_enum: (ModelWithNestedArrayEnumsDataFoo); - foo_ref_enum?: ModelWithNestedArrayEnumsDataFoo; - }; -}; - -export type CallWithWeirdParameterNamesData = { - /** - * This is the parameter that goes into the body - */ - body: (ModelWithString) | null; - headers: { - /** - * This is the parameter that goes into the request header - */ - 'parameter.header': (string) | null; - }; - path: { - /** - * api-version should be required in standalone clients - */ - 'api-version': (string) | null; - /** - * This is the parameter that goes into the path - */ - 'parameter-path-2'?: string; - /** - * This is the parameter that goes into the path - */ - 'PARAMETER-PATH-3'?: string; - /** - * This is the parameter that goes into the path - */ - 'parameter.path.1'?: string; - }; - query: { - /** - * This is the parameter with a reserved keyword - */ - default?: string; - /** - * This is the parameter that goes into the request query params - */ - 'parameter-query': (string) | null; - }; -}; - -export type GetCallWithOptionalParamData = { - /** - * This is a required parameter - */ - body: ModelWithOneOfEnum; - query?: { - /** - * This is an optional parameter - */ - page?: number; - }; -}; - -export type PostCallWithOptionalParamData = { - /** - * This is an optional parameter - */ - body?: { - offset?: (number) | null; - }; - query: { - /** - * This is a required parameter - */ - parameter: Pageable; - }; -}; - -export type PostCallWithOptionalParamResponse = (number | void); - -export type PostCallWithOptionalParamError = unknown; - -export type PostApiVbyApiVersionRequestBodyData = { - /** - * A reusable request body - */ - body?: ModelWithString; - query?: { - /** - * This is a reusable parameter - */ - parameter?: string; - }; -}; - -export type PostApiVbyApiVersionFormDataData = { - /** - * A reusable request body - */ - body?: ModelWithString; - query?: { - /** - * This is a reusable parameter - */ - parameter?: string; - }; -}; - -export type CallWithDefaultParametersData = { - query?: { - /** - * This is a simple boolean with default value - */ - parameterBoolean?: (boolean) | null; - /** - * This is a simple enum with default value - */ - parameterEnum?: 'Success' | 'Warning' | 'Error'; - /** - * This is a simple model with default value - */ - parameterModel?: (ModelWithString) | null; - /** - * This is a simple number with default value - */ - parameterNumber?: (number) | null; - /** - * This is a simple string with default value - */ - parameterString?: (string) | null; - }; -}; - -export type CallWithDefaultOptionalParametersData = { - query?: { - /** - * This is a simple boolean that is optional with default value - */ - parameterBoolean?: boolean; - /** - * This is a simple enum that is optional with default value - */ - parameterEnum?: 'Success' | 'Warning' | 'Error'; - /** - * This is a simple model that is optional with default value - */ - parameterModel?: ModelWithString; - /** - * This is a simple number that is optional with default value - */ - parameterNumber?: number; - /** - * This is a simple string that is optional with default value - */ - parameterString?: string; - }; -}; - -export type CallToTestOrderOfParamsData = { - query: { - /** - * This is a optional string with default - */ - parameterOptionalStringWithDefault?: string; - /** - * This is a optional string with empty default - */ - parameterOptionalStringWithEmptyDefault?: string; - /** - * This is a optional string with no default - */ - parameterOptionalStringWithNoDefault?: string; - /** - * This is a string that can be null with default - */ - parameterStringNullableWithDefault?: (string) | null; - /** - * This is a string that can be null with no default - */ - parameterStringNullableWithNoDefault?: (string) | null; - /** - * This is a string with default - */ - parameterStringWithDefault: string; - /** - * This is a string with empty default - */ - parameterStringWithEmptyDefault: string; - /** - * This is a string with no default - */ - parameterStringWithNoDefault: string; - }; -}; - -export type CallWithNoContentResponseResponse = (void); - -export type CallWithNoContentResponseError = unknown; - -export type CallWithResponseAndNoContentResponseResponse = (number | void); - -export type CallWithResponseAndNoContentResponseError = unknown; - -export type DummyAResponse = (_400); - -export type DummyAError = unknown; - -export type DummyBResponse = (void); - -export type DummyBError = unknown; - -export type CallWithResponseResponse = (_import); - -export type CallWithResponseError = unknown; - -export type CallWithDuplicateResponsesResponse = ((ModelWithBoolean & ModelWithInteger) | ModelWithString); - -export type CallWithDuplicateResponsesError = (ModelWithStringError | DictionaryWithArray | ModelWithBoolean); - -export type CallWithResponsesResponse = ({ - readonly '@namespace.string'?: string; - readonly '@namespace.integer'?: number; - readonly value?: Array; -} | ModelThatExtends | ModelThatExtendsExtends); - -export type CallWithResponsesError = (ModelWithStringError); - -export type CollectionFormatData = { - query: { - /** - * This is an array parameter that is sent as csv format (comma-separated values) - */ - parameterArrayCSV: Array<(string)> | null; - /** - * This is an array parameter that is sent as multi format (multiple parameter instances) - */ - parameterArrayMulti: Array<(string)> | null; - /** - * This is an array parameter that is sent as pipes format (pipe-separated values) - */ - parameterArrayPipes: Array<(string)> | null; - /** - * This is an array parameter that is sent as ssv format (space-separated values) - */ - parameterArraySSV: Array<(string)> | null; - /** - * This is an array parameter that is sent as tsv format (tab-separated values) - */ - parameterArrayTSV: Array<(string)> | null; - }; -}; - -export type TypesData = { - path?: { - /** - * This is a number parameter - */ - id?: number; - }; - query: { - /** - * This is an array parameter - */ - parameterArray: Array<(string)> | null; - /** - * This is a boolean parameter - */ - parameterBoolean: (boolean) | null; - /** - * This is a dictionary parameter - */ - parameterDictionary: { - [key: string]: unknown; - } | null; - /** - * This is an enum parameter - */ - parameterEnum: ('Success' | 'Warning' | 'Error') | null; - /** - * This is a number parameter - */ - parameterNumber: number; - /** - * This is an object parameter - */ - parameterObject: { - [key: string]: unknown; - } | null; - /** - * This is a string parameter - */ - parameterString: (string) | null; - }; -}; - -export type TypesResponse = (number | string | boolean | { - [key: string]: unknown; -}); - -export type TypesError = unknown; - -export type UploadFileData = { - body: (Blob | File); - path: { - /** - * api-version should be required in standalone clients - */ - 'api-version': (string) | null; - }; -}; - -export type UploadFileResponse = (boolean); - -export type UploadFileError = unknown; - -export type FileResponseData = { - path: { - /** - * api-version should be required in standalone clients - */ - 'api-version': string; - id: string; - }; -}; - -export type FileResponseResponse = ((Blob | File)); - -export type FileResponseError = unknown; - -export type ComplexTypesData = { - query: { - /** - * Parameter containing object - */ - parameterObject: { - first?: { - second?: { - third?: string; - }; - }; - }; - /** - * Parameter containing reference - */ - parameterReference: ModelWithString; - }; -}; - -export type ComplexTypesResponse = (Array); - -export type ComplexTypesError = (unknown); - -export type MultipartRequestData = { - body?: { - content?: (Blob | File); - data?: ((ModelWithString) | null); - }; -}; - -export type MultipartResponseResponse = ({ - file?: (Blob | File); - metadata?: { - foo?: string; - bar?: string; - }; -}); - -export type MultipartResponseError = unknown; - -export type ComplexParamsData = { - body?: { - readonly key: (string) | null; - name: (string) | null; - enabled?: boolean; - readonly type: 'Monkey' | 'Horse' | 'Bird'; - listOfModels?: Array | null; - listOfStrings?: Array<(string)> | null; - parameters: (ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary); - readonly user?: { - readonly id?: number; - readonly name?: (string) | null; - }; - }; - path: { - /** - * api-version should be required in standalone clients - */ - 'api-version': string; - id: number; - }; -}; - -export type ComplexParamsResponse = (ModelWithString); - -export type ComplexParamsError = unknown; - -export type CallWithResultFromHeaderResponse = (string); - -export type CallWithResultFromHeaderError = (unknown); - -export type TestErrorCodeData = { - query: { - /** - * Status code to return - */ - status: number; - }; -}; - -export type TestErrorCodeResponse = (unknown); - -export type TestErrorCodeError = (unknown); - -export type NonAsciiæøåÆøÅöôêÊ字符串Data = { - query: { - /** - * Dummy input param - */ - nonAsciiParamæøåÆØÅöôêÊ: number; - }; -}; - -export type NonAsciiæøåÆøÅöôêÊ字符串Response = (Array); - -export type NonAsciiæøåÆøÅöôêÊ字符串Error = unknown; - -export type PutWithFormUrlEncodedData = { - body: ArrayWithStrings; -}; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-react-query_transform/@tanstack/react-query.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-react-query_transform/@tanstack/react-query.gen.ts.snap deleted file mode 100644 index 505ab21c0..000000000 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-react-query_transform/@tanstack/react-query.gen.ts.snap +++ /dev/null @@ -1,109 +0,0 @@ -// This file is auto-generated by @hey-api/openapi-ts - -import type { Options } from '@hey-api/client-fetch'; -import { queryOptions, type UseMutationOptions } from '@tanstack/react-query'; -import type { ParentModelWithDatesError, ParentModelWithDatesResponse, ModelWithDatesError, ModelWithDatesResponse, ModelWithDatesArrayError, ModelWithDatesArrayResponse, ArrayOfDatesError, ArrayOfDatesResponse, DateError, DateResponse, MultipleResponsesError, MultipleResponsesResponse } from '../types.gen'; -import { client, parentModelWithDates, modelWithDates, modelWithDatesArray, arrayOfDates, date, multipleResponses } from '../services.gen'; - -type QueryKey = [ - Pick & { - _id: string; - _infinite?: boolean; - } -]; - -const createQueryKey = (id: string, options?: TOptions, infinite?: boolean): QueryKey[0] => { - const params: QueryKey[0] = { _id: id, baseUrl: (options?.client ?? client).getConfig().baseUrl } as QueryKey[0]; - if (infinite) { - params._infinite = infinite; - } - if (options?.body) { - params.body = options.body; - } - if (options?.headers) { - params.headers = options.headers; - } - if (options?.path) { - params.path = options.path; - } - if (options?.query) { - params.query = options.query; - } - return params; -}; - -export const parentModelWithDatesQueryKey = (options?: Options) => [ - createQueryKey("parentModelWithDates", options) -]; - -export const parentModelWithDatesOptions = (options?: Options) => { return queryOptions({ - queryFn: async ({ queryKey }) => { - const { data } = await parentModelWithDates({ - ...options, - ...queryKey[0], - throwOnError: true - }); - return data; - }, - queryKey: parentModelWithDatesQueryKey(options) -}); }; - -export const parentModelWithDatesMutation = () => { const mutationOptions: UseMutationOptions = { - mutationFn: async (options) => { - const { data } = await parentModelWithDates({ - ...options, - throwOnError: true - }); - return data; - } -}; return mutationOptions; }; - -export const modelWithDatesMutation = () => { const mutationOptions: UseMutationOptions = { - mutationFn: async (options) => { - const { data } = await modelWithDates({ - ...options, - throwOnError: true - }); - return data; - } -}; return mutationOptions; }; - -export const modelWithDatesArrayMutation = () => { const mutationOptions: UseMutationOptions = { - mutationFn: async (options) => { - const { data } = await modelWithDatesArray({ - ...options, - throwOnError: true - }); - return data; - } -}; return mutationOptions; }; - -export const arrayOfDatesMutation = () => { const mutationOptions: UseMutationOptions = { - mutationFn: async (options) => { - const { data } = await arrayOfDates({ - ...options, - throwOnError: true - }); - return data; - } -}; return mutationOptions; }; - -export const dateMutation = () => { const mutationOptions: UseMutationOptions = { - mutationFn: async (options) => { - const { data } = await date({ - ...options, - throwOnError: true - }); - return data; - } -}; return mutationOptions; }; - -export const multipleResponsesMutation = () => { const mutationOptions: UseMutationOptions = { - mutationFn: async (options) => { - const { data } = await multipleResponses({ - ...options, - throwOnError: true - }); - return data; - } -}; return mutationOptions; }; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-react-query_transform/services.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-react-query_transform/services.gen.ts.snap deleted file mode 100644 index fcb0cc83f..000000000 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-react-query_transform/services.gen.ts.snap +++ /dev/null @@ -1,39 +0,0 @@ -// This file is auto-generated by @hey-api/openapi-ts - -import { createClient, createConfig, type Options } from '@hey-api/client-fetch'; -import { type ParentModelWithDatesError, type ParentModelWithDatesResponse, type ModelWithDatesError, type ModelWithDatesResponse, type ModelWithDatesArrayError, type ModelWithDatesArrayResponse, type ArrayOfDatesError, type ArrayOfDatesResponse, type DateError, type DateResponse, type MultipleResponsesError, type MultipleResponsesResponse, ParentModelWithDatesResponseTransformer, ModelWithDatesResponseTransformer, ModelWithDatesArrayResponseTransformer } from './types.gen'; - -export const client = createClient(createConfig()); - -export const parentModelWithDates = (options?: Options) => { return (options?.client ?? client).post({ - ...options, - url: '/api/model-with-dates', - responseTransformer: ParentModelWithDatesResponseTransformer -}); }; - -export const modelWithDates = (options?: Options) => { return (options?.client ?? client).put({ - ...options, - url: '/api/model-with-dates', - responseTransformer: ModelWithDatesResponseTransformer -}); }; - -export const modelWithDatesArray = (options?: Options) => { return (options?.client ?? client).put({ - ...options, - url: '/api/model-with-dates-array', - responseTransformer: ModelWithDatesArrayResponseTransformer -}); }; - -export const arrayOfDates = (options?: Options) => { return (options?.client ?? client).put({ - ...options, - url: '/api/array-of-dates' -}); }; - -export const date = (options?: Options) => { return (options?.client ?? client).put({ - ...options, - url: '/api/date' -}); }; - -export const multipleResponses = (options?: Options) => { return (options?.client ?? client).put({ - ...options, - url: '/api/multiple-responses' -}); }; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-react-query_transform/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-react-query_transform/types.gen.ts.snap deleted file mode 100644 index 4f5b1d77e..000000000 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-react-query_transform/types.gen.ts.snap +++ /dev/null @@ -1,118 +0,0 @@ -// This file is auto-generated by @hey-api/openapi-ts - -/** - * This is a model that contains a some dates - */ -export type SimpleModel = { - id: number; - name: string; - readonly enabled: boolean; -}; - -/** - * This is a model that contains a some dates - */ -export type ModelWithDates = { - id: number; - name: string; - readonly enabled: boolean; - readonly modified: Date; - readonly expires?: Date; -}; - -/** - * This is a model that contains a some dates and arrays - */ -export type ParentModelWithDates = { - id: number; - readonly modified?: Date; - items?: Array; - item?: ModelWithDates; - 'nullable-date'?: Array<(Date | null)>; - simpleItems?: Array; - simpleItem?: SimpleModel; - dates?: Array<(Date)>; - strings?: Array<(string)>; -}; - -export type ParentModelWithDatesResponse = (ParentModelWithDates | unknown); - -export type ParentModelWithDatesError = unknown; - -export type ModelWithDatesResponse = (ModelWithDates); - -export type ModelWithDatesError = unknown; - -export type ModelWithDatesArrayResponse = (Array); - -export type ModelWithDatesArrayError = unknown; - -export type ArrayOfDatesResponse = (Array<(Date)>); - -export type ArrayOfDatesError = unknown; - -export type DateResponse = (Date); - -export type DateError = unknown; - -export type MultipleResponsesResponse = (Array | Array); - -export type MultipleResponsesError = unknown; - -export type ParentModelWithDatesResponseTransformer = (data: any) => Promise; - -export type ParentModelWithDatesModelResponseTransformer = (data: any) => ParentModelWithDates; - -export type ModelWithDatesModelResponseTransformer = (data: any) => ModelWithDates; - -export const ModelWithDatesModelResponseTransformer: ModelWithDatesModelResponseTransformer = data => { - if (data?.modified) { - data.modified = new Date(data.modified); - } - if (data?.expires) { - data.expires = new Date(data.expires); - } - return data; -}; - -export const ParentModelWithDatesModelResponseTransformer: ParentModelWithDatesModelResponseTransformer = data => { - if (data?.modified) { - data.modified = new Date(data.modified); - } - if (Array.isArray(data?.items)) { - data.items.forEach(ModelWithDatesModelResponseTransformer); - } - if (data?.item) { - ModelWithDatesModelResponseTransformer(data.item); - } - if (Array.isArray(data?.['nullable-date'])) { - data['nullable-date'] = data['nullable-date'].map(item => item ? new Date(item) : item); - } - if (Array.isArray(data?.dates)) { - data.dates = data.dates.map(item => item ? new Date(item) : item); - } - return data; -}; - -export const ParentModelWithDatesResponseTransformer: ParentModelWithDatesResponseTransformer = async (data) => { - if (data) { - ParentModelWithDatesModelResponseTransformer(data); - } - return data; -}; - -export type ModelWithDatesResponseTransformer = (data: any) => Promise; - -export const ModelWithDatesResponseTransformer: ModelWithDatesResponseTransformer = async (data) => { - ModelWithDatesModelResponseTransformer(data); - return data; -}; - -export type ModelWithDatesArrayResponseTransformer = (data: any) => Promise; - -export const ModelWithDatesArrayResponseTransformer: ModelWithDatesArrayResponseTransformer = async (data) => { - if (Array.isArray(data)) { - data.forEach(ModelWithDatesModelResponseTransformer); - } - return data; -}; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-solid-query/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-solid-query/types.gen.ts.snap deleted file mode 100644 index c0c16d891..000000000 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-solid-query/types.gen.ts.snap +++ /dev/null @@ -1,1630 +0,0 @@ -// This file is auto-generated by @hey-api/openapi-ts - -/** - * Model with number-only name - */ -export type _400 = string; - -/** - * Testing multiline comments in string: First line - * Second line - * - * Fourth line - */ -export type camelCaseCommentWithBreaks = number; - -/** - * Testing multiline comments in string: First line - * Second line - * - * Fourth line - */ -export type CommentWithBreaks = number; - -/** - * Testing backticks in string: `backticks` and ```multiple backticks``` should work - */ -export type CommentWithBackticks = number; - -/** - * Testing backticks and quotes in string: `backticks`, 'quotes', "double quotes" and ```multiple backticks``` should work - */ -export type CommentWithBackticksAndQuotes = number; - -/** - * Testing slashes in string: \backwards\\\ and /forwards/// should work - */ -export type CommentWithSlashes = number; - -/** - * Testing expression placeholders in string: ${expression} should work - */ -export type CommentWithExpressionPlaceholders = number; - -/** - * Testing quotes in string: 'single quote''' and "double quotes""" should work - */ -export type CommentWithQuotes = number; - -/** - * Testing reserved characters in string: * inline * and ** inline ** should work - */ -export type CommentWithReservedCharacters = number; - -/** - * This is a simple number - */ -export type SimpleInteger = number; - -/** - * This is a simple boolean - */ -export type SimpleBoolean = boolean; - -/** - * This is a simple string - */ -export type SimpleString = string; - -/** - * A string with non-ascii (unicode) characters valid in typescript identifiers (æøåÆØÅöÔèÈ字符串) - */ -export type NonAsciiStringæøåÆØÅöôêÊ字符串 = string; - -/** - * This is a simple file - */ -export type SimpleFile = (Blob | File); - -/** - * This is a simple reference - */ -export type SimpleReference = ModelWithString; - -/** - * This is a simple string - */ -export type SimpleStringWithPattern = (string) | null; - -/** - * This is a simple enum with strings - */ -export type EnumWithStrings = 'Success' | 'Warning' | 'Error' | "'Single Quote'" | '"Double Quotes"' | 'Non-ascii: øæåôöØÆÅÔÖ字符串'; - -/** - * This is a simple enum with strings - */ -export const EnumWithStrings = { - SUCCESS: 'Success', - WARNING: 'Warning', - ERROR: 'Error', - _SINGLE_QUOTE_: "'Single Quote'", - _DOUBLE_QUOTES_: '"Double Quotes"', - 'NON_ASCII__ØÆÅÔÖ_ØÆÅÔÖ字符串': 'Non-ascii: øæåôöØÆÅÔÖ字符串' -} as const; - -export type EnumWithReplacedCharacters = "'Single Quote'" | '"Double Quotes"' | 'øæåôöØÆÅÔÖ字符串' | 3.1 | ''; - -export const EnumWithReplacedCharacters = { - _SINGLE_QUOTE_: "'Single Quote'", - _DOUBLE_QUOTES_: '"Double Quotes"', - 'ØÆÅÔÖ_ØÆÅÔÖ字符串': 'øæåôöØÆÅÔÖ字符串', - '_3.1': 3.1, - EMPTY_STRING: '' -} as const; - -/** - * This is a simple enum with numbers - */ -export type EnumWithNumbers = 1 | 2 | 3 | 1.1 | 1.2 | 1.3 | 100 | 200 | 300 | -100 | -200 | -300 | -1.1 | -1.2 | -1.3; - -/** - * This is a simple enum with numbers - */ -export const EnumWithNumbers = { - '_1': 1, - '_2': 2, - '_3': 3, - '_1.1': 1.1, - '_1.2': 1.2, - '_1.3': 1.3, - '_100': 100, - '_200': 200, - '_300': 300, - '_-100': -100, - '_-200': -200, - '_-300': -300, - '_-1.1': -1.1, - '_-1.2': -1.2, - '_-1.3': -1.3 -} as const; - -/** - * Success=1,Warning=2,Error=3 - */ -export type EnumFromDescription = number; - -/** - * This is a simple enum with numbers - */ -export type EnumWithExtensions = 200 | 400 | 500; - -/** - * This is a simple enum with numbers - */ -export const EnumWithExtensions = { - /** - * Used when the status of something is successful - */ - CUSTOM_SUCCESS: 200, - /** - * Used when the status of something has a warning - */ - CUSTOM_WARNING: 400, - /** - * Used when the status of something has an error - */ - CUSTOM_ERROR: 500 -} as const; - -export type EnumWithXEnumNames = 0 | 1 | 2; - -export const EnumWithXEnumNames = { - zero: 0, - one: 1, - two: 2 -} as const; - -/** - * This is a simple array with numbers - */ -export type ArrayWithNumbers = Array<(number)>; - -/** - * This is a simple array with booleans - */ -export type ArrayWithBooleans = Array<(boolean)>; - -/** - * This is a simple array with strings - */ -export type ArrayWithStrings = Array<(string)>; - -/** - * This is a simple array with references - */ -export type ArrayWithReferences = Array; - -/** - * This is a simple array containing an array - */ -export type ArrayWithArray = Array>; - -/** - * This is a simple array with properties - */ -export type ArrayWithProperties = Array<{ - '16x16'?: camelCaseCommentWithBreaks; - bar?: string; -}>; - -/** - * This is a simple array with any of properties - */ -export type ArrayWithAnyOfProperties = Array<({ - foo?: string; -} | { - bar?: string; -})>; - -export type AnyOfAnyAndNull = { - data?: (unknown | null); -}; - -/** - * This is a simple array with any of properties - */ -export type AnyOfArrays = { - results?: Array<({ - foo?: string; -} | { - bar?: string; -})>; -}; - -/** - * This is a string dictionary - */ -export type DictionaryWithString = { - [key: string]: (string); -}; - -export type DictionaryWithPropertiesAndAdditionalProperties = { - foo?: number; - bar?: boolean; - [key: string]: (string | number | boolean) | undefined; -}; - -/** - * This is a string reference - */ -export type DictionaryWithReference = { - [key: string]: ModelWithString; -}; - -/** - * This is a complex dictionary - */ -export type DictionaryWithArray = { - [key: string]: Array; -}; - -/** - * This is a string dictionary - */ -export type DictionaryWithDictionary = { - [key: string]: { - [key: string]: (string); - }; -}; - -/** - * This is a complex dictionary - */ -export type DictionaryWithProperties = { - [key: string]: { - foo?: string; - bar?: string; - }; -}; - -/** - * This is a model with one number property - */ -export type ModelWithInteger = { - /** - * This is a simple number property - */ - prop?: number; -}; - -/** - * This is a model with one boolean property - */ -export type ModelWithBoolean = { - /** - * This is a simple boolean property - */ - prop?: boolean; -}; - -/** - * This is a model with one string property - */ -export type ModelWithString = { - /** - * This is a simple string property - */ - prop?: string; -}; - -/** - * This is a model with one string property - */ -export type ModelWithStringError = { - /** - * This is a simple string property - */ - prop?: string; -}; - -/** - * `Comment` or `VoiceComment`. The JSON object for adding voice comments to tickets is different. See [Adding voice comments to tickets](/documentation/ticketing/managing-tickets/adding-voice-comments-to-tickets) - */ -export type Model_From_Zendesk = string; - -/** - * This is a model with one string property - */ -export type ModelWithNullableString = { - /** - * This is a simple string property - */ - nullableProp1?: (string) | null; - /** - * This is a simple string property - */ - nullableRequiredProp1: (string) | null; - /** - * This is a simple string property - */ - nullableProp2?: (string) | null; - /** - * This is a simple string property - */ - nullableRequiredProp2: (string) | null; - /** - * This is a simple enum with strings - */ - 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; -}; - -/** - * This is a simple enum with strings - */ -export type foo_bar_enum = 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; - -/** - * This is a simple enum with strings - */ -export const foo_bar_enum = { - SUCCESS: 'Success', - WARNING: 'Warning', - ERROR: 'Error', - 'ØÆÅ字符串': 'ØÆÅ字符串' -} as const; - -/** - * This is a model with one enum - */ -export type ModelWithEnum = { - /** - * This is a simple enum with strings - */ - 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; - /** - * These are the HTTP error code enums - */ - statusCode?: '100' | '200 FOO' | '300 FOO_BAR' | '400 foo-bar' | '500 foo.bar' | '600 foo&bar'; - /** - * Simple boolean enum - */ - bool?: boolean; -}; - -/** - * These are the HTTP error code enums - */ -export type statusCode = '100' | '200 FOO' | '300 FOO_BAR' | '400 foo-bar' | '500 foo.bar' | '600 foo&bar'; - -/** - * These are the HTTP error code enums - */ -export const statusCode = { - _100: '100', - _200_FOO: '200 FOO', - _300_FOO_BAR: '300 FOO_BAR', - _400_FOO_BAR: '400 foo-bar', - _500_FOO_BAR: '500 foo.bar', - _600_FOO_BAR: '600 foo&bar' -} as const; - -/** - * This is a model with one enum with escaped name - */ -export type ModelWithEnumWithHyphen = { - 'foo-bar-baz-qux'?: '3.0'; -}; - -export type foo_bar_baz_qux = '3.0'; - -export const foo_bar_baz_qux = { - _3_0: '3.0' -} as const; - -/** - * This is a model with one enum - */ -export type ModelWithEnumFromDescription = { - /** - * Success=1,Warning=2,Error=3 - */ - test?: number; -}; - -/** - * This is a model with nested enums - */ -export type ModelWithNestedEnums = { - dictionaryWithEnum?: { - [key: string]: ('Success' | 'Warning' | 'Error'); - }; - dictionaryWithEnumFromDescription?: { - [key: string]: (number); - }; - arrayWithEnum?: Array<('Success' | 'Warning' | 'Error')>; - arrayWithDescription?: Array<(number)>; - /** - * This is a simple enum with strings - */ - 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; -}; - -/** - * This is a model with one property containing a reference - */ -export type ModelWithReference = { - prop?: ModelWithProperties; -}; - -/** - * This is a model with one property containing an array - */ -export type ModelWithArrayReadOnlyAndWriteOnly = { - prop?: Array; - propWithFile?: Array<((Blob | File))>; - propWithNumber?: Array<(number)>; -}; - -/** - * This is a model with one property containing an array - */ -export type ModelWithArray = { - prop?: Array; - propWithFile?: Array<((Blob | File))>; - propWithNumber?: Array<(number)>; -}; - -/** - * This is a model with one property containing a dictionary - */ -export type ModelWithDictionary = { - prop?: { - [key: string]: (string); - }; -}; - -/** - * This is a deprecated model with a deprecated property - * @deprecated - */ -export type DeprecatedModel = { - /** - * This is a deprecated property - * @deprecated - */ - prop?: string; -}; - -/** - * This is a model with one property containing a circular reference - */ -export type ModelWithCircularReference = { - prop?: ModelWithCircularReference; -}; - -/** - * This is a model with one property with a 'one of' relationship - */ -export type CompositionWithOneOf = { - propA?: (ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary); -}; - -/** - * This is a model with one property with a 'one of' relationship where the options are not $ref - */ -export type CompositionWithOneOfAnonymous = { - propA?: ({ - propA?: string; -} | string | number); -}; - -/** - * Circle - */ -export type ModelCircle = { - kind: 'circle'; - radius?: number; -}; - -/** - * Square - */ -export type ModelSquare = { - kind: 'square'; - sideLength?: number; -}; - -/** - * This is a model with one property with a 'one of' relationship where the options are not $ref - */ -export type CompositionWithOneOfDiscriminator = ModelCircle | ModelSquare; - -/** - * This is a model with one property with a 'any of' relationship - */ -export type CompositionWithAnyOf = { - propA?: (ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary); -}; - -/** - * This is a model with one property with a 'any of' relationship where the options are not $ref - */ -export type CompositionWithAnyOfAnonymous = { - propA?: ({ - propA?: string; -} | string | number); -}; - -/** - * This is a model with nested 'any of' property with a type null - */ -export type CompositionWithNestedAnyAndTypeNull = { - propA?: (Array<(ModelWithDictionary | null)> | Array<(ModelWithArray | null)>); -}; - -export type _3e_num_1Период = 'Bird' | 'Dog'; - -export const _3e_num_1Период = { - BIRD: 'Bird', - DOG: 'Dog' -} as const; - -export type ConstValue = "ConstValue"; - -/** - * This is a model with one property with a 'any of' relationship where the options are not $ref - */ -export type CompositionWithNestedAnyOfAndNull = { - propA?: (Array<(_3e_num_1Период | ConstValue)> | null); -}; - -/** - * This is a model with one property with a 'one of' relationship - */ -export type CompositionWithOneOfAndNullable = { - propA?: (({ - boolean?: boolean; -} | ModelWithEnum | ModelWithArray | ModelWithDictionary) | null); -}; - -/** - * This is a model that contains a simple dictionary within composition - */ -export type CompositionWithOneOfAndSimpleDictionary = { - propA?: (boolean | { - [key: string]: (number); -}); -}; - -/** - * This is a model that contains a dictionary of simple arrays within composition - */ -export type CompositionWithOneOfAndSimpleArrayDictionary = { - propA?: (boolean | { - [key: string]: Array<(boolean)>; -}); -}; - -/** - * This is a model that contains a dictionary of complex arrays (composited) within composition - */ -export type CompositionWithOneOfAndComplexArrayDictionary = { - propA?: (boolean | { - [key: string]: Array<(number | string)>; -}); -}; - -/** - * This is a model with one property with a 'all of' relationship - */ -export type CompositionWithAllOfAndNullable = { - propA?: (({ - boolean?: boolean; -} & ModelWithEnum & ModelWithArray & ModelWithDictionary) | null); -}; - -/** - * This is a model with one property with a 'any of' relationship - */ -export type CompositionWithAnyOfAndNullable = { - propA?: (({ - boolean?: boolean; -} | ModelWithEnum | ModelWithArray | ModelWithDictionary) | null); -}; - -/** - * This is a base model with two simple optional properties - */ -export type CompositionBaseModel = { - firstName?: string; - lastname?: string; -}; - -/** - * This is a model that extends the base model - */ -export type CompositionExtendedModel = CompositionBaseModel & { - firstName: string; - lastname: string; - age: number; -}; - -/** - * This is a model with one nested property - */ -export type ModelWithProperties = { - required: string; - readonly requiredAndReadOnly: string; - requiredAndNullable: (string) | null; - string?: string; - number?: number; - boolean?: boolean; - reference?: ModelWithString; - 'property with space'?: string; - default?: string; - try?: string; - readonly '@namespace.string'?: string; - readonly '@namespace.integer'?: number; -}; - -/** - * This is a model with one nested property - */ -export type ModelWithNestedProperties = { - readonly first: { - readonly second: { - readonly third: (string) | null; - } | null; - } | null; -}; - -/** - * This is a model with duplicated properties - */ -export type ModelWithDuplicateProperties = { - prop?: ModelWithString; -}; - -/** - * This is a model with ordered properties - */ -export type ModelWithOrderedProperties = { - zebra?: string; - apple?: string; - hawaii?: string; -}; - -/** - * This is a model with duplicated imports - */ -export type ModelWithDuplicateImports = { - propA?: ModelWithString; - propB?: ModelWithString; - propC?: ModelWithString; -}; - -/** - * This is a model that extends another model - */ -export type ModelThatExtends = ModelWithString & { - propExtendsA?: string; - propExtendsB?: ModelWithString; -}; - -/** - * This is a model that extends another model - */ -export type ModelThatExtendsExtends = ModelWithString & ModelThatExtends & { - propExtendsC?: string; - propExtendsD?: ModelWithString; -}; - -/** - * This is a model that contains a some patterns - */ -export type ModelWithPattern = { - key: string; - name: string; - readonly enabled?: boolean; - readonly modified?: string; - id?: string; - text?: string; - patternWithSingleQuotes?: string; - patternWithNewline?: string; - patternWithBacktick?: string; -}; - -export type File = { - readonly id?: string; - readonly updated_at?: string; - readonly created_at?: string; - mime: string; - readonly file?: string; -}; - -export type _default = { - name?: string; -}; - -export type Pageable = { - page?: number; - size?: number; - sort?: Array<(string)>; -}; - -/** - * This is a free-form object without additionalProperties. - */ -export type FreeFormObjectWithoutAdditionalProperties = { - [key: string]: unknown; -}; - -/** - * This is a free-form object with additionalProperties: true. - */ -export type FreeFormObjectWithAdditionalPropertiesEqTrue = { - [key: string]: unknown; -}; - -/** - * This is a free-form object with additionalProperties: {}. - */ -export type FreeFormObjectWithAdditionalPropertiesEqEmptyObject = { - [key: string]: unknown; -}; - -export type ModelWithConst = { - String?: "String"; - number?: 0; - null?: null; - withType?: "Some string"; -}; - -/** - * This is a model with one property and additionalProperties: true - */ -export type ModelWithAdditionalPropertiesEqTrue = { - /** - * This is a simple string property - */ - prop?: string; - [key: string]: unknown | string; -}; - -export type NestedAnyOfArraysNullable = { - nullableArray?: (Array<(string | boolean)> | null); -}; - -export type CompositionWithOneOfAndProperties = ({ - foo: ParameterSimpleParameter; -} | { - bar: NonAsciiStringæøåÆØÅöôêÊ字符串; -}) & { - baz: (number) | null; - qux: number; -}; - -/** - * An object that can be null - */ -export type NullableObject = { - foo?: string; -} | null; - -/** - * Some % character - */ -export type CharactersInDescription = string; - -export type ModelWithNullableObject = { - data?: NullableObject; -}; - -export type ModelWithOneOfEnum = { - foo: 'Bar'; -} | { - foo: 'Baz'; -} | { - foo: 'Qux'; -} | { - content: string; - foo: 'Quux'; -} | { - content: [ - (string), - (string) - ]; - foo: 'Corge'; -}; - -export type foo = 'Bar'; - -export const foo = { - BAR: 'Bar' -} as const; - -export type ModelWithNestedArrayEnumsDataFoo = 'foo' | 'bar'; - -export const ModelWithNestedArrayEnumsDataFoo = { - FOO: 'foo', - BAR: 'bar' -} as const; - -export type ModelWithNestedArrayEnumsDataBar = 'baz' | 'qux'; - -export const ModelWithNestedArrayEnumsDataBar = { - BAZ: 'baz', - QUX: 'qux' -} as const; - -export type ModelWithNestedArrayEnumsData = { - foo?: Array; - bar?: Array; -}; - -export type ModelWithNestedArrayEnums = { - array_strings?: Array<(string)>; - data?: (ModelWithNestedArrayEnumsData); -}; - -export type ModelWithNestedCompositionEnums = { - foo?: (ModelWithNestedArrayEnumsDataFoo); -}; - -export type ModelWithReadOnlyAndWriteOnly = { - foo: string; - readonly bar: string; - baz: string; -}; - -export type ModelWithConstantSizeArray = [ - number, - number -]; - -export type ModelWithAnyOfConstantSizeArray = [ - (number | string), - (number | string), - (number | string) -]; - -export type ModelWithPrefixItemsConstantSizeArray = [ - ModelWithInteger, - (number | string), - string -]; - -export type ModelWithAnyOfConstantSizeArrayNullable = [ - ((number) | null | string), - ((number) | null | string), - ((number) | null | string) -]; - -export type ModelWithAnyOfConstantSizeArrayWithNSizeAndOptions = [ - (number | _import), - (number | _import) -]; - -export type ModelWithAnyOfConstantSizeArrayAndIntersect = [ - (number & string), - (number & string) -]; - -export type ModelWithNumericEnumUnion = { - /** - * Период - */ - value?: -10 | -1 | 0 | 1 | 3 | 6 | 12; -}; - -/** - * Период - */ -export type value = -10 | -1 | 0 | 1 | 3 | 6 | 12; - -/** - * Период - */ -export const value = { - '_-10': -10, - '_-1': -1, - '_0': 0, - '_1': 1, - '_3': 3, - '_6': 6, - '_12': 12 -} as const; - -/** - * Some description with `back ticks` - */ -export type ModelWithBackticksInDescription = { - /** - * The template `that` should be used for parsing and importing the contents of the CSV file. - * - *

There is one placeholder currently supported:

  • ${x} - refers to the n-th column in the CSV file, e.g. ${1}, ${2}, ...)

Example of a correct JSON template:

- *
-     * [
-     * {
-     * "resourceType": "Asset",
-     * "identifier": {
-     * "name": "${1}",
-     * "domain": {
-     * "name": "${2}",
-     * "community": {
-     * "name": "Some Community"
-     * }
-     * }
-     * },
-     * "attributes" : {
-     * "00000000-0000-0000-0000-000000003115" : [ {
-     * "value" : "${3}"
-     * } ],
-     * "00000000-0000-0000-0000-000000000222" : [ {
-     * "value" : "${4}"
-     * } ]
-     * }
-     * }
-     * ]
-     * 
- */ - template?: string; -}; - -export type ModelWithOneOfAndProperties = (ParameterSimpleParameter | NonAsciiStringæøåÆØÅöôêÊ字符串) & { - baz: (number) | null; - qux: number; -}; - -/** - * Model used to test deduplication strategy (unused) - */ -export type ParameterSimpleParameterUnused = string; - -/** - * Model used to test deduplication strategy - */ -export type PostServiceWithEmptyTagResponse = string; - -/** - * Model used to test deduplication strategy - */ -export type PostServiceWithEmptyTagResponse2 = string; - -/** - * Model used to test deduplication strategy - */ -export type DeleteFooData = string; - -/** - * Model used to test deduplication strategy - */ -export type DeleteFooData2 = string; - -/** - * Model with restricted keyword name - */ -export type _import = string; - -export type SchemaWithFormRestrictedKeys = { - description?: string; - 'x-enum-descriptions'?: string; - 'x-enum-varnames'?: string; - 'x-enumNames'?: string; - title?: string; - object?: { - description?: string; - 'x-enum-descriptions'?: string; - 'x-enum-varnames'?: string; - 'x-enumNames'?: string; - title?: string; - }; - array?: Array<({ - description?: string; - 'x-enum-descriptions'?: string; - 'x-enum-varnames'?: string; - 'x-enumNames'?: string; - title?: string; -})>; -}; - -/** - * This schema was giving PascalCase transformations a hard time - */ -export type io_k8s_apimachinery_pkg_apis_meta_v1_DeleteOptions = { - /** - * Must be fulfilled before a deletion is carried out. If not possible, a 409 Conflict status will be returned. - */ - preconditions?: (io_k8s_apimachinery_pkg_apis_meta_v1_Preconditions); -}; - -/** - * This schema was giving PascalCase transformations a hard time - */ -export type io_k8s_apimachinery_pkg_apis_meta_v1_Preconditions = { - /** - * Specifies the target ResourceVersion - */ - resourceVersion?: string; - /** - * Specifies the target UID. - */ - uid?: string; -}; - -export type AdditionalPropertiesUnknownIssue = { - [key: string]: (string | number); -}; - -export type AdditionalPropertiesUnknownIssue2 = { - [key: string]: (string | number); -}; - -export type AdditionalPropertiesUnknownIssue3 = string & { - entries: { - [key: string]: AdditionalPropertiesUnknownIssue; - }; -}; - -export type AdditionalPropertiesIntegerIssue = { - value: number; - [key: string]: (number) | undefined; -}; - -export type OneOfAllOfIssue = ((ConstValue | Generic_Schema_Duplicate_Issue_1_System_Boolean_) & _3e_num_1Период) | Generic_Schema_Duplicate_Issue_1_System_String_; - -export type Generic_Schema_Duplicate_Issue_1_System_Boolean_ = { - item?: boolean; - error?: (string) | null; - readonly hasError?: boolean; - data?: { - [key: string]: unknown; - }; -}; - -export type Generic_Schema_Duplicate_Issue_1_System_String_ = { - item?: (string) | null; - error?: (string) | null; - readonly hasError?: boolean; -}; - -/** - * This is a reusable parameter - */ -export type ParameterSimpleParameter = string; - -/** - * Parameter with illegal characters - */ -export type Parameterx_Foo_Bar = ModelWithString; - -export type ImportData = { - body: (ModelWithReadOnlyAndWriteOnly | ModelWithArrayReadOnlyAndWriteOnly); -}; - -export type ImportResponse = (Model_From_Zendesk | ModelWithReadOnlyAndWriteOnly); - -export type ImportError = unknown; - -export type ApiVversionOdataControllerCountResponse = (Model_From_Zendesk); - -export type ApiVversionOdataControllerCountError = unknown; - -export type GetApiVbyApiVersionSimpleOperationData = { - path: { - /** - * foo in method - */ - foo_param: string; - }; -}; - -export type GetApiVbyApiVersionSimpleOperationResponse = (number); - -export type GetApiVbyApiVersionSimpleOperationError = (ModelWithBoolean); - -export type DeleteFooData3 = { - headers: { - /** - * Parameter with illegal characters - */ - 'x-Foo-Bar': ModelWithString; - }; - path: { - /** - * bar in method - */ - BarParam: string; - /** - * foo in method - */ - foo_param: string; - }; -}; - -export type CallWithDescriptionsData = { - query?: { - /** - * Testing backticks in string: `backticks` and ```multiple backticks``` should work - */ - parameterWithBackticks?: unknown; - /** - * Testing multiline comments in string: First line - * Second line - * - * Fourth line - */ - parameterWithBreaks?: unknown; - /** - * Testing expression placeholders in string: ${expression} should work - */ - parameterWithExpressionPlaceholders?: unknown; - /** - * Testing quotes in string: 'single quote''' and "double quotes""" should work - */ - parameterWithQuotes?: unknown; - /** - * Testing reserved characters in string: * inline * and ** inline ** should work - */ - parameterWithReservedCharacters?: unknown; - /** - * Testing slashes in string: \backwards\\\ and /forwards/// should work - */ - parameterWithSlashes?: unknown; - }; -}; - -export type DeprecatedCallData = { - headers: { - /** - * This parameter is deprecated - * @deprecated - */ - parameter: (DeprecatedModel) | null; - }; -}; - -export type CallWithParametersData = { - /** - * This is the parameter that goes into the body - */ - body: { - [key: string]: unknown; - } | null; - headers: { - /** - * This is the parameter that goes into the header - */ - parameterHeader: (string) | null; - }; - path: { - /** - * api-version should be required in standalone clients - */ - 'api-version': (string) | null; - /** - * This is the parameter that goes into the path - */ - parameterPath: (string) | null; - }; - query: { - /** - * This is the parameter that goes into the query params - */ - cursor: (string) | null; - foo_all_of_enum: (ModelWithNestedArrayEnumsDataFoo); - foo_ref_enum?: ModelWithNestedArrayEnumsDataFoo; - }; -}; - -export type CallWithWeirdParameterNamesData = { - /** - * This is the parameter that goes into the body - */ - body: (ModelWithString) | null; - headers: { - /** - * This is the parameter that goes into the request header - */ - 'parameter.header': (string) | null; - }; - path: { - /** - * api-version should be required in standalone clients - */ - 'api-version': (string) | null; - /** - * This is the parameter that goes into the path - */ - 'parameter-path-2'?: string; - /** - * This is the parameter that goes into the path - */ - 'PARAMETER-PATH-3'?: string; - /** - * This is the parameter that goes into the path - */ - 'parameter.path.1'?: string; - }; - query: { - /** - * This is the parameter with a reserved keyword - */ - default?: string; - /** - * This is the parameter that goes into the request query params - */ - 'parameter-query': (string) | null; - }; -}; - -export type GetCallWithOptionalParamData = { - /** - * This is a required parameter - */ - body: ModelWithOneOfEnum; - query?: { - /** - * This is an optional parameter - */ - page?: number; - }; -}; - -export type PostCallWithOptionalParamData = { - /** - * This is an optional parameter - */ - body?: { - offset?: (number) | null; - }; - query: { - /** - * This is a required parameter - */ - parameter: Pageable; - }; -}; - -export type PostCallWithOptionalParamResponse = (number | void); - -export type PostCallWithOptionalParamError = unknown; - -export type PostApiVbyApiVersionRequestBodyData = { - /** - * A reusable request body - */ - body?: ModelWithString; - query?: { - /** - * This is a reusable parameter - */ - parameter?: string; - }; -}; - -export type PostApiVbyApiVersionFormDataData = { - /** - * A reusable request body - */ - body?: ModelWithString; - query?: { - /** - * This is a reusable parameter - */ - parameter?: string; - }; -}; - -export type CallWithDefaultParametersData = { - query?: { - /** - * This is a simple boolean with default value - */ - parameterBoolean?: (boolean) | null; - /** - * This is a simple enum with default value - */ - parameterEnum?: 'Success' | 'Warning' | 'Error'; - /** - * This is a simple model with default value - */ - parameterModel?: (ModelWithString) | null; - /** - * This is a simple number with default value - */ - parameterNumber?: (number) | null; - /** - * This is a simple string with default value - */ - parameterString?: (string) | null; - }; -}; - -export type CallWithDefaultOptionalParametersData = { - query?: { - /** - * This is a simple boolean that is optional with default value - */ - parameterBoolean?: boolean; - /** - * This is a simple enum that is optional with default value - */ - parameterEnum?: 'Success' | 'Warning' | 'Error'; - /** - * This is a simple model that is optional with default value - */ - parameterModel?: ModelWithString; - /** - * This is a simple number that is optional with default value - */ - parameterNumber?: number; - /** - * This is a simple string that is optional with default value - */ - parameterString?: string; - }; -}; - -export type CallToTestOrderOfParamsData = { - query: { - /** - * This is a optional string with default - */ - parameterOptionalStringWithDefault?: string; - /** - * This is a optional string with empty default - */ - parameterOptionalStringWithEmptyDefault?: string; - /** - * This is a optional string with no default - */ - parameterOptionalStringWithNoDefault?: string; - /** - * This is a string that can be null with default - */ - parameterStringNullableWithDefault?: (string) | null; - /** - * This is a string that can be null with no default - */ - parameterStringNullableWithNoDefault?: (string) | null; - /** - * This is a string with default - */ - parameterStringWithDefault: string; - /** - * This is a string with empty default - */ - parameterStringWithEmptyDefault: string; - /** - * This is a string with no default - */ - parameterStringWithNoDefault: string; - }; -}; - -export type CallWithNoContentResponseResponse = (void); - -export type CallWithNoContentResponseError = unknown; - -export type CallWithResponseAndNoContentResponseResponse = (number | void); - -export type CallWithResponseAndNoContentResponseError = unknown; - -export type DummyAResponse = (_400); - -export type DummyAError = unknown; - -export type DummyBResponse = (void); - -export type DummyBError = unknown; - -export type CallWithResponseResponse = (_import); - -export type CallWithResponseError = unknown; - -export type CallWithDuplicateResponsesResponse = ((ModelWithBoolean & ModelWithInteger) | ModelWithString); - -export type CallWithDuplicateResponsesError = (ModelWithStringError | DictionaryWithArray | ModelWithBoolean); - -export type CallWithResponsesResponse = ({ - readonly '@namespace.string'?: string; - readonly '@namespace.integer'?: number; - readonly value?: Array; -} | ModelThatExtends | ModelThatExtendsExtends); - -export type CallWithResponsesError = (ModelWithStringError); - -export type CollectionFormatData = { - query: { - /** - * This is an array parameter that is sent as csv format (comma-separated values) - */ - parameterArrayCSV: Array<(string)> | null; - /** - * This is an array parameter that is sent as multi format (multiple parameter instances) - */ - parameterArrayMulti: Array<(string)> | null; - /** - * This is an array parameter that is sent as pipes format (pipe-separated values) - */ - parameterArrayPipes: Array<(string)> | null; - /** - * This is an array parameter that is sent as ssv format (space-separated values) - */ - parameterArraySSV: Array<(string)> | null; - /** - * This is an array parameter that is sent as tsv format (tab-separated values) - */ - parameterArrayTSV: Array<(string)> | null; - }; -}; - -export type TypesData = { - path?: { - /** - * This is a number parameter - */ - id?: number; - }; - query: { - /** - * This is an array parameter - */ - parameterArray: Array<(string)> | null; - /** - * This is a boolean parameter - */ - parameterBoolean: (boolean) | null; - /** - * This is a dictionary parameter - */ - parameterDictionary: { - [key: string]: unknown; - } | null; - /** - * This is an enum parameter - */ - parameterEnum: ('Success' | 'Warning' | 'Error') | null; - /** - * This is a number parameter - */ - parameterNumber: number; - /** - * This is an object parameter - */ - parameterObject: { - [key: string]: unknown; - } | null; - /** - * This is a string parameter - */ - parameterString: (string) | null; - }; -}; - -export type TypesResponse = (number | string | boolean | { - [key: string]: unknown; -}); - -export type TypesError = unknown; - -export type UploadFileData = { - body: (Blob | File); - path: { - /** - * api-version should be required in standalone clients - */ - 'api-version': (string) | null; - }; -}; - -export type UploadFileResponse = (boolean); - -export type UploadFileError = unknown; - -export type FileResponseData = { - path: { - /** - * api-version should be required in standalone clients - */ - 'api-version': string; - id: string; - }; -}; - -export type FileResponseResponse = ((Blob | File)); - -export type FileResponseError = unknown; - -export type ComplexTypesData = { - query: { - /** - * Parameter containing object - */ - parameterObject: { - first?: { - second?: { - third?: string; - }; - }; - }; - /** - * Parameter containing reference - */ - parameterReference: ModelWithString; - }; -}; - -export type ComplexTypesResponse = (Array); - -export type ComplexTypesError = (unknown); - -export type MultipartRequestData = { - body?: { - content?: (Blob | File); - data?: ((ModelWithString) | null); - }; -}; - -export type MultipartResponseResponse = ({ - file?: (Blob | File); - metadata?: { - foo?: string; - bar?: string; - }; -}); - -export type MultipartResponseError = unknown; - -export type ComplexParamsData = { - body?: { - readonly key: (string) | null; - name: (string) | null; - enabled?: boolean; - readonly type: 'Monkey' | 'Horse' | 'Bird'; - listOfModels?: Array | null; - listOfStrings?: Array<(string)> | null; - parameters: (ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary); - readonly user?: { - readonly id?: number; - readonly name?: (string) | null; - }; - }; - path: { - /** - * api-version should be required in standalone clients - */ - 'api-version': string; - id: number; - }; -}; - -export type ComplexParamsResponse = (ModelWithString); - -export type ComplexParamsError = unknown; - -export type CallWithResultFromHeaderResponse = (string); - -export type CallWithResultFromHeaderError = (unknown); - -export type TestErrorCodeData = { - query: { - /** - * Status code to return - */ - status: number; - }; -}; - -export type TestErrorCodeResponse = (unknown); - -export type TestErrorCodeError = (unknown); - -export type NonAsciiæøåÆøÅöôêÊ字符串Data = { - query: { - /** - * Dummy input param - */ - nonAsciiParamæøåÆØÅöôêÊ: number; - }; -}; - -export type NonAsciiæøåÆøÅöôêÊ字符串Response = (Array); - -export type NonAsciiæøåÆøÅöôêÊ字符串Error = unknown; - -export type PutWithFormUrlEncodedData = { - body: ArrayWithStrings; -}; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-solid-query_transform/@tanstack/solid-query.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-solid-query_transform/@tanstack/solid-query.gen.ts.snap deleted file mode 100644 index 19500be46..000000000 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-solid-query_transform/@tanstack/solid-query.gen.ts.snap +++ /dev/null @@ -1,109 +0,0 @@ -// This file is auto-generated by @hey-api/openapi-ts - -import type { Options } from '@hey-api/client-fetch'; -import { queryOptions, type MutationOptions } from '@tanstack/solid-query'; -import type { ParentModelWithDatesError, ParentModelWithDatesResponse, ModelWithDatesError, ModelWithDatesResponse, ModelWithDatesArrayError, ModelWithDatesArrayResponse, ArrayOfDatesError, ArrayOfDatesResponse, DateError, DateResponse, MultipleResponsesError, MultipleResponsesResponse } from '../types.gen'; -import { client, parentModelWithDates, modelWithDates, modelWithDatesArray, arrayOfDates, date, multipleResponses } from '../services.gen'; - -type QueryKey = [ - Pick & { - _id: string; - _infinite?: boolean; - } -]; - -const createQueryKey = (id: string, options?: TOptions, infinite?: boolean): QueryKey[0] => { - const params: QueryKey[0] = { _id: id, baseUrl: (options?.client ?? client).getConfig().baseUrl } as QueryKey[0]; - if (infinite) { - params._infinite = infinite; - } - if (options?.body) { - params.body = options.body; - } - if (options?.headers) { - params.headers = options.headers; - } - if (options?.path) { - params.path = options.path; - } - if (options?.query) { - params.query = options.query; - } - return params; -}; - -export const parentModelWithDatesQueryKey = (options?: Options) => [ - createQueryKey("parentModelWithDates", options) -]; - -export const parentModelWithDatesOptions = (options?: Options) => { return queryOptions({ - queryFn: async ({ queryKey }) => { - const { data } = await parentModelWithDates({ - ...options, - ...queryKey[0], - throwOnError: true - }); - return data; - }, - queryKey: parentModelWithDatesQueryKey(options) -}); }; - -export const parentModelWithDatesMutation = () => { const mutationOptions: MutationOptions = { - mutationFn: async (options) => { - const { data } = await parentModelWithDates({ - ...options, - throwOnError: true - }); - return data; - } -}; return mutationOptions; }; - -export const modelWithDatesMutation = () => { const mutationOptions: MutationOptions = { - mutationFn: async (options) => { - const { data } = await modelWithDates({ - ...options, - throwOnError: true - }); - return data; - } -}; return mutationOptions; }; - -export const modelWithDatesArrayMutation = () => { const mutationOptions: MutationOptions = { - mutationFn: async (options) => { - const { data } = await modelWithDatesArray({ - ...options, - throwOnError: true - }); - return data; - } -}; return mutationOptions; }; - -export const arrayOfDatesMutation = () => { const mutationOptions: MutationOptions = { - mutationFn: async (options) => { - const { data } = await arrayOfDates({ - ...options, - throwOnError: true - }); - return data; - } -}; return mutationOptions; }; - -export const dateMutation = () => { const mutationOptions: MutationOptions = { - mutationFn: async (options) => { - const { data } = await date({ - ...options, - throwOnError: true - }); - return data; - } -}; return mutationOptions; }; - -export const multipleResponsesMutation = () => { const mutationOptions: MutationOptions = { - mutationFn: async (options) => { - const { data } = await multipleResponses({ - ...options, - throwOnError: true - }); - return data; - } -}; return mutationOptions; }; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-solid-query_transform/services.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-solid-query_transform/services.gen.ts.snap deleted file mode 100644 index fcb0cc83f..000000000 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-solid-query_transform/services.gen.ts.snap +++ /dev/null @@ -1,39 +0,0 @@ -// This file is auto-generated by @hey-api/openapi-ts - -import { createClient, createConfig, type Options } from '@hey-api/client-fetch'; -import { type ParentModelWithDatesError, type ParentModelWithDatesResponse, type ModelWithDatesError, type ModelWithDatesResponse, type ModelWithDatesArrayError, type ModelWithDatesArrayResponse, type ArrayOfDatesError, type ArrayOfDatesResponse, type DateError, type DateResponse, type MultipleResponsesError, type MultipleResponsesResponse, ParentModelWithDatesResponseTransformer, ModelWithDatesResponseTransformer, ModelWithDatesArrayResponseTransformer } from './types.gen'; - -export const client = createClient(createConfig()); - -export const parentModelWithDates = (options?: Options) => { return (options?.client ?? client).post({ - ...options, - url: '/api/model-with-dates', - responseTransformer: ParentModelWithDatesResponseTransformer -}); }; - -export const modelWithDates = (options?: Options) => { return (options?.client ?? client).put({ - ...options, - url: '/api/model-with-dates', - responseTransformer: ModelWithDatesResponseTransformer -}); }; - -export const modelWithDatesArray = (options?: Options) => { return (options?.client ?? client).put({ - ...options, - url: '/api/model-with-dates-array', - responseTransformer: ModelWithDatesArrayResponseTransformer -}); }; - -export const arrayOfDates = (options?: Options) => { return (options?.client ?? client).put({ - ...options, - url: '/api/array-of-dates' -}); }; - -export const date = (options?: Options) => { return (options?.client ?? client).put({ - ...options, - url: '/api/date' -}); }; - -export const multipleResponses = (options?: Options) => { return (options?.client ?? client).put({ - ...options, - url: '/api/multiple-responses' -}); }; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-solid-query_transform/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-solid-query_transform/types.gen.ts.snap deleted file mode 100644 index 4f5b1d77e..000000000 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-solid-query_transform/types.gen.ts.snap +++ /dev/null @@ -1,118 +0,0 @@ -// This file is auto-generated by @hey-api/openapi-ts - -/** - * This is a model that contains a some dates - */ -export type SimpleModel = { - id: number; - name: string; - readonly enabled: boolean; -}; - -/** - * This is a model that contains a some dates - */ -export type ModelWithDates = { - id: number; - name: string; - readonly enabled: boolean; - readonly modified: Date; - readonly expires?: Date; -}; - -/** - * This is a model that contains a some dates and arrays - */ -export type ParentModelWithDates = { - id: number; - readonly modified?: Date; - items?: Array; - item?: ModelWithDates; - 'nullable-date'?: Array<(Date | null)>; - simpleItems?: Array; - simpleItem?: SimpleModel; - dates?: Array<(Date)>; - strings?: Array<(string)>; -}; - -export type ParentModelWithDatesResponse = (ParentModelWithDates | unknown); - -export type ParentModelWithDatesError = unknown; - -export type ModelWithDatesResponse = (ModelWithDates); - -export type ModelWithDatesError = unknown; - -export type ModelWithDatesArrayResponse = (Array); - -export type ModelWithDatesArrayError = unknown; - -export type ArrayOfDatesResponse = (Array<(Date)>); - -export type ArrayOfDatesError = unknown; - -export type DateResponse = (Date); - -export type DateError = unknown; - -export type MultipleResponsesResponse = (Array | Array); - -export type MultipleResponsesError = unknown; - -export type ParentModelWithDatesResponseTransformer = (data: any) => Promise; - -export type ParentModelWithDatesModelResponseTransformer = (data: any) => ParentModelWithDates; - -export type ModelWithDatesModelResponseTransformer = (data: any) => ModelWithDates; - -export const ModelWithDatesModelResponseTransformer: ModelWithDatesModelResponseTransformer = data => { - if (data?.modified) { - data.modified = new Date(data.modified); - } - if (data?.expires) { - data.expires = new Date(data.expires); - } - return data; -}; - -export const ParentModelWithDatesModelResponseTransformer: ParentModelWithDatesModelResponseTransformer = data => { - if (data?.modified) { - data.modified = new Date(data.modified); - } - if (Array.isArray(data?.items)) { - data.items.forEach(ModelWithDatesModelResponseTransformer); - } - if (data?.item) { - ModelWithDatesModelResponseTransformer(data.item); - } - if (Array.isArray(data?.['nullable-date'])) { - data['nullable-date'] = data['nullable-date'].map(item => item ? new Date(item) : item); - } - if (Array.isArray(data?.dates)) { - data.dates = data.dates.map(item => item ? new Date(item) : item); - } - return data; -}; - -export const ParentModelWithDatesResponseTransformer: ParentModelWithDatesResponseTransformer = async (data) => { - if (data) { - ParentModelWithDatesModelResponseTransformer(data); - } - return data; -}; - -export type ModelWithDatesResponseTransformer = (data: any) => Promise; - -export const ModelWithDatesResponseTransformer: ModelWithDatesResponseTransformer = async (data) => { - ModelWithDatesModelResponseTransformer(data); - return data; -}; - -export type ModelWithDatesArrayResponseTransformer = (data: any) => Promise; - -export const ModelWithDatesArrayResponseTransformer: ModelWithDatesArrayResponseTransformer = async (data) => { - if (Array.isArray(data)) { - data.forEach(ModelWithDatesModelResponseTransformer); - } - return data; -}; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-svelte-query/index.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-svelte-query/index.ts.snap deleted file mode 100644 index e11f63ca0..000000000 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-svelte-query/index.ts.snap +++ /dev/null @@ -1,3 +0,0 @@ -// This file is auto-generated by @hey-api/openapi-ts -export * from './services.gen'; -export * from './types.gen'; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-svelte-query/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-svelte-query/types.gen.ts.snap deleted file mode 100644 index c0c16d891..000000000 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-svelte-query/types.gen.ts.snap +++ /dev/null @@ -1,1630 +0,0 @@ -// This file is auto-generated by @hey-api/openapi-ts - -/** - * Model with number-only name - */ -export type _400 = string; - -/** - * Testing multiline comments in string: First line - * Second line - * - * Fourth line - */ -export type camelCaseCommentWithBreaks = number; - -/** - * Testing multiline comments in string: First line - * Second line - * - * Fourth line - */ -export type CommentWithBreaks = number; - -/** - * Testing backticks in string: `backticks` and ```multiple backticks``` should work - */ -export type CommentWithBackticks = number; - -/** - * Testing backticks and quotes in string: `backticks`, 'quotes', "double quotes" and ```multiple backticks``` should work - */ -export type CommentWithBackticksAndQuotes = number; - -/** - * Testing slashes in string: \backwards\\\ and /forwards/// should work - */ -export type CommentWithSlashes = number; - -/** - * Testing expression placeholders in string: ${expression} should work - */ -export type CommentWithExpressionPlaceholders = number; - -/** - * Testing quotes in string: 'single quote''' and "double quotes""" should work - */ -export type CommentWithQuotes = number; - -/** - * Testing reserved characters in string: * inline * and ** inline ** should work - */ -export type CommentWithReservedCharacters = number; - -/** - * This is a simple number - */ -export type SimpleInteger = number; - -/** - * This is a simple boolean - */ -export type SimpleBoolean = boolean; - -/** - * This is a simple string - */ -export type SimpleString = string; - -/** - * A string with non-ascii (unicode) characters valid in typescript identifiers (æøåÆØÅöÔèÈ字符串) - */ -export type NonAsciiStringæøåÆØÅöôêÊ字符串 = string; - -/** - * This is a simple file - */ -export type SimpleFile = (Blob | File); - -/** - * This is a simple reference - */ -export type SimpleReference = ModelWithString; - -/** - * This is a simple string - */ -export type SimpleStringWithPattern = (string) | null; - -/** - * This is a simple enum with strings - */ -export type EnumWithStrings = 'Success' | 'Warning' | 'Error' | "'Single Quote'" | '"Double Quotes"' | 'Non-ascii: øæåôöØÆÅÔÖ字符串'; - -/** - * This is a simple enum with strings - */ -export const EnumWithStrings = { - SUCCESS: 'Success', - WARNING: 'Warning', - ERROR: 'Error', - _SINGLE_QUOTE_: "'Single Quote'", - _DOUBLE_QUOTES_: '"Double Quotes"', - 'NON_ASCII__ØÆÅÔÖ_ØÆÅÔÖ字符串': 'Non-ascii: øæåôöØÆÅÔÖ字符串' -} as const; - -export type EnumWithReplacedCharacters = "'Single Quote'" | '"Double Quotes"' | 'øæåôöØÆÅÔÖ字符串' | 3.1 | ''; - -export const EnumWithReplacedCharacters = { - _SINGLE_QUOTE_: "'Single Quote'", - _DOUBLE_QUOTES_: '"Double Quotes"', - 'ØÆÅÔÖ_ØÆÅÔÖ字符串': 'øæåôöØÆÅÔÖ字符串', - '_3.1': 3.1, - EMPTY_STRING: '' -} as const; - -/** - * This is a simple enum with numbers - */ -export type EnumWithNumbers = 1 | 2 | 3 | 1.1 | 1.2 | 1.3 | 100 | 200 | 300 | -100 | -200 | -300 | -1.1 | -1.2 | -1.3; - -/** - * This is a simple enum with numbers - */ -export const EnumWithNumbers = { - '_1': 1, - '_2': 2, - '_3': 3, - '_1.1': 1.1, - '_1.2': 1.2, - '_1.3': 1.3, - '_100': 100, - '_200': 200, - '_300': 300, - '_-100': -100, - '_-200': -200, - '_-300': -300, - '_-1.1': -1.1, - '_-1.2': -1.2, - '_-1.3': -1.3 -} as const; - -/** - * Success=1,Warning=2,Error=3 - */ -export type EnumFromDescription = number; - -/** - * This is a simple enum with numbers - */ -export type EnumWithExtensions = 200 | 400 | 500; - -/** - * This is a simple enum with numbers - */ -export const EnumWithExtensions = { - /** - * Used when the status of something is successful - */ - CUSTOM_SUCCESS: 200, - /** - * Used when the status of something has a warning - */ - CUSTOM_WARNING: 400, - /** - * Used when the status of something has an error - */ - CUSTOM_ERROR: 500 -} as const; - -export type EnumWithXEnumNames = 0 | 1 | 2; - -export const EnumWithXEnumNames = { - zero: 0, - one: 1, - two: 2 -} as const; - -/** - * This is a simple array with numbers - */ -export type ArrayWithNumbers = Array<(number)>; - -/** - * This is a simple array with booleans - */ -export type ArrayWithBooleans = Array<(boolean)>; - -/** - * This is a simple array with strings - */ -export type ArrayWithStrings = Array<(string)>; - -/** - * This is a simple array with references - */ -export type ArrayWithReferences = Array; - -/** - * This is a simple array containing an array - */ -export type ArrayWithArray = Array>; - -/** - * This is a simple array with properties - */ -export type ArrayWithProperties = Array<{ - '16x16'?: camelCaseCommentWithBreaks; - bar?: string; -}>; - -/** - * This is a simple array with any of properties - */ -export type ArrayWithAnyOfProperties = Array<({ - foo?: string; -} | { - bar?: string; -})>; - -export type AnyOfAnyAndNull = { - data?: (unknown | null); -}; - -/** - * This is a simple array with any of properties - */ -export type AnyOfArrays = { - results?: Array<({ - foo?: string; -} | { - bar?: string; -})>; -}; - -/** - * This is a string dictionary - */ -export type DictionaryWithString = { - [key: string]: (string); -}; - -export type DictionaryWithPropertiesAndAdditionalProperties = { - foo?: number; - bar?: boolean; - [key: string]: (string | number | boolean) | undefined; -}; - -/** - * This is a string reference - */ -export type DictionaryWithReference = { - [key: string]: ModelWithString; -}; - -/** - * This is a complex dictionary - */ -export type DictionaryWithArray = { - [key: string]: Array; -}; - -/** - * This is a string dictionary - */ -export type DictionaryWithDictionary = { - [key: string]: { - [key: string]: (string); - }; -}; - -/** - * This is a complex dictionary - */ -export type DictionaryWithProperties = { - [key: string]: { - foo?: string; - bar?: string; - }; -}; - -/** - * This is a model with one number property - */ -export type ModelWithInteger = { - /** - * This is a simple number property - */ - prop?: number; -}; - -/** - * This is a model with one boolean property - */ -export type ModelWithBoolean = { - /** - * This is a simple boolean property - */ - prop?: boolean; -}; - -/** - * This is a model with one string property - */ -export type ModelWithString = { - /** - * This is a simple string property - */ - prop?: string; -}; - -/** - * This is a model with one string property - */ -export type ModelWithStringError = { - /** - * This is a simple string property - */ - prop?: string; -}; - -/** - * `Comment` or `VoiceComment`. The JSON object for adding voice comments to tickets is different. See [Adding voice comments to tickets](/documentation/ticketing/managing-tickets/adding-voice-comments-to-tickets) - */ -export type Model_From_Zendesk = string; - -/** - * This is a model with one string property - */ -export type ModelWithNullableString = { - /** - * This is a simple string property - */ - nullableProp1?: (string) | null; - /** - * This is a simple string property - */ - nullableRequiredProp1: (string) | null; - /** - * This is a simple string property - */ - nullableProp2?: (string) | null; - /** - * This is a simple string property - */ - nullableRequiredProp2: (string) | null; - /** - * This is a simple enum with strings - */ - 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; -}; - -/** - * This is a simple enum with strings - */ -export type foo_bar_enum = 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; - -/** - * This is a simple enum with strings - */ -export const foo_bar_enum = { - SUCCESS: 'Success', - WARNING: 'Warning', - ERROR: 'Error', - 'ØÆÅ字符串': 'ØÆÅ字符串' -} as const; - -/** - * This is a model with one enum - */ -export type ModelWithEnum = { - /** - * This is a simple enum with strings - */ - 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; - /** - * These are the HTTP error code enums - */ - statusCode?: '100' | '200 FOO' | '300 FOO_BAR' | '400 foo-bar' | '500 foo.bar' | '600 foo&bar'; - /** - * Simple boolean enum - */ - bool?: boolean; -}; - -/** - * These are the HTTP error code enums - */ -export type statusCode = '100' | '200 FOO' | '300 FOO_BAR' | '400 foo-bar' | '500 foo.bar' | '600 foo&bar'; - -/** - * These are the HTTP error code enums - */ -export const statusCode = { - _100: '100', - _200_FOO: '200 FOO', - _300_FOO_BAR: '300 FOO_BAR', - _400_FOO_BAR: '400 foo-bar', - _500_FOO_BAR: '500 foo.bar', - _600_FOO_BAR: '600 foo&bar' -} as const; - -/** - * This is a model with one enum with escaped name - */ -export type ModelWithEnumWithHyphen = { - 'foo-bar-baz-qux'?: '3.0'; -}; - -export type foo_bar_baz_qux = '3.0'; - -export const foo_bar_baz_qux = { - _3_0: '3.0' -} as const; - -/** - * This is a model with one enum - */ -export type ModelWithEnumFromDescription = { - /** - * Success=1,Warning=2,Error=3 - */ - test?: number; -}; - -/** - * This is a model with nested enums - */ -export type ModelWithNestedEnums = { - dictionaryWithEnum?: { - [key: string]: ('Success' | 'Warning' | 'Error'); - }; - dictionaryWithEnumFromDescription?: { - [key: string]: (number); - }; - arrayWithEnum?: Array<('Success' | 'Warning' | 'Error')>; - arrayWithDescription?: Array<(number)>; - /** - * This is a simple enum with strings - */ - 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; -}; - -/** - * This is a model with one property containing a reference - */ -export type ModelWithReference = { - prop?: ModelWithProperties; -}; - -/** - * This is a model with one property containing an array - */ -export type ModelWithArrayReadOnlyAndWriteOnly = { - prop?: Array; - propWithFile?: Array<((Blob | File))>; - propWithNumber?: Array<(number)>; -}; - -/** - * This is a model with one property containing an array - */ -export type ModelWithArray = { - prop?: Array; - propWithFile?: Array<((Blob | File))>; - propWithNumber?: Array<(number)>; -}; - -/** - * This is a model with one property containing a dictionary - */ -export type ModelWithDictionary = { - prop?: { - [key: string]: (string); - }; -}; - -/** - * This is a deprecated model with a deprecated property - * @deprecated - */ -export type DeprecatedModel = { - /** - * This is a deprecated property - * @deprecated - */ - prop?: string; -}; - -/** - * This is a model with one property containing a circular reference - */ -export type ModelWithCircularReference = { - prop?: ModelWithCircularReference; -}; - -/** - * This is a model with one property with a 'one of' relationship - */ -export type CompositionWithOneOf = { - propA?: (ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary); -}; - -/** - * This is a model with one property with a 'one of' relationship where the options are not $ref - */ -export type CompositionWithOneOfAnonymous = { - propA?: ({ - propA?: string; -} | string | number); -}; - -/** - * Circle - */ -export type ModelCircle = { - kind: 'circle'; - radius?: number; -}; - -/** - * Square - */ -export type ModelSquare = { - kind: 'square'; - sideLength?: number; -}; - -/** - * This is a model with one property with a 'one of' relationship where the options are not $ref - */ -export type CompositionWithOneOfDiscriminator = ModelCircle | ModelSquare; - -/** - * This is a model with one property with a 'any of' relationship - */ -export type CompositionWithAnyOf = { - propA?: (ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary); -}; - -/** - * This is a model with one property with a 'any of' relationship where the options are not $ref - */ -export type CompositionWithAnyOfAnonymous = { - propA?: ({ - propA?: string; -} | string | number); -}; - -/** - * This is a model with nested 'any of' property with a type null - */ -export type CompositionWithNestedAnyAndTypeNull = { - propA?: (Array<(ModelWithDictionary | null)> | Array<(ModelWithArray | null)>); -}; - -export type _3e_num_1Период = 'Bird' | 'Dog'; - -export const _3e_num_1Период = { - BIRD: 'Bird', - DOG: 'Dog' -} as const; - -export type ConstValue = "ConstValue"; - -/** - * This is a model with one property with a 'any of' relationship where the options are not $ref - */ -export type CompositionWithNestedAnyOfAndNull = { - propA?: (Array<(_3e_num_1Период | ConstValue)> | null); -}; - -/** - * This is a model with one property with a 'one of' relationship - */ -export type CompositionWithOneOfAndNullable = { - propA?: (({ - boolean?: boolean; -} | ModelWithEnum | ModelWithArray | ModelWithDictionary) | null); -}; - -/** - * This is a model that contains a simple dictionary within composition - */ -export type CompositionWithOneOfAndSimpleDictionary = { - propA?: (boolean | { - [key: string]: (number); -}); -}; - -/** - * This is a model that contains a dictionary of simple arrays within composition - */ -export type CompositionWithOneOfAndSimpleArrayDictionary = { - propA?: (boolean | { - [key: string]: Array<(boolean)>; -}); -}; - -/** - * This is a model that contains a dictionary of complex arrays (composited) within composition - */ -export type CompositionWithOneOfAndComplexArrayDictionary = { - propA?: (boolean | { - [key: string]: Array<(number | string)>; -}); -}; - -/** - * This is a model with one property with a 'all of' relationship - */ -export type CompositionWithAllOfAndNullable = { - propA?: (({ - boolean?: boolean; -} & ModelWithEnum & ModelWithArray & ModelWithDictionary) | null); -}; - -/** - * This is a model with one property with a 'any of' relationship - */ -export type CompositionWithAnyOfAndNullable = { - propA?: (({ - boolean?: boolean; -} | ModelWithEnum | ModelWithArray | ModelWithDictionary) | null); -}; - -/** - * This is a base model with two simple optional properties - */ -export type CompositionBaseModel = { - firstName?: string; - lastname?: string; -}; - -/** - * This is a model that extends the base model - */ -export type CompositionExtendedModel = CompositionBaseModel & { - firstName: string; - lastname: string; - age: number; -}; - -/** - * This is a model with one nested property - */ -export type ModelWithProperties = { - required: string; - readonly requiredAndReadOnly: string; - requiredAndNullable: (string) | null; - string?: string; - number?: number; - boolean?: boolean; - reference?: ModelWithString; - 'property with space'?: string; - default?: string; - try?: string; - readonly '@namespace.string'?: string; - readonly '@namespace.integer'?: number; -}; - -/** - * This is a model with one nested property - */ -export type ModelWithNestedProperties = { - readonly first: { - readonly second: { - readonly third: (string) | null; - } | null; - } | null; -}; - -/** - * This is a model with duplicated properties - */ -export type ModelWithDuplicateProperties = { - prop?: ModelWithString; -}; - -/** - * This is a model with ordered properties - */ -export type ModelWithOrderedProperties = { - zebra?: string; - apple?: string; - hawaii?: string; -}; - -/** - * This is a model with duplicated imports - */ -export type ModelWithDuplicateImports = { - propA?: ModelWithString; - propB?: ModelWithString; - propC?: ModelWithString; -}; - -/** - * This is a model that extends another model - */ -export type ModelThatExtends = ModelWithString & { - propExtendsA?: string; - propExtendsB?: ModelWithString; -}; - -/** - * This is a model that extends another model - */ -export type ModelThatExtendsExtends = ModelWithString & ModelThatExtends & { - propExtendsC?: string; - propExtendsD?: ModelWithString; -}; - -/** - * This is a model that contains a some patterns - */ -export type ModelWithPattern = { - key: string; - name: string; - readonly enabled?: boolean; - readonly modified?: string; - id?: string; - text?: string; - patternWithSingleQuotes?: string; - patternWithNewline?: string; - patternWithBacktick?: string; -}; - -export type File = { - readonly id?: string; - readonly updated_at?: string; - readonly created_at?: string; - mime: string; - readonly file?: string; -}; - -export type _default = { - name?: string; -}; - -export type Pageable = { - page?: number; - size?: number; - sort?: Array<(string)>; -}; - -/** - * This is a free-form object without additionalProperties. - */ -export type FreeFormObjectWithoutAdditionalProperties = { - [key: string]: unknown; -}; - -/** - * This is a free-form object with additionalProperties: true. - */ -export type FreeFormObjectWithAdditionalPropertiesEqTrue = { - [key: string]: unknown; -}; - -/** - * This is a free-form object with additionalProperties: {}. - */ -export type FreeFormObjectWithAdditionalPropertiesEqEmptyObject = { - [key: string]: unknown; -}; - -export type ModelWithConst = { - String?: "String"; - number?: 0; - null?: null; - withType?: "Some string"; -}; - -/** - * This is a model with one property and additionalProperties: true - */ -export type ModelWithAdditionalPropertiesEqTrue = { - /** - * This is a simple string property - */ - prop?: string; - [key: string]: unknown | string; -}; - -export type NestedAnyOfArraysNullable = { - nullableArray?: (Array<(string | boolean)> | null); -}; - -export type CompositionWithOneOfAndProperties = ({ - foo: ParameterSimpleParameter; -} | { - bar: NonAsciiStringæøåÆØÅöôêÊ字符串; -}) & { - baz: (number) | null; - qux: number; -}; - -/** - * An object that can be null - */ -export type NullableObject = { - foo?: string; -} | null; - -/** - * Some % character - */ -export type CharactersInDescription = string; - -export type ModelWithNullableObject = { - data?: NullableObject; -}; - -export type ModelWithOneOfEnum = { - foo: 'Bar'; -} | { - foo: 'Baz'; -} | { - foo: 'Qux'; -} | { - content: string; - foo: 'Quux'; -} | { - content: [ - (string), - (string) - ]; - foo: 'Corge'; -}; - -export type foo = 'Bar'; - -export const foo = { - BAR: 'Bar' -} as const; - -export type ModelWithNestedArrayEnumsDataFoo = 'foo' | 'bar'; - -export const ModelWithNestedArrayEnumsDataFoo = { - FOO: 'foo', - BAR: 'bar' -} as const; - -export type ModelWithNestedArrayEnumsDataBar = 'baz' | 'qux'; - -export const ModelWithNestedArrayEnumsDataBar = { - BAZ: 'baz', - QUX: 'qux' -} as const; - -export type ModelWithNestedArrayEnumsData = { - foo?: Array; - bar?: Array; -}; - -export type ModelWithNestedArrayEnums = { - array_strings?: Array<(string)>; - data?: (ModelWithNestedArrayEnumsData); -}; - -export type ModelWithNestedCompositionEnums = { - foo?: (ModelWithNestedArrayEnumsDataFoo); -}; - -export type ModelWithReadOnlyAndWriteOnly = { - foo: string; - readonly bar: string; - baz: string; -}; - -export type ModelWithConstantSizeArray = [ - number, - number -]; - -export type ModelWithAnyOfConstantSizeArray = [ - (number | string), - (number | string), - (number | string) -]; - -export type ModelWithPrefixItemsConstantSizeArray = [ - ModelWithInteger, - (number | string), - string -]; - -export type ModelWithAnyOfConstantSizeArrayNullable = [ - ((number) | null | string), - ((number) | null | string), - ((number) | null | string) -]; - -export type ModelWithAnyOfConstantSizeArrayWithNSizeAndOptions = [ - (number | _import), - (number | _import) -]; - -export type ModelWithAnyOfConstantSizeArrayAndIntersect = [ - (number & string), - (number & string) -]; - -export type ModelWithNumericEnumUnion = { - /** - * Период - */ - value?: -10 | -1 | 0 | 1 | 3 | 6 | 12; -}; - -/** - * Период - */ -export type value = -10 | -1 | 0 | 1 | 3 | 6 | 12; - -/** - * Период - */ -export const value = { - '_-10': -10, - '_-1': -1, - '_0': 0, - '_1': 1, - '_3': 3, - '_6': 6, - '_12': 12 -} as const; - -/** - * Some description with `back ticks` - */ -export type ModelWithBackticksInDescription = { - /** - * The template `that` should be used for parsing and importing the contents of the CSV file. - * - *

There is one placeholder currently supported:

  • ${x} - refers to the n-th column in the CSV file, e.g. ${1}, ${2}, ...)

Example of a correct JSON template:

- *
-     * [
-     * {
-     * "resourceType": "Asset",
-     * "identifier": {
-     * "name": "${1}",
-     * "domain": {
-     * "name": "${2}",
-     * "community": {
-     * "name": "Some Community"
-     * }
-     * }
-     * },
-     * "attributes" : {
-     * "00000000-0000-0000-0000-000000003115" : [ {
-     * "value" : "${3}"
-     * } ],
-     * "00000000-0000-0000-0000-000000000222" : [ {
-     * "value" : "${4}"
-     * } ]
-     * }
-     * }
-     * ]
-     * 
- */ - template?: string; -}; - -export type ModelWithOneOfAndProperties = (ParameterSimpleParameter | NonAsciiStringæøåÆØÅöôêÊ字符串) & { - baz: (number) | null; - qux: number; -}; - -/** - * Model used to test deduplication strategy (unused) - */ -export type ParameterSimpleParameterUnused = string; - -/** - * Model used to test deduplication strategy - */ -export type PostServiceWithEmptyTagResponse = string; - -/** - * Model used to test deduplication strategy - */ -export type PostServiceWithEmptyTagResponse2 = string; - -/** - * Model used to test deduplication strategy - */ -export type DeleteFooData = string; - -/** - * Model used to test deduplication strategy - */ -export type DeleteFooData2 = string; - -/** - * Model with restricted keyword name - */ -export type _import = string; - -export type SchemaWithFormRestrictedKeys = { - description?: string; - 'x-enum-descriptions'?: string; - 'x-enum-varnames'?: string; - 'x-enumNames'?: string; - title?: string; - object?: { - description?: string; - 'x-enum-descriptions'?: string; - 'x-enum-varnames'?: string; - 'x-enumNames'?: string; - title?: string; - }; - array?: Array<({ - description?: string; - 'x-enum-descriptions'?: string; - 'x-enum-varnames'?: string; - 'x-enumNames'?: string; - title?: string; -})>; -}; - -/** - * This schema was giving PascalCase transformations a hard time - */ -export type io_k8s_apimachinery_pkg_apis_meta_v1_DeleteOptions = { - /** - * Must be fulfilled before a deletion is carried out. If not possible, a 409 Conflict status will be returned. - */ - preconditions?: (io_k8s_apimachinery_pkg_apis_meta_v1_Preconditions); -}; - -/** - * This schema was giving PascalCase transformations a hard time - */ -export type io_k8s_apimachinery_pkg_apis_meta_v1_Preconditions = { - /** - * Specifies the target ResourceVersion - */ - resourceVersion?: string; - /** - * Specifies the target UID. - */ - uid?: string; -}; - -export type AdditionalPropertiesUnknownIssue = { - [key: string]: (string | number); -}; - -export type AdditionalPropertiesUnknownIssue2 = { - [key: string]: (string | number); -}; - -export type AdditionalPropertiesUnknownIssue3 = string & { - entries: { - [key: string]: AdditionalPropertiesUnknownIssue; - }; -}; - -export type AdditionalPropertiesIntegerIssue = { - value: number; - [key: string]: (number) | undefined; -}; - -export type OneOfAllOfIssue = ((ConstValue | Generic_Schema_Duplicate_Issue_1_System_Boolean_) & _3e_num_1Период) | Generic_Schema_Duplicate_Issue_1_System_String_; - -export type Generic_Schema_Duplicate_Issue_1_System_Boolean_ = { - item?: boolean; - error?: (string) | null; - readonly hasError?: boolean; - data?: { - [key: string]: unknown; - }; -}; - -export type Generic_Schema_Duplicate_Issue_1_System_String_ = { - item?: (string) | null; - error?: (string) | null; - readonly hasError?: boolean; -}; - -/** - * This is a reusable parameter - */ -export type ParameterSimpleParameter = string; - -/** - * Parameter with illegal characters - */ -export type Parameterx_Foo_Bar = ModelWithString; - -export type ImportData = { - body: (ModelWithReadOnlyAndWriteOnly | ModelWithArrayReadOnlyAndWriteOnly); -}; - -export type ImportResponse = (Model_From_Zendesk | ModelWithReadOnlyAndWriteOnly); - -export type ImportError = unknown; - -export type ApiVversionOdataControllerCountResponse = (Model_From_Zendesk); - -export type ApiVversionOdataControllerCountError = unknown; - -export type GetApiVbyApiVersionSimpleOperationData = { - path: { - /** - * foo in method - */ - foo_param: string; - }; -}; - -export type GetApiVbyApiVersionSimpleOperationResponse = (number); - -export type GetApiVbyApiVersionSimpleOperationError = (ModelWithBoolean); - -export type DeleteFooData3 = { - headers: { - /** - * Parameter with illegal characters - */ - 'x-Foo-Bar': ModelWithString; - }; - path: { - /** - * bar in method - */ - BarParam: string; - /** - * foo in method - */ - foo_param: string; - }; -}; - -export type CallWithDescriptionsData = { - query?: { - /** - * Testing backticks in string: `backticks` and ```multiple backticks``` should work - */ - parameterWithBackticks?: unknown; - /** - * Testing multiline comments in string: First line - * Second line - * - * Fourth line - */ - parameterWithBreaks?: unknown; - /** - * Testing expression placeholders in string: ${expression} should work - */ - parameterWithExpressionPlaceholders?: unknown; - /** - * Testing quotes in string: 'single quote''' and "double quotes""" should work - */ - parameterWithQuotes?: unknown; - /** - * Testing reserved characters in string: * inline * and ** inline ** should work - */ - parameterWithReservedCharacters?: unknown; - /** - * Testing slashes in string: \backwards\\\ and /forwards/// should work - */ - parameterWithSlashes?: unknown; - }; -}; - -export type DeprecatedCallData = { - headers: { - /** - * This parameter is deprecated - * @deprecated - */ - parameter: (DeprecatedModel) | null; - }; -}; - -export type CallWithParametersData = { - /** - * This is the parameter that goes into the body - */ - body: { - [key: string]: unknown; - } | null; - headers: { - /** - * This is the parameter that goes into the header - */ - parameterHeader: (string) | null; - }; - path: { - /** - * api-version should be required in standalone clients - */ - 'api-version': (string) | null; - /** - * This is the parameter that goes into the path - */ - parameterPath: (string) | null; - }; - query: { - /** - * This is the parameter that goes into the query params - */ - cursor: (string) | null; - foo_all_of_enum: (ModelWithNestedArrayEnumsDataFoo); - foo_ref_enum?: ModelWithNestedArrayEnumsDataFoo; - }; -}; - -export type CallWithWeirdParameterNamesData = { - /** - * This is the parameter that goes into the body - */ - body: (ModelWithString) | null; - headers: { - /** - * This is the parameter that goes into the request header - */ - 'parameter.header': (string) | null; - }; - path: { - /** - * api-version should be required in standalone clients - */ - 'api-version': (string) | null; - /** - * This is the parameter that goes into the path - */ - 'parameter-path-2'?: string; - /** - * This is the parameter that goes into the path - */ - 'PARAMETER-PATH-3'?: string; - /** - * This is the parameter that goes into the path - */ - 'parameter.path.1'?: string; - }; - query: { - /** - * This is the parameter with a reserved keyword - */ - default?: string; - /** - * This is the parameter that goes into the request query params - */ - 'parameter-query': (string) | null; - }; -}; - -export type GetCallWithOptionalParamData = { - /** - * This is a required parameter - */ - body: ModelWithOneOfEnum; - query?: { - /** - * This is an optional parameter - */ - page?: number; - }; -}; - -export type PostCallWithOptionalParamData = { - /** - * This is an optional parameter - */ - body?: { - offset?: (number) | null; - }; - query: { - /** - * This is a required parameter - */ - parameter: Pageable; - }; -}; - -export type PostCallWithOptionalParamResponse = (number | void); - -export type PostCallWithOptionalParamError = unknown; - -export type PostApiVbyApiVersionRequestBodyData = { - /** - * A reusable request body - */ - body?: ModelWithString; - query?: { - /** - * This is a reusable parameter - */ - parameter?: string; - }; -}; - -export type PostApiVbyApiVersionFormDataData = { - /** - * A reusable request body - */ - body?: ModelWithString; - query?: { - /** - * This is a reusable parameter - */ - parameter?: string; - }; -}; - -export type CallWithDefaultParametersData = { - query?: { - /** - * This is a simple boolean with default value - */ - parameterBoolean?: (boolean) | null; - /** - * This is a simple enum with default value - */ - parameterEnum?: 'Success' | 'Warning' | 'Error'; - /** - * This is a simple model with default value - */ - parameterModel?: (ModelWithString) | null; - /** - * This is a simple number with default value - */ - parameterNumber?: (number) | null; - /** - * This is a simple string with default value - */ - parameterString?: (string) | null; - }; -}; - -export type CallWithDefaultOptionalParametersData = { - query?: { - /** - * This is a simple boolean that is optional with default value - */ - parameterBoolean?: boolean; - /** - * This is a simple enum that is optional with default value - */ - parameterEnum?: 'Success' | 'Warning' | 'Error'; - /** - * This is a simple model that is optional with default value - */ - parameterModel?: ModelWithString; - /** - * This is a simple number that is optional with default value - */ - parameterNumber?: number; - /** - * This is a simple string that is optional with default value - */ - parameterString?: string; - }; -}; - -export type CallToTestOrderOfParamsData = { - query: { - /** - * This is a optional string with default - */ - parameterOptionalStringWithDefault?: string; - /** - * This is a optional string with empty default - */ - parameterOptionalStringWithEmptyDefault?: string; - /** - * This is a optional string with no default - */ - parameterOptionalStringWithNoDefault?: string; - /** - * This is a string that can be null with default - */ - parameterStringNullableWithDefault?: (string) | null; - /** - * This is a string that can be null with no default - */ - parameterStringNullableWithNoDefault?: (string) | null; - /** - * This is a string with default - */ - parameterStringWithDefault: string; - /** - * This is a string with empty default - */ - parameterStringWithEmptyDefault: string; - /** - * This is a string with no default - */ - parameterStringWithNoDefault: string; - }; -}; - -export type CallWithNoContentResponseResponse = (void); - -export type CallWithNoContentResponseError = unknown; - -export type CallWithResponseAndNoContentResponseResponse = (number | void); - -export type CallWithResponseAndNoContentResponseError = unknown; - -export type DummyAResponse = (_400); - -export type DummyAError = unknown; - -export type DummyBResponse = (void); - -export type DummyBError = unknown; - -export type CallWithResponseResponse = (_import); - -export type CallWithResponseError = unknown; - -export type CallWithDuplicateResponsesResponse = ((ModelWithBoolean & ModelWithInteger) | ModelWithString); - -export type CallWithDuplicateResponsesError = (ModelWithStringError | DictionaryWithArray | ModelWithBoolean); - -export type CallWithResponsesResponse = ({ - readonly '@namespace.string'?: string; - readonly '@namespace.integer'?: number; - readonly value?: Array; -} | ModelThatExtends | ModelThatExtendsExtends); - -export type CallWithResponsesError = (ModelWithStringError); - -export type CollectionFormatData = { - query: { - /** - * This is an array parameter that is sent as csv format (comma-separated values) - */ - parameterArrayCSV: Array<(string)> | null; - /** - * This is an array parameter that is sent as multi format (multiple parameter instances) - */ - parameterArrayMulti: Array<(string)> | null; - /** - * This is an array parameter that is sent as pipes format (pipe-separated values) - */ - parameterArrayPipes: Array<(string)> | null; - /** - * This is an array parameter that is sent as ssv format (space-separated values) - */ - parameterArraySSV: Array<(string)> | null; - /** - * This is an array parameter that is sent as tsv format (tab-separated values) - */ - parameterArrayTSV: Array<(string)> | null; - }; -}; - -export type TypesData = { - path?: { - /** - * This is a number parameter - */ - id?: number; - }; - query: { - /** - * This is an array parameter - */ - parameterArray: Array<(string)> | null; - /** - * This is a boolean parameter - */ - parameterBoolean: (boolean) | null; - /** - * This is a dictionary parameter - */ - parameterDictionary: { - [key: string]: unknown; - } | null; - /** - * This is an enum parameter - */ - parameterEnum: ('Success' | 'Warning' | 'Error') | null; - /** - * This is a number parameter - */ - parameterNumber: number; - /** - * This is an object parameter - */ - parameterObject: { - [key: string]: unknown; - } | null; - /** - * This is a string parameter - */ - parameterString: (string) | null; - }; -}; - -export type TypesResponse = (number | string | boolean | { - [key: string]: unknown; -}); - -export type TypesError = unknown; - -export type UploadFileData = { - body: (Blob | File); - path: { - /** - * api-version should be required in standalone clients - */ - 'api-version': (string) | null; - }; -}; - -export type UploadFileResponse = (boolean); - -export type UploadFileError = unknown; - -export type FileResponseData = { - path: { - /** - * api-version should be required in standalone clients - */ - 'api-version': string; - id: string; - }; -}; - -export type FileResponseResponse = ((Blob | File)); - -export type FileResponseError = unknown; - -export type ComplexTypesData = { - query: { - /** - * Parameter containing object - */ - parameterObject: { - first?: { - second?: { - third?: string; - }; - }; - }; - /** - * Parameter containing reference - */ - parameterReference: ModelWithString; - }; -}; - -export type ComplexTypesResponse = (Array); - -export type ComplexTypesError = (unknown); - -export type MultipartRequestData = { - body?: { - content?: (Blob | File); - data?: ((ModelWithString) | null); - }; -}; - -export type MultipartResponseResponse = ({ - file?: (Blob | File); - metadata?: { - foo?: string; - bar?: string; - }; -}); - -export type MultipartResponseError = unknown; - -export type ComplexParamsData = { - body?: { - readonly key: (string) | null; - name: (string) | null; - enabled?: boolean; - readonly type: 'Monkey' | 'Horse' | 'Bird'; - listOfModels?: Array | null; - listOfStrings?: Array<(string)> | null; - parameters: (ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary); - readonly user?: { - readonly id?: number; - readonly name?: (string) | null; - }; - }; - path: { - /** - * api-version should be required in standalone clients - */ - 'api-version': string; - id: number; - }; -}; - -export type ComplexParamsResponse = (ModelWithString); - -export type ComplexParamsError = unknown; - -export type CallWithResultFromHeaderResponse = (string); - -export type CallWithResultFromHeaderError = (unknown); - -export type TestErrorCodeData = { - query: { - /** - * Status code to return - */ - status: number; - }; -}; - -export type TestErrorCodeResponse = (unknown); - -export type TestErrorCodeError = (unknown); - -export type NonAsciiæøåÆøÅöôêÊ字符串Data = { - query: { - /** - * Dummy input param - */ - nonAsciiParamæøåÆØÅöôêÊ: number; - }; -}; - -export type NonAsciiæøåÆøÅöôêÊ字符串Response = (Array); - -export type NonAsciiæøåÆøÅöôêÊ字符串Error = unknown; - -export type PutWithFormUrlEncodedData = { - body: ArrayWithStrings; -}; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-svelte-query_transform/@tanstack/svelte-query.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-svelte-query_transform/@tanstack/svelte-query.gen.ts.snap deleted file mode 100644 index 4e6ff2100..000000000 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-svelte-query_transform/@tanstack/svelte-query.gen.ts.snap +++ /dev/null @@ -1,109 +0,0 @@ -// This file is auto-generated by @hey-api/openapi-ts - -import type { Options } from '@hey-api/client-fetch'; -import { queryOptions, type MutationOptions } from '@tanstack/svelte-query'; -import type { ParentModelWithDatesError, ParentModelWithDatesResponse, ModelWithDatesError, ModelWithDatesResponse, ModelWithDatesArrayError, ModelWithDatesArrayResponse, ArrayOfDatesError, ArrayOfDatesResponse, DateError, DateResponse, MultipleResponsesError, MultipleResponsesResponse } from '../types.gen'; -import { client, parentModelWithDates, modelWithDates, modelWithDatesArray, arrayOfDates, date, multipleResponses } from '../services.gen'; - -type QueryKey = [ - Pick & { - _id: string; - _infinite?: boolean; - } -]; - -const createQueryKey = (id: string, options?: TOptions, infinite?: boolean): QueryKey[0] => { - const params: QueryKey[0] = { _id: id, baseUrl: (options?.client ?? client).getConfig().baseUrl } as QueryKey[0]; - if (infinite) { - params._infinite = infinite; - } - if (options?.body) { - params.body = options.body; - } - if (options?.headers) { - params.headers = options.headers; - } - if (options?.path) { - params.path = options.path; - } - if (options?.query) { - params.query = options.query; - } - return params; -}; - -export const parentModelWithDatesQueryKey = (options?: Options) => [ - createQueryKey("parentModelWithDates", options) -]; - -export const parentModelWithDatesOptions = (options?: Options) => { return queryOptions({ - queryFn: async ({ queryKey }) => { - const { data } = await parentModelWithDates({ - ...options, - ...queryKey[0], - throwOnError: true - }); - return data; - }, - queryKey: parentModelWithDatesQueryKey(options) -}); }; - -export const parentModelWithDatesMutation = () => { const mutationOptions: MutationOptions = { - mutationFn: async (options) => { - const { data } = await parentModelWithDates({ - ...options, - throwOnError: true - }); - return data; - } -}; return mutationOptions; }; - -export const modelWithDatesMutation = () => { const mutationOptions: MutationOptions = { - mutationFn: async (options) => { - const { data } = await modelWithDates({ - ...options, - throwOnError: true - }); - return data; - } -}; return mutationOptions; }; - -export const modelWithDatesArrayMutation = () => { const mutationOptions: MutationOptions = { - mutationFn: async (options) => { - const { data } = await modelWithDatesArray({ - ...options, - throwOnError: true - }); - return data; - } -}; return mutationOptions; }; - -export const arrayOfDatesMutation = () => { const mutationOptions: MutationOptions = { - mutationFn: async (options) => { - const { data } = await arrayOfDates({ - ...options, - throwOnError: true - }); - return data; - } -}; return mutationOptions; }; - -export const dateMutation = () => { const mutationOptions: MutationOptions = { - mutationFn: async (options) => { - const { data } = await date({ - ...options, - throwOnError: true - }); - return data; - } -}; return mutationOptions; }; - -export const multipleResponsesMutation = () => { const mutationOptions: MutationOptions = { - mutationFn: async (options) => { - const { data } = await multipleResponses({ - ...options, - throwOnError: true - }); - return data; - } -}; return mutationOptions; }; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-svelte-query_transform/index.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-svelte-query_transform/index.ts.snap deleted file mode 100644 index e11f63ca0..000000000 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-svelte-query_transform/index.ts.snap +++ /dev/null @@ -1,3 +0,0 @@ -// This file is auto-generated by @hey-api/openapi-ts -export * from './services.gen'; -export * from './types.gen'; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-svelte-query_transform/services.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-svelte-query_transform/services.gen.ts.snap deleted file mode 100644 index fcb0cc83f..000000000 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-svelte-query_transform/services.gen.ts.snap +++ /dev/null @@ -1,39 +0,0 @@ -// This file is auto-generated by @hey-api/openapi-ts - -import { createClient, createConfig, type Options } from '@hey-api/client-fetch'; -import { type ParentModelWithDatesError, type ParentModelWithDatesResponse, type ModelWithDatesError, type ModelWithDatesResponse, type ModelWithDatesArrayError, type ModelWithDatesArrayResponse, type ArrayOfDatesError, type ArrayOfDatesResponse, type DateError, type DateResponse, type MultipleResponsesError, type MultipleResponsesResponse, ParentModelWithDatesResponseTransformer, ModelWithDatesResponseTransformer, ModelWithDatesArrayResponseTransformer } from './types.gen'; - -export const client = createClient(createConfig()); - -export const parentModelWithDates = (options?: Options) => { return (options?.client ?? client).post({ - ...options, - url: '/api/model-with-dates', - responseTransformer: ParentModelWithDatesResponseTransformer -}); }; - -export const modelWithDates = (options?: Options) => { return (options?.client ?? client).put({ - ...options, - url: '/api/model-with-dates', - responseTransformer: ModelWithDatesResponseTransformer -}); }; - -export const modelWithDatesArray = (options?: Options) => { return (options?.client ?? client).put({ - ...options, - url: '/api/model-with-dates-array', - responseTransformer: ModelWithDatesArrayResponseTransformer -}); }; - -export const arrayOfDates = (options?: Options) => { return (options?.client ?? client).put({ - ...options, - url: '/api/array-of-dates' -}); }; - -export const date = (options?: Options) => { return (options?.client ?? client).put({ - ...options, - url: '/api/date' -}); }; - -export const multipleResponses = (options?: Options) => { return (options?.client ?? client).put({ - ...options, - url: '/api/multiple-responses' -}); }; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-svelte-query_transform/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-svelte-query_transform/types.gen.ts.snap deleted file mode 100644 index 4f5b1d77e..000000000 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-svelte-query_transform/types.gen.ts.snap +++ /dev/null @@ -1,118 +0,0 @@ -// This file is auto-generated by @hey-api/openapi-ts - -/** - * This is a model that contains a some dates - */ -export type SimpleModel = { - id: number; - name: string; - readonly enabled: boolean; -}; - -/** - * This is a model that contains a some dates - */ -export type ModelWithDates = { - id: number; - name: string; - readonly enabled: boolean; - readonly modified: Date; - readonly expires?: Date; -}; - -/** - * This is a model that contains a some dates and arrays - */ -export type ParentModelWithDates = { - id: number; - readonly modified?: Date; - items?: Array; - item?: ModelWithDates; - 'nullable-date'?: Array<(Date | null)>; - simpleItems?: Array; - simpleItem?: SimpleModel; - dates?: Array<(Date)>; - strings?: Array<(string)>; -}; - -export type ParentModelWithDatesResponse = (ParentModelWithDates | unknown); - -export type ParentModelWithDatesError = unknown; - -export type ModelWithDatesResponse = (ModelWithDates); - -export type ModelWithDatesError = unknown; - -export type ModelWithDatesArrayResponse = (Array); - -export type ModelWithDatesArrayError = unknown; - -export type ArrayOfDatesResponse = (Array<(Date)>); - -export type ArrayOfDatesError = unknown; - -export type DateResponse = (Date); - -export type DateError = unknown; - -export type MultipleResponsesResponse = (Array | Array); - -export type MultipleResponsesError = unknown; - -export type ParentModelWithDatesResponseTransformer = (data: any) => Promise; - -export type ParentModelWithDatesModelResponseTransformer = (data: any) => ParentModelWithDates; - -export type ModelWithDatesModelResponseTransformer = (data: any) => ModelWithDates; - -export const ModelWithDatesModelResponseTransformer: ModelWithDatesModelResponseTransformer = data => { - if (data?.modified) { - data.modified = new Date(data.modified); - } - if (data?.expires) { - data.expires = new Date(data.expires); - } - return data; -}; - -export const ParentModelWithDatesModelResponseTransformer: ParentModelWithDatesModelResponseTransformer = data => { - if (data?.modified) { - data.modified = new Date(data.modified); - } - if (Array.isArray(data?.items)) { - data.items.forEach(ModelWithDatesModelResponseTransformer); - } - if (data?.item) { - ModelWithDatesModelResponseTransformer(data.item); - } - if (Array.isArray(data?.['nullable-date'])) { - data['nullable-date'] = data['nullable-date'].map(item => item ? new Date(item) : item); - } - if (Array.isArray(data?.dates)) { - data.dates = data.dates.map(item => item ? new Date(item) : item); - } - return data; -}; - -export const ParentModelWithDatesResponseTransformer: ParentModelWithDatesResponseTransformer = async (data) => { - if (data) { - ParentModelWithDatesModelResponseTransformer(data); - } - return data; -}; - -export type ModelWithDatesResponseTransformer = (data: any) => Promise; - -export const ModelWithDatesResponseTransformer: ModelWithDatesResponseTransformer = async (data) => { - ModelWithDatesModelResponseTransformer(data); - return data; -}; - -export type ModelWithDatesArrayResponseTransformer = (data: any) => Promise; - -export const ModelWithDatesArrayResponseTransformer: ModelWithDatesArrayResponseTransformer = async (data) => { - if (Array.isArray(data)) { - data.forEach(ModelWithDatesModelResponseTransformer); - } - return data; -}; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-vue-query/index.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-vue-query/index.ts.snap deleted file mode 100644 index e11f63ca0..000000000 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-vue-query/index.ts.snap +++ /dev/null @@ -1,3 +0,0 @@ -// This file is auto-generated by @hey-api/openapi-ts -export * from './services.gen'; -export * from './types.gen'; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-vue-query/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-vue-query/types.gen.ts.snap deleted file mode 100644 index c0c16d891..000000000 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-vue-query/types.gen.ts.snap +++ /dev/null @@ -1,1630 +0,0 @@ -// This file is auto-generated by @hey-api/openapi-ts - -/** - * Model with number-only name - */ -export type _400 = string; - -/** - * Testing multiline comments in string: First line - * Second line - * - * Fourth line - */ -export type camelCaseCommentWithBreaks = number; - -/** - * Testing multiline comments in string: First line - * Second line - * - * Fourth line - */ -export type CommentWithBreaks = number; - -/** - * Testing backticks in string: `backticks` and ```multiple backticks``` should work - */ -export type CommentWithBackticks = number; - -/** - * Testing backticks and quotes in string: `backticks`, 'quotes', "double quotes" and ```multiple backticks``` should work - */ -export type CommentWithBackticksAndQuotes = number; - -/** - * Testing slashes in string: \backwards\\\ and /forwards/// should work - */ -export type CommentWithSlashes = number; - -/** - * Testing expression placeholders in string: ${expression} should work - */ -export type CommentWithExpressionPlaceholders = number; - -/** - * Testing quotes in string: 'single quote''' and "double quotes""" should work - */ -export type CommentWithQuotes = number; - -/** - * Testing reserved characters in string: * inline * and ** inline ** should work - */ -export type CommentWithReservedCharacters = number; - -/** - * This is a simple number - */ -export type SimpleInteger = number; - -/** - * This is a simple boolean - */ -export type SimpleBoolean = boolean; - -/** - * This is a simple string - */ -export type SimpleString = string; - -/** - * A string with non-ascii (unicode) characters valid in typescript identifiers (æøåÆØÅöÔèÈ字符串) - */ -export type NonAsciiStringæøåÆØÅöôêÊ字符串 = string; - -/** - * This is a simple file - */ -export type SimpleFile = (Blob | File); - -/** - * This is a simple reference - */ -export type SimpleReference = ModelWithString; - -/** - * This is a simple string - */ -export type SimpleStringWithPattern = (string) | null; - -/** - * This is a simple enum with strings - */ -export type EnumWithStrings = 'Success' | 'Warning' | 'Error' | "'Single Quote'" | '"Double Quotes"' | 'Non-ascii: øæåôöØÆÅÔÖ字符串'; - -/** - * This is a simple enum with strings - */ -export const EnumWithStrings = { - SUCCESS: 'Success', - WARNING: 'Warning', - ERROR: 'Error', - _SINGLE_QUOTE_: "'Single Quote'", - _DOUBLE_QUOTES_: '"Double Quotes"', - 'NON_ASCII__ØÆÅÔÖ_ØÆÅÔÖ字符串': 'Non-ascii: øæåôöØÆÅÔÖ字符串' -} as const; - -export type EnumWithReplacedCharacters = "'Single Quote'" | '"Double Quotes"' | 'øæåôöØÆÅÔÖ字符串' | 3.1 | ''; - -export const EnumWithReplacedCharacters = { - _SINGLE_QUOTE_: "'Single Quote'", - _DOUBLE_QUOTES_: '"Double Quotes"', - 'ØÆÅÔÖ_ØÆÅÔÖ字符串': 'øæåôöØÆÅÔÖ字符串', - '_3.1': 3.1, - EMPTY_STRING: '' -} as const; - -/** - * This is a simple enum with numbers - */ -export type EnumWithNumbers = 1 | 2 | 3 | 1.1 | 1.2 | 1.3 | 100 | 200 | 300 | -100 | -200 | -300 | -1.1 | -1.2 | -1.3; - -/** - * This is a simple enum with numbers - */ -export const EnumWithNumbers = { - '_1': 1, - '_2': 2, - '_3': 3, - '_1.1': 1.1, - '_1.2': 1.2, - '_1.3': 1.3, - '_100': 100, - '_200': 200, - '_300': 300, - '_-100': -100, - '_-200': -200, - '_-300': -300, - '_-1.1': -1.1, - '_-1.2': -1.2, - '_-1.3': -1.3 -} as const; - -/** - * Success=1,Warning=2,Error=3 - */ -export type EnumFromDescription = number; - -/** - * This is a simple enum with numbers - */ -export type EnumWithExtensions = 200 | 400 | 500; - -/** - * This is a simple enum with numbers - */ -export const EnumWithExtensions = { - /** - * Used when the status of something is successful - */ - CUSTOM_SUCCESS: 200, - /** - * Used when the status of something has a warning - */ - CUSTOM_WARNING: 400, - /** - * Used when the status of something has an error - */ - CUSTOM_ERROR: 500 -} as const; - -export type EnumWithXEnumNames = 0 | 1 | 2; - -export const EnumWithXEnumNames = { - zero: 0, - one: 1, - two: 2 -} as const; - -/** - * This is a simple array with numbers - */ -export type ArrayWithNumbers = Array<(number)>; - -/** - * This is a simple array with booleans - */ -export type ArrayWithBooleans = Array<(boolean)>; - -/** - * This is a simple array with strings - */ -export type ArrayWithStrings = Array<(string)>; - -/** - * This is a simple array with references - */ -export type ArrayWithReferences = Array; - -/** - * This is a simple array containing an array - */ -export type ArrayWithArray = Array>; - -/** - * This is a simple array with properties - */ -export type ArrayWithProperties = Array<{ - '16x16'?: camelCaseCommentWithBreaks; - bar?: string; -}>; - -/** - * This is a simple array with any of properties - */ -export type ArrayWithAnyOfProperties = Array<({ - foo?: string; -} | { - bar?: string; -})>; - -export type AnyOfAnyAndNull = { - data?: (unknown | null); -}; - -/** - * This is a simple array with any of properties - */ -export type AnyOfArrays = { - results?: Array<({ - foo?: string; -} | { - bar?: string; -})>; -}; - -/** - * This is a string dictionary - */ -export type DictionaryWithString = { - [key: string]: (string); -}; - -export type DictionaryWithPropertiesAndAdditionalProperties = { - foo?: number; - bar?: boolean; - [key: string]: (string | number | boolean) | undefined; -}; - -/** - * This is a string reference - */ -export type DictionaryWithReference = { - [key: string]: ModelWithString; -}; - -/** - * This is a complex dictionary - */ -export type DictionaryWithArray = { - [key: string]: Array; -}; - -/** - * This is a string dictionary - */ -export type DictionaryWithDictionary = { - [key: string]: { - [key: string]: (string); - }; -}; - -/** - * This is a complex dictionary - */ -export type DictionaryWithProperties = { - [key: string]: { - foo?: string; - bar?: string; - }; -}; - -/** - * This is a model with one number property - */ -export type ModelWithInteger = { - /** - * This is a simple number property - */ - prop?: number; -}; - -/** - * This is a model with one boolean property - */ -export type ModelWithBoolean = { - /** - * This is a simple boolean property - */ - prop?: boolean; -}; - -/** - * This is a model with one string property - */ -export type ModelWithString = { - /** - * This is a simple string property - */ - prop?: string; -}; - -/** - * This is a model with one string property - */ -export type ModelWithStringError = { - /** - * This is a simple string property - */ - prop?: string; -}; - -/** - * `Comment` or `VoiceComment`. The JSON object for adding voice comments to tickets is different. See [Adding voice comments to tickets](/documentation/ticketing/managing-tickets/adding-voice-comments-to-tickets) - */ -export type Model_From_Zendesk = string; - -/** - * This is a model with one string property - */ -export type ModelWithNullableString = { - /** - * This is a simple string property - */ - nullableProp1?: (string) | null; - /** - * This is a simple string property - */ - nullableRequiredProp1: (string) | null; - /** - * This is a simple string property - */ - nullableProp2?: (string) | null; - /** - * This is a simple string property - */ - nullableRequiredProp2: (string) | null; - /** - * This is a simple enum with strings - */ - 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; -}; - -/** - * This is a simple enum with strings - */ -export type foo_bar_enum = 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; - -/** - * This is a simple enum with strings - */ -export const foo_bar_enum = { - SUCCESS: 'Success', - WARNING: 'Warning', - ERROR: 'Error', - 'ØÆÅ字符串': 'ØÆÅ字符串' -} as const; - -/** - * This is a model with one enum - */ -export type ModelWithEnum = { - /** - * This is a simple enum with strings - */ - 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; - /** - * These are the HTTP error code enums - */ - statusCode?: '100' | '200 FOO' | '300 FOO_BAR' | '400 foo-bar' | '500 foo.bar' | '600 foo&bar'; - /** - * Simple boolean enum - */ - bool?: boolean; -}; - -/** - * These are the HTTP error code enums - */ -export type statusCode = '100' | '200 FOO' | '300 FOO_BAR' | '400 foo-bar' | '500 foo.bar' | '600 foo&bar'; - -/** - * These are the HTTP error code enums - */ -export const statusCode = { - _100: '100', - _200_FOO: '200 FOO', - _300_FOO_BAR: '300 FOO_BAR', - _400_FOO_BAR: '400 foo-bar', - _500_FOO_BAR: '500 foo.bar', - _600_FOO_BAR: '600 foo&bar' -} as const; - -/** - * This is a model with one enum with escaped name - */ -export type ModelWithEnumWithHyphen = { - 'foo-bar-baz-qux'?: '3.0'; -}; - -export type foo_bar_baz_qux = '3.0'; - -export const foo_bar_baz_qux = { - _3_0: '3.0' -} as const; - -/** - * This is a model with one enum - */ -export type ModelWithEnumFromDescription = { - /** - * Success=1,Warning=2,Error=3 - */ - test?: number; -}; - -/** - * This is a model with nested enums - */ -export type ModelWithNestedEnums = { - dictionaryWithEnum?: { - [key: string]: ('Success' | 'Warning' | 'Error'); - }; - dictionaryWithEnumFromDescription?: { - [key: string]: (number); - }; - arrayWithEnum?: Array<('Success' | 'Warning' | 'Error')>; - arrayWithDescription?: Array<(number)>; - /** - * This is a simple enum with strings - */ - 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; -}; - -/** - * This is a model with one property containing a reference - */ -export type ModelWithReference = { - prop?: ModelWithProperties; -}; - -/** - * This is a model with one property containing an array - */ -export type ModelWithArrayReadOnlyAndWriteOnly = { - prop?: Array; - propWithFile?: Array<((Blob | File))>; - propWithNumber?: Array<(number)>; -}; - -/** - * This is a model with one property containing an array - */ -export type ModelWithArray = { - prop?: Array; - propWithFile?: Array<((Blob | File))>; - propWithNumber?: Array<(number)>; -}; - -/** - * This is a model with one property containing a dictionary - */ -export type ModelWithDictionary = { - prop?: { - [key: string]: (string); - }; -}; - -/** - * This is a deprecated model with a deprecated property - * @deprecated - */ -export type DeprecatedModel = { - /** - * This is a deprecated property - * @deprecated - */ - prop?: string; -}; - -/** - * This is a model with one property containing a circular reference - */ -export type ModelWithCircularReference = { - prop?: ModelWithCircularReference; -}; - -/** - * This is a model with one property with a 'one of' relationship - */ -export type CompositionWithOneOf = { - propA?: (ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary); -}; - -/** - * This is a model with one property with a 'one of' relationship where the options are not $ref - */ -export type CompositionWithOneOfAnonymous = { - propA?: ({ - propA?: string; -} | string | number); -}; - -/** - * Circle - */ -export type ModelCircle = { - kind: 'circle'; - radius?: number; -}; - -/** - * Square - */ -export type ModelSquare = { - kind: 'square'; - sideLength?: number; -}; - -/** - * This is a model with one property with a 'one of' relationship where the options are not $ref - */ -export type CompositionWithOneOfDiscriminator = ModelCircle | ModelSquare; - -/** - * This is a model with one property with a 'any of' relationship - */ -export type CompositionWithAnyOf = { - propA?: (ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary); -}; - -/** - * This is a model with one property with a 'any of' relationship where the options are not $ref - */ -export type CompositionWithAnyOfAnonymous = { - propA?: ({ - propA?: string; -} | string | number); -}; - -/** - * This is a model with nested 'any of' property with a type null - */ -export type CompositionWithNestedAnyAndTypeNull = { - propA?: (Array<(ModelWithDictionary | null)> | Array<(ModelWithArray | null)>); -}; - -export type _3e_num_1Период = 'Bird' | 'Dog'; - -export const _3e_num_1Период = { - BIRD: 'Bird', - DOG: 'Dog' -} as const; - -export type ConstValue = "ConstValue"; - -/** - * This is a model with one property with a 'any of' relationship where the options are not $ref - */ -export type CompositionWithNestedAnyOfAndNull = { - propA?: (Array<(_3e_num_1Период | ConstValue)> | null); -}; - -/** - * This is a model with one property with a 'one of' relationship - */ -export type CompositionWithOneOfAndNullable = { - propA?: (({ - boolean?: boolean; -} | ModelWithEnum | ModelWithArray | ModelWithDictionary) | null); -}; - -/** - * This is a model that contains a simple dictionary within composition - */ -export type CompositionWithOneOfAndSimpleDictionary = { - propA?: (boolean | { - [key: string]: (number); -}); -}; - -/** - * This is a model that contains a dictionary of simple arrays within composition - */ -export type CompositionWithOneOfAndSimpleArrayDictionary = { - propA?: (boolean | { - [key: string]: Array<(boolean)>; -}); -}; - -/** - * This is a model that contains a dictionary of complex arrays (composited) within composition - */ -export type CompositionWithOneOfAndComplexArrayDictionary = { - propA?: (boolean | { - [key: string]: Array<(number | string)>; -}); -}; - -/** - * This is a model with one property with a 'all of' relationship - */ -export type CompositionWithAllOfAndNullable = { - propA?: (({ - boolean?: boolean; -} & ModelWithEnum & ModelWithArray & ModelWithDictionary) | null); -}; - -/** - * This is a model with one property with a 'any of' relationship - */ -export type CompositionWithAnyOfAndNullable = { - propA?: (({ - boolean?: boolean; -} | ModelWithEnum | ModelWithArray | ModelWithDictionary) | null); -}; - -/** - * This is a base model with two simple optional properties - */ -export type CompositionBaseModel = { - firstName?: string; - lastname?: string; -}; - -/** - * This is a model that extends the base model - */ -export type CompositionExtendedModel = CompositionBaseModel & { - firstName: string; - lastname: string; - age: number; -}; - -/** - * This is a model with one nested property - */ -export type ModelWithProperties = { - required: string; - readonly requiredAndReadOnly: string; - requiredAndNullable: (string) | null; - string?: string; - number?: number; - boolean?: boolean; - reference?: ModelWithString; - 'property with space'?: string; - default?: string; - try?: string; - readonly '@namespace.string'?: string; - readonly '@namespace.integer'?: number; -}; - -/** - * This is a model with one nested property - */ -export type ModelWithNestedProperties = { - readonly first: { - readonly second: { - readonly third: (string) | null; - } | null; - } | null; -}; - -/** - * This is a model with duplicated properties - */ -export type ModelWithDuplicateProperties = { - prop?: ModelWithString; -}; - -/** - * This is a model with ordered properties - */ -export type ModelWithOrderedProperties = { - zebra?: string; - apple?: string; - hawaii?: string; -}; - -/** - * This is a model with duplicated imports - */ -export type ModelWithDuplicateImports = { - propA?: ModelWithString; - propB?: ModelWithString; - propC?: ModelWithString; -}; - -/** - * This is a model that extends another model - */ -export type ModelThatExtends = ModelWithString & { - propExtendsA?: string; - propExtendsB?: ModelWithString; -}; - -/** - * This is a model that extends another model - */ -export type ModelThatExtendsExtends = ModelWithString & ModelThatExtends & { - propExtendsC?: string; - propExtendsD?: ModelWithString; -}; - -/** - * This is a model that contains a some patterns - */ -export type ModelWithPattern = { - key: string; - name: string; - readonly enabled?: boolean; - readonly modified?: string; - id?: string; - text?: string; - patternWithSingleQuotes?: string; - patternWithNewline?: string; - patternWithBacktick?: string; -}; - -export type File = { - readonly id?: string; - readonly updated_at?: string; - readonly created_at?: string; - mime: string; - readonly file?: string; -}; - -export type _default = { - name?: string; -}; - -export type Pageable = { - page?: number; - size?: number; - sort?: Array<(string)>; -}; - -/** - * This is a free-form object without additionalProperties. - */ -export type FreeFormObjectWithoutAdditionalProperties = { - [key: string]: unknown; -}; - -/** - * This is a free-form object with additionalProperties: true. - */ -export type FreeFormObjectWithAdditionalPropertiesEqTrue = { - [key: string]: unknown; -}; - -/** - * This is a free-form object with additionalProperties: {}. - */ -export type FreeFormObjectWithAdditionalPropertiesEqEmptyObject = { - [key: string]: unknown; -}; - -export type ModelWithConst = { - String?: "String"; - number?: 0; - null?: null; - withType?: "Some string"; -}; - -/** - * This is a model with one property and additionalProperties: true - */ -export type ModelWithAdditionalPropertiesEqTrue = { - /** - * This is a simple string property - */ - prop?: string; - [key: string]: unknown | string; -}; - -export type NestedAnyOfArraysNullable = { - nullableArray?: (Array<(string | boolean)> | null); -}; - -export type CompositionWithOneOfAndProperties = ({ - foo: ParameterSimpleParameter; -} | { - bar: NonAsciiStringæøåÆØÅöôêÊ字符串; -}) & { - baz: (number) | null; - qux: number; -}; - -/** - * An object that can be null - */ -export type NullableObject = { - foo?: string; -} | null; - -/** - * Some % character - */ -export type CharactersInDescription = string; - -export type ModelWithNullableObject = { - data?: NullableObject; -}; - -export type ModelWithOneOfEnum = { - foo: 'Bar'; -} | { - foo: 'Baz'; -} | { - foo: 'Qux'; -} | { - content: string; - foo: 'Quux'; -} | { - content: [ - (string), - (string) - ]; - foo: 'Corge'; -}; - -export type foo = 'Bar'; - -export const foo = { - BAR: 'Bar' -} as const; - -export type ModelWithNestedArrayEnumsDataFoo = 'foo' | 'bar'; - -export const ModelWithNestedArrayEnumsDataFoo = { - FOO: 'foo', - BAR: 'bar' -} as const; - -export type ModelWithNestedArrayEnumsDataBar = 'baz' | 'qux'; - -export const ModelWithNestedArrayEnumsDataBar = { - BAZ: 'baz', - QUX: 'qux' -} as const; - -export type ModelWithNestedArrayEnumsData = { - foo?: Array; - bar?: Array; -}; - -export type ModelWithNestedArrayEnums = { - array_strings?: Array<(string)>; - data?: (ModelWithNestedArrayEnumsData); -}; - -export type ModelWithNestedCompositionEnums = { - foo?: (ModelWithNestedArrayEnumsDataFoo); -}; - -export type ModelWithReadOnlyAndWriteOnly = { - foo: string; - readonly bar: string; - baz: string; -}; - -export type ModelWithConstantSizeArray = [ - number, - number -]; - -export type ModelWithAnyOfConstantSizeArray = [ - (number | string), - (number | string), - (number | string) -]; - -export type ModelWithPrefixItemsConstantSizeArray = [ - ModelWithInteger, - (number | string), - string -]; - -export type ModelWithAnyOfConstantSizeArrayNullable = [ - ((number) | null | string), - ((number) | null | string), - ((number) | null | string) -]; - -export type ModelWithAnyOfConstantSizeArrayWithNSizeAndOptions = [ - (number | _import), - (number | _import) -]; - -export type ModelWithAnyOfConstantSizeArrayAndIntersect = [ - (number & string), - (number & string) -]; - -export type ModelWithNumericEnumUnion = { - /** - * Период - */ - value?: -10 | -1 | 0 | 1 | 3 | 6 | 12; -}; - -/** - * Период - */ -export type value = -10 | -1 | 0 | 1 | 3 | 6 | 12; - -/** - * Период - */ -export const value = { - '_-10': -10, - '_-1': -1, - '_0': 0, - '_1': 1, - '_3': 3, - '_6': 6, - '_12': 12 -} as const; - -/** - * Some description with `back ticks` - */ -export type ModelWithBackticksInDescription = { - /** - * The template `that` should be used for parsing and importing the contents of the CSV file. - * - *

There is one placeholder currently supported:

  • ${x} - refers to the n-th column in the CSV file, e.g. ${1}, ${2}, ...)

Example of a correct JSON template:

- *
-     * [
-     * {
-     * "resourceType": "Asset",
-     * "identifier": {
-     * "name": "${1}",
-     * "domain": {
-     * "name": "${2}",
-     * "community": {
-     * "name": "Some Community"
-     * }
-     * }
-     * },
-     * "attributes" : {
-     * "00000000-0000-0000-0000-000000003115" : [ {
-     * "value" : "${3}"
-     * } ],
-     * "00000000-0000-0000-0000-000000000222" : [ {
-     * "value" : "${4}"
-     * } ]
-     * }
-     * }
-     * ]
-     * 
- */ - template?: string; -}; - -export type ModelWithOneOfAndProperties = (ParameterSimpleParameter | NonAsciiStringæøåÆØÅöôêÊ字符串) & { - baz: (number) | null; - qux: number; -}; - -/** - * Model used to test deduplication strategy (unused) - */ -export type ParameterSimpleParameterUnused = string; - -/** - * Model used to test deduplication strategy - */ -export type PostServiceWithEmptyTagResponse = string; - -/** - * Model used to test deduplication strategy - */ -export type PostServiceWithEmptyTagResponse2 = string; - -/** - * Model used to test deduplication strategy - */ -export type DeleteFooData = string; - -/** - * Model used to test deduplication strategy - */ -export type DeleteFooData2 = string; - -/** - * Model with restricted keyword name - */ -export type _import = string; - -export type SchemaWithFormRestrictedKeys = { - description?: string; - 'x-enum-descriptions'?: string; - 'x-enum-varnames'?: string; - 'x-enumNames'?: string; - title?: string; - object?: { - description?: string; - 'x-enum-descriptions'?: string; - 'x-enum-varnames'?: string; - 'x-enumNames'?: string; - title?: string; - }; - array?: Array<({ - description?: string; - 'x-enum-descriptions'?: string; - 'x-enum-varnames'?: string; - 'x-enumNames'?: string; - title?: string; -})>; -}; - -/** - * This schema was giving PascalCase transformations a hard time - */ -export type io_k8s_apimachinery_pkg_apis_meta_v1_DeleteOptions = { - /** - * Must be fulfilled before a deletion is carried out. If not possible, a 409 Conflict status will be returned. - */ - preconditions?: (io_k8s_apimachinery_pkg_apis_meta_v1_Preconditions); -}; - -/** - * This schema was giving PascalCase transformations a hard time - */ -export type io_k8s_apimachinery_pkg_apis_meta_v1_Preconditions = { - /** - * Specifies the target ResourceVersion - */ - resourceVersion?: string; - /** - * Specifies the target UID. - */ - uid?: string; -}; - -export type AdditionalPropertiesUnknownIssue = { - [key: string]: (string | number); -}; - -export type AdditionalPropertiesUnknownIssue2 = { - [key: string]: (string | number); -}; - -export type AdditionalPropertiesUnknownIssue3 = string & { - entries: { - [key: string]: AdditionalPropertiesUnknownIssue; - }; -}; - -export type AdditionalPropertiesIntegerIssue = { - value: number; - [key: string]: (number) | undefined; -}; - -export type OneOfAllOfIssue = ((ConstValue | Generic_Schema_Duplicate_Issue_1_System_Boolean_) & _3e_num_1Период) | Generic_Schema_Duplicate_Issue_1_System_String_; - -export type Generic_Schema_Duplicate_Issue_1_System_Boolean_ = { - item?: boolean; - error?: (string) | null; - readonly hasError?: boolean; - data?: { - [key: string]: unknown; - }; -}; - -export type Generic_Schema_Duplicate_Issue_1_System_String_ = { - item?: (string) | null; - error?: (string) | null; - readonly hasError?: boolean; -}; - -/** - * This is a reusable parameter - */ -export type ParameterSimpleParameter = string; - -/** - * Parameter with illegal characters - */ -export type Parameterx_Foo_Bar = ModelWithString; - -export type ImportData = { - body: (ModelWithReadOnlyAndWriteOnly | ModelWithArrayReadOnlyAndWriteOnly); -}; - -export type ImportResponse = (Model_From_Zendesk | ModelWithReadOnlyAndWriteOnly); - -export type ImportError = unknown; - -export type ApiVversionOdataControllerCountResponse = (Model_From_Zendesk); - -export type ApiVversionOdataControllerCountError = unknown; - -export type GetApiVbyApiVersionSimpleOperationData = { - path: { - /** - * foo in method - */ - foo_param: string; - }; -}; - -export type GetApiVbyApiVersionSimpleOperationResponse = (number); - -export type GetApiVbyApiVersionSimpleOperationError = (ModelWithBoolean); - -export type DeleteFooData3 = { - headers: { - /** - * Parameter with illegal characters - */ - 'x-Foo-Bar': ModelWithString; - }; - path: { - /** - * bar in method - */ - BarParam: string; - /** - * foo in method - */ - foo_param: string; - }; -}; - -export type CallWithDescriptionsData = { - query?: { - /** - * Testing backticks in string: `backticks` and ```multiple backticks``` should work - */ - parameterWithBackticks?: unknown; - /** - * Testing multiline comments in string: First line - * Second line - * - * Fourth line - */ - parameterWithBreaks?: unknown; - /** - * Testing expression placeholders in string: ${expression} should work - */ - parameterWithExpressionPlaceholders?: unknown; - /** - * Testing quotes in string: 'single quote''' and "double quotes""" should work - */ - parameterWithQuotes?: unknown; - /** - * Testing reserved characters in string: * inline * and ** inline ** should work - */ - parameterWithReservedCharacters?: unknown; - /** - * Testing slashes in string: \backwards\\\ and /forwards/// should work - */ - parameterWithSlashes?: unknown; - }; -}; - -export type DeprecatedCallData = { - headers: { - /** - * This parameter is deprecated - * @deprecated - */ - parameter: (DeprecatedModel) | null; - }; -}; - -export type CallWithParametersData = { - /** - * This is the parameter that goes into the body - */ - body: { - [key: string]: unknown; - } | null; - headers: { - /** - * This is the parameter that goes into the header - */ - parameterHeader: (string) | null; - }; - path: { - /** - * api-version should be required in standalone clients - */ - 'api-version': (string) | null; - /** - * This is the parameter that goes into the path - */ - parameterPath: (string) | null; - }; - query: { - /** - * This is the parameter that goes into the query params - */ - cursor: (string) | null; - foo_all_of_enum: (ModelWithNestedArrayEnumsDataFoo); - foo_ref_enum?: ModelWithNestedArrayEnumsDataFoo; - }; -}; - -export type CallWithWeirdParameterNamesData = { - /** - * This is the parameter that goes into the body - */ - body: (ModelWithString) | null; - headers: { - /** - * This is the parameter that goes into the request header - */ - 'parameter.header': (string) | null; - }; - path: { - /** - * api-version should be required in standalone clients - */ - 'api-version': (string) | null; - /** - * This is the parameter that goes into the path - */ - 'parameter-path-2'?: string; - /** - * This is the parameter that goes into the path - */ - 'PARAMETER-PATH-3'?: string; - /** - * This is the parameter that goes into the path - */ - 'parameter.path.1'?: string; - }; - query: { - /** - * This is the parameter with a reserved keyword - */ - default?: string; - /** - * This is the parameter that goes into the request query params - */ - 'parameter-query': (string) | null; - }; -}; - -export type GetCallWithOptionalParamData = { - /** - * This is a required parameter - */ - body: ModelWithOneOfEnum; - query?: { - /** - * This is an optional parameter - */ - page?: number; - }; -}; - -export type PostCallWithOptionalParamData = { - /** - * This is an optional parameter - */ - body?: { - offset?: (number) | null; - }; - query: { - /** - * This is a required parameter - */ - parameter: Pageable; - }; -}; - -export type PostCallWithOptionalParamResponse = (number | void); - -export type PostCallWithOptionalParamError = unknown; - -export type PostApiVbyApiVersionRequestBodyData = { - /** - * A reusable request body - */ - body?: ModelWithString; - query?: { - /** - * This is a reusable parameter - */ - parameter?: string; - }; -}; - -export type PostApiVbyApiVersionFormDataData = { - /** - * A reusable request body - */ - body?: ModelWithString; - query?: { - /** - * This is a reusable parameter - */ - parameter?: string; - }; -}; - -export type CallWithDefaultParametersData = { - query?: { - /** - * This is a simple boolean with default value - */ - parameterBoolean?: (boolean) | null; - /** - * This is a simple enum with default value - */ - parameterEnum?: 'Success' | 'Warning' | 'Error'; - /** - * This is a simple model with default value - */ - parameterModel?: (ModelWithString) | null; - /** - * This is a simple number with default value - */ - parameterNumber?: (number) | null; - /** - * This is a simple string with default value - */ - parameterString?: (string) | null; - }; -}; - -export type CallWithDefaultOptionalParametersData = { - query?: { - /** - * This is a simple boolean that is optional with default value - */ - parameterBoolean?: boolean; - /** - * This is a simple enum that is optional with default value - */ - parameterEnum?: 'Success' | 'Warning' | 'Error'; - /** - * This is a simple model that is optional with default value - */ - parameterModel?: ModelWithString; - /** - * This is a simple number that is optional with default value - */ - parameterNumber?: number; - /** - * This is a simple string that is optional with default value - */ - parameterString?: string; - }; -}; - -export type CallToTestOrderOfParamsData = { - query: { - /** - * This is a optional string with default - */ - parameterOptionalStringWithDefault?: string; - /** - * This is a optional string with empty default - */ - parameterOptionalStringWithEmptyDefault?: string; - /** - * This is a optional string with no default - */ - parameterOptionalStringWithNoDefault?: string; - /** - * This is a string that can be null with default - */ - parameterStringNullableWithDefault?: (string) | null; - /** - * This is a string that can be null with no default - */ - parameterStringNullableWithNoDefault?: (string) | null; - /** - * This is a string with default - */ - parameterStringWithDefault: string; - /** - * This is a string with empty default - */ - parameterStringWithEmptyDefault: string; - /** - * This is a string with no default - */ - parameterStringWithNoDefault: string; - }; -}; - -export type CallWithNoContentResponseResponse = (void); - -export type CallWithNoContentResponseError = unknown; - -export type CallWithResponseAndNoContentResponseResponse = (number | void); - -export type CallWithResponseAndNoContentResponseError = unknown; - -export type DummyAResponse = (_400); - -export type DummyAError = unknown; - -export type DummyBResponse = (void); - -export type DummyBError = unknown; - -export type CallWithResponseResponse = (_import); - -export type CallWithResponseError = unknown; - -export type CallWithDuplicateResponsesResponse = ((ModelWithBoolean & ModelWithInteger) | ModelWithString); - -export type CallWithDuplicateResponsesError = (ModelWithStringError | DictionaryWithArray | ModelWithBoolean); - -export type CallWithResponsesResponse = ({ - readonly '@namespace.string'?: string; - readonly '@namespace.integer'?: number; - readonly value?: Array; -} | ModelThatExtends | ModelThatExtendsExtends); - -export type CallWithResponsesError = (ModelWithStringError); - -export type CollectionFormatData = { - query: { - /** - * This is an array parameter that is sent as csv format (comma-separated values) - */ - parameterArrayCSV: Array<(string)> | null; - /** - * This is an array parameter that is sent as multi format (multiple parameter instances) - */ - parameterArrayMulti: Array<(string)> | null; - /** - * This is an array parameter that is sent as pipes format (pipe-separated values) - */ - parameterArrayPipes: Array<(string)> | null; - /** - * This is an array parameter that is sent as ssv format (space-separated values) - */ - parameterArraySSV: Array<(string)> | null; - /** - * This is an array parameter that is sent as tsv format (tab-separated values) - */ - parameterArrayTSV: Array<(string)> | null; - }; -}; - -export type TypesData = { - path?: { - /** - * This is a number parameter - */ - id?: number; - }; - query: { - /** - * This is an array parameter - */ - parameterArray: Array<(string)> | null; - /** - * This is a boolean parameter - */ - parameterBoolean: (boolean) | null; - /** - * This is a dictionary parameter - */ - parameterDictionary: { - [key: string]: unknown; - } | null; - /** - * This is an enum parameter - */ - parameterEnum: ('Success' | 'Warning' | 'Error') | null; - /** - * This is a number parameter - */ - parameterNumber: number; - /** - * This is an object parameter - */ - parameterObject: { - [key: string]: unknown; - } | null; - /** - * This is a string parameter - */ - parameterString: (string) | null; - }; -}; - -export type TypesResponse = (number | string | boolean | { - [key: string]: unknown; -}); - -export type TypesError = unknown; - -export type UploadFileData = { - body: (Blob | File); - path: { - /** - * api-version should be required in standalone clients - */ - 'api-version': (string) | null; - }; -}; - -export type UploadFileResponse = (boolean); - -export type UploadFileError = unknown; - -export type FileResponseData = { - path: { - /** - * api-version should be required in standalone clients - */ - 'api-version': string; - id: string; - }; -}; - -export type FileResponseResponse = ((Blob | File)); - -export type FileResponseError = unknown; - -export type ComplexTypesData = { - query: { - /** - * Parameter containing object - */ - parameterObject: { - first?: { - second?: { - third?: string; - }; - }; - }; - /** - * Parameter containing reference - */ - parameterReference: ModelWithString; - }; -}; - -export type ComplexTypesResponse = (Array); - -export type ComplexTypesError = (unknown); - -export type MultipartRequestData = { - body?: { - content?: (Blob | File); - data?: ((ModelWithString) | null); - }; -}; - -export type MultipartResponseResponse = ({ - file?: (Blob | File); - metadata?: { - foo?: string; - bar?: string; - }; -}); - -export type MultipartResponseError = unknown; - -export type ComplexParamsData = { - body?: { - readonly key: (string) | null; - name: (string) | null; - enabled?: boolean; - readonly type: 'Monkey' | 'Horse' | 'Bird'; - listOfModels?: Array | null; - listOfStrings?: Array<(string)> | null; - parameters: (ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary); - readonly user?: { - readonly id?: number; - readonly name?: (string) | null; - }; - }; - path: { - /** - * api-version should be required in standalone clients - */ - 'api-version': string; - id: number; - }; -}; - -export type ComplexParamsResponse = (ModelWithString); - -export type ComplexParamsError = unknown; - -export type CallWithResultFromHeaderResponse = (string); - -export type CallWithResultFromHeaderError = (unknown); - -export type TestErrorCodeData = { - query: { - /** - * Status code to return - */ - status: number; - }; -}; - -export type TestErrorCodeResponse = (unknown); - -export type TestErrorCodeError = (unknown); - -export type NonAsciiæøåÆøÅöôêÊ字符串Data = { - query: { - /** - * Dummy input param - */ - nonAsciiParamæøåÆØÅöôêÊ: number; - }; -}; - -export type NonAsciiæøåÆøÅöôêÊ字符串Response = (Array); - -export type NonAsciiæøåÆøÅöôêÊ字符串Error = unknown; - -export type PutWithFormUrlEncodedData = { - body: ArrayWithStrings; -}; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-vue-query_transform/@tanstack/vue-query.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-vue-query_transform/@tanstack/vue-query.gen.ts.snap deleted file mode 100644 index ed6e6c501..000000000 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-vue-query_transform/@tanstack/vue-query.gen.ts.snap +++ /dev/null @@ -1,109 +0,0 @@ -// This file is auto-generated by @hey-api/openapi-ts - -import type { Options } from '@hey-api/client-fetch'; -import { queryOptions, type UseMutationOptions } from '@tanstack/vue-query'; -import type { ParentModelWithDatesError, ParentModelWithDatesResponse, ModelWithDatesError, ModelWithDatesResponse, ModelWithDatesArrayError, ModelWithDatesArrayResponse, ArrayOfDatesError, ArrayOfDatesResponse, DateError, DateResponse, MultipleResponsesError, MultipleResponsesResponse } from '../types.gen'; -import { client, parentModelWithDates, modelWithDates, modelWithDatesArray, arrayOfDates, date, multipleResponses } from '../services.gen'; - -type QueryKey = [ - Pick & { - _id: string; - _infinite?: boolean; - } -]; - -const createQueryKey = (id: string, options?: TOptions, infinite?: boolean): QueryKey[0] => { - const params: QueryKey[0] = { _id: id, baseUrl: (options?.client ?? client).getConfig().baseUrl } as QueryKey[0]; - if (infinite) { - params._infinite = infinite; - } - if (options?.body) { - params.body = options.body; - } - if (options?.headers) { - params.headers = options.headers; - } - if (options?.path) { - params.path = options.path; - } - if (options?.query) { - params.query = options.query; - } - return params; -}; - -export const parentModelWithDatesQueryKey = (options?: Options) => [ - createQueryKey("parentModelWithDates", options) -]; - -export const parentModelWithDatesOptions = (options?: Options) => { return queryOptions({ - queryFn: async ({ queryKey }) => { - const { data } = await parentModelWithDates({ - ...options, - ...queryKey[0], - throwOnError: true - }); - return data; - }, - queryKey: parentModelWithDatesQueryKey(options) -}); }; - -export const parentModelWithDatesMutation = () => { const mutationOptions: UseMutationOptions = { - mutationFn: async (options) => { - const { data } = await parentModelWithDates({ - ...options, - throwOnError: true - }); - return data; - } -}; return mutationOptions; }; - -export const modelWithDatesMutation = () => { const mutationOptions: UseMutationOptions = { - mutationFn: async (options) => { - const { data } = await modelWithDates({ - ...options, - throwOnError: true - }); - return data; - } -}; return mutationOptions; }; - -export const modelWithDatesArrayMutation = () => { const mutationOptions: UseMutationOptions = { - mutationFn: async (options) => { - const { data } = await modelWithDatesArray({ - ...options, - throwOnError: true - }); - return data; - } -}; return mutationOptions; }; - -export const arrayOfDatesMutation = () => { const mutationOptions: UseMutationOptions = { - mutationFn: async (options) => { - const { data } = await arrayOfDates({ - ...options, - throwOnError: true - }); - return data; - } -}; return mutationOptions; }; - -export const dateMutation = () => { const mutationOptions: UseMutationOptions = { - mutationFn: async (options) => { - const { data } = await date({ - ...options, - throwOnError: true - }); - return data; - } -}; return mutationOptions; }; - -export const multipleResponsesMutation = () => { const mutationOptions: UseMutationOptions = { - mutationFn: async (options) => { - const { data } = await multipleResponses({ - ...options, - throwOnError: true - }); - return data; - } -}; return mutationOptions; }; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-vue-query_transform/index.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-vue-query_transform/index.ts.snap deleted file mode 100644 index e11f63ca0..000000000 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-vue-query_transform/index.ts.snap +++ /dev/null @@ -1,3 +0,0 @@ -// This file is auto-generated by @hey-api/openapi-ts -export * from './services.gen'; -export * from './types.gen'; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-vue-query_transform/services.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-vue-query_transform/services.gen.ts.snap deleted file mode 100644 index fcb0cc83f..000000000 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-vue-query_transform/services.gen.ts.snap +++ /dev/null @@ -1,39 +0,0 @@ -// This file is auto-generated by @hey-api/openapi-ts - -import { createClient, createConfig, type Options } from '@hey-api/client-fetch'; -import { type ParentModelWithDatesError, type ParentModelWithDatesResponse, type ModelWithDatesError, type ModelWithDatesResponse, type ModelWithDatesArrayError, type ModelWithDatesArrayResponse, type ArrayOfDatesError, type ArrayOfDatesResponse, type DateError, type DateResponse, type MultipleResponsesError, type MultipleResponsesResponse, ParentModelWithDatesResponseTransformer, ModelWithDatesResponseTransformer, ModelWithDatesArrayResponseTransformer } from './types.gen'; - -export const client = createClient(createConfig()); - -export const parentModelWithDates = (options?: Options) => { return (options?.client ?? client).post({ - ...options, - url: '/api/model-with-dates', - responseTransformer: ParentModelWithDatesResponseTransformer -}); }; - -export const modelWithDates = (options?: Options) => { return (options?.client ?? client).put({ - ...options, - url: '/api/model-with-dates', - responseTransformer: ModelWithDatesResponseTransformer -}); }; - -export const modelWithDatesArray = (options?: Options) => { return (options?.client ?? client).put({ - ...options, - url: '/api/model-with-dates-array', - responseTransformer: ModelWithDatesArrayResponseTransformer -}); }; - -export const arrayOfDates = (options?: Options) => { return (options?.client ?? client).put({ - ...options, - url: '/api/array-of-dates' -}); }; - -export const date = (options?: Options) => { return (options?.client ?? client).put({ - ...options, - url: '/api/date' -}); }; - -export const multipleResponses = (options?: Options) => { return (options?.client ?? client).put({ - ...options, - url: '/api/multiple-responses' -}); }; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-vue-query_transform/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-vue-query_transform/types.gen.ts.snap deleted file mode 100644 index 4f5b1d77e..000000000 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-plugin-tanstack-vue-query_transform/types.gen.ts.snap +++ /dev/null @@ -1,118 +0,0 @@ -// This file is auto-generated by @hey-api/openapi-ts - -/** - * This is a model that contains a some dates - */ -export type SimpleModel = { - id: number; - name: string; - readonly enabled: boolean; -}; - -/** - * This is a model that contains a some dates - */ -export type ModelWithDates = { - id: number; - name: string; - readonly enabled: boolean; - readonly modified: Date; - readonly expires?: Date; -}; - -/** - * This is a model that contains a some dates and arrays - */ -export type ParentModelWithDates = { - id: number; - readonly modified?: Date; - items?: Array; - item?: ModelWithDates; - 'nullable-date'?: Array<(Date | null)>; - simpleItems?: Array; - simpleItem?: SimpleModel; - dates?: Array<(Date)>; - strings?: Array<(string)>; -}; - -export type ParentModelWithDatesResponse = (ParentModelWithDates | unknown); - -export type ParentModelWithDatesError = unknown; - -export type ModelWithDatesResponse = (ModelWithDates); - -export type ModelWithDatesError = unknown; - -export type ModelWithDatesArrayResponse = (Array); - -export type ModelWithDatesArrayError = unknown; - -export type ArrayOfDatesResponse = (Array<(Date)>); - -export type ArrayOfDatesError = unknown; - -export type DateResponse = (Date); - -export type DateError = unknown; - -export type MultipleResponsesResponse = (Array | Array); - -export type MultipleResponsesError = unknown; - -export type ParentModelWithDatesResponseTransformer = (data: any) => Promise; - -export type ParentModelWithDatesModelResponseTransformer = (data: any) => ParentModelWithDates; - -export type ModelWithDatesModelResponseTransformer = (data: any) => ModelWithDates; - -export const ModelWithDatesModelResponseTransformer: ModelWithDatesModelResponseTransformer = data => { - if (data?.modified) { - data.modified = new Date(data.modified); - } - if (data?.expires) { - data.expires = new Date(data.expires); - } - return data; -}; - -export const ParentModelWithDatesModelResponseTransformer: ParentModelWithDatesModelResponseTransformer = data => { - if (data?.modified) { - data.modified = new Date(data.modified); - } - if (Array.isArray(data?.items)) { - data.items.forEach(ModelWithDatesModelResponseTransformer); - } - if (data?.item) { - ModelWithDatesModelResponseTransformer(data.item); - } - if (Array.isArray(data?.['nullable-date'])) { - data['nullable-date'] = data['nullable-date'].map(item => item ? new Date(item) : item); - } - if (Array.isArray(data?.dates)) { - data.dates = data.dates.map(item => item ? new Date(item) : item); - } - return data; -}; - -export const ParentModelWithDatesResponseTransformer: ParentModelWithDatesResponseTransformer = async (data) => { - if (data) { - ParentModelWithDatesModelResponseTransformer(data); - } - return data; -}; - -export type ModelWithDatesResponseTransformer = (data: any) => Promise; - -export const ModelWithDatesResponseTransformer: ModelWithDatesResponseTransformer = async (data) => { - ModelWithDatesModelResponseTransformer(data); - return data; -}; - -export type ModelWithDatesArrayResponseTransformer = (data: any) => Promise; - -export const ModelWithDatesArrayResponseTransformer: ModelWithDatesArrayResponseTransformer = async (data) => { - if (Array.isArray(data)) { - data.forEach(ModelWithDatesModelResponseTransformer); - } - return data; -}; \ No newline at end of file diff --git a/packages/openapi-ts/test/index.spec.ts b/packages/openapi-ts/test/index.spec.ts index 996338245..24873f796 100644 --- a/packages/openapi-ts/test/index.spec.ts +++ b/packages/openapi-ts/test/index.spec.ts @@ -146,38 +146,6 @@ describe('OpenAPI v3', () => { description: 'generate class-based Axios client', name: 'v3-hey-api-client-axios-class', }, - { - config: createConfig({ - client: '@hey-api/client-axios', - plugins: ['@tanstack/react-query'], - }), - description: 'generate Axios client with TanStack React Query plugin', - name: 'v3-hey-api-client-axios-plugin-tanstack-react-query', - }, - { - config: createConfig({ - client: '@hey-api/client-axios', - plugins: ['@tanstack/solid-query'], - }), - description: 'generate Axios client with TanStack Solid Query plugin', - name: 'v3-hey-api-client-axios-plugin-tanstack-solid-query', - }, - { - config: createConfig({ - client: '@hey-api/client-axios', - plugins: ['@tanstack/svelte-query'], - }), - description: 'generate Axios client with TanStack Svelte Query plugin', - name: 'v3-hey-api-client-axios-plugin-tanstack-svelte-query', - }, - { - config: createConfig({ - client: '@hey-api/client-axios', - plugins: ['@tanstack/vue-query'], - }), - description: 'generate Axios client with TanStack Vue Query plugin', - name: 'v3-hey-api-client-axios-plugin-tanstack-vue-query', - }, { config: createConfig({ client: '@hey-api/client-fetch', @@ -205,39 +173,6 @@ describe('OpenAPI v3', () => { description: 'generate class-based Fetch API client', name: 'v3-hey-api-client-fetch-class', }, - { - config: createConfig({ - client: '@hey-api/client-fetch', - plugins: ['@tanstack/react-query'], - }), - description: 'generate Fetch API client with TanStack React Query plugin', - name: 'v3-hey-api-client-fetch-plugin-tanstack-react-query', - }, - { - config: createConfig({ - client: '@hey-api/client-fetch', - plugins: ['@tanstack/solid-query'], - }), - description: 'generate Fetch API client with TanStack Solid Query plugin', - name: 'v3-hey-api-client-fetch-plugin-tanstack-solid-query', - }, - { - config: createConfig({ - client: '@hey-api/client-fetch', - plugins: ['@tanstack/svelte-query'], - }), - description: - 'generate Fetch API client with TanStack Svelte Query plugin', - name: 'v3-hey-api-client-fetch-plugin-tanstack-svelte-query', - }, - { - config: createConfig({ - client: '@hey-api/client-fetch', - plugins: ['@tanstack/vue-query'], - }), - description: 'generate Fetch API client with TanStack Vue Query plugin', - name: 'v3-hey-api-client-fetch-plugin-tanstack-vue-query', - }, { config: createConfig({ client: 'legacy/xhr', diff --git a/packages/openapi-ts/test/plugins.spec.ts b/packages/openapi-ts/test/plugins.spec.ts new file mode 100644 index 000000000..20a95580a --- /dev/null +++ b/packages/openapi-ts/test/plugins.spec.ts @@ -0,0 +1,161 @@ +import { readFileSync } from 'node:fs'; +import path from 'node:path'; +import { fileURLToPath } from 'node:url'; + +import { describe, expect, it } from 'vitest'; + +import { createClient } from '../'; +import type { UserConfig } from '../src/types/config'; +import { getFilePaths } from './utils'; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); + +const outputDir = path.join(__dirname, 'generated', 'plugins'); + +describe('plugins', () => { + const createConfig = ( + userConfig: Omit & + Pick, 'plugins'>, + ): UserConfig => ({ + client: '@hey-api/client-fetch', + schemas: false, + ...userConfig, + input: path.join(__dirname, 'spec', 'v3.json'), + output: path.join( + outputDir, + typeof userConfig.plugins[0] === 'string' + ? userConfig.plugins[0] + : userConfig.plugins[0].name, + typeof userConfig.output === 'string' ? userConfig.output : '', + ), + }); + + const scenarios = [ + { + config: createConfig({ + output: 'fetch', + plugins: ['@tanstack/react-query'], + }), + description: 'generate Fetch API client with TanStack React Query plugin', + }, + { + config: createConfig({ + output: 'fetch', + plugins: ['@tanstack/solid-query'], + }), + description: 'generate Fetch API client with TanStack Solid Query plugin', + }, + { + config: createConfig({ + output: 'fetch', + plugins: ['@tanstack/svelte-query'], + }), + description: + 'generate Fetch API client with TanStack Svelte Query plugin', + }, + { + config: createConfig({ + output: 'fetch', + plugins: ['@tanstack/vue-query'], + }), + description: 'generate Fetch API client with TanStack Vue Query plugin', + }, + { + config: createConfig({ + client: '@hey-api/client-axios', + output: 'axios', + plugins: ['@tanstack/react-query'], + }), + description: 'generate Axios client with TanStack React Query plugin', + }, + { + config: createConfig({ + client: '@hey-api/client-axios', + output: 'axios', + plugins: ['@tanstack/solid-query'], + }), + description: 'generate Axios client with TanStack Solid Query plugin', + }, + { + config: createConfig({ + client: '@hey-api/client-axios', + output: 'axios', + plugins: ['@tanstack/svelte-query'], + }), + description: 'generate Axios client with TanStack Svelte Query plugin', + }, + { + config: createConfig({ + client: '@hey-api/client-axios', + output: 'axios', + plugins: ['@tanstack/vue-query'], + }), + description: 'generate Axios client with TanStack Vue Query plugin', + }, + { + config: createConfig({ + output: 'asClass', + plugins: ['@tanstack/react-query'], + services: { + asClass: true, + }, + }), + description: + 'generate Fetch API client with TanStack React Query plugin using class-based services', + }, + { + config: createConfig({ + output: 'asClass', + plugins: ['@tanstack/solid-query'], + services: { + asClass: true, + }, + }), + description: + 'generate Fetch API client with TanStack Solid Query plugin using class-based services', + }, + { + config: createConfig({ + output: 'asClass', + plugins: ['@tanstack/svelte-query'], + services: { + asClass: true, + }, + }), + description: + 'generate Fetch API client with TanStack Svelte Query plugin using class-based services', + }, + { + config: createConfig({ + output: 'asClass', + plugins: ['@tanstack/vue-query'], + services: { + asClass: true, + }, + }), + description: + 'generate Fetch API client with TanStack Vue Query plugin using class-based services', + }, + ]; + + it.each(scenarios)('$description', async ({ config }) => { + // @ts-ignore + await createClient(config); + + const outputPath = typeof config.output === 'string' ? config.output : ''; + const filePaths = getFilePaths(outputPath); + + filePaths.forEach((filePath) => { + const fileContent = readFileSync(filePath, 'utf-8'); + expect(fileContent).toMatchFileSnapshot( + path.join( + __dirname, + '__snapshots__', + 'plugins', + filePath.slice(outputDir.length + 1), + ), + ); + }); + }); +}); diff --git a/packages/openapi-ts/test/sample.cjs b/packages/openapi-ts/test/sample.cjs index c45a07fed..193206995 100644 --- a/packages/openapi-ts/test/sample.cjs +++ b/packages/openapi-ts/test/sample.cjs @@ -11,29 +11,29 @@ const main = async () => { // debug: true, // experimental_parser: true, // input: './test/spec/v3-transforms.json', - // input: './test/spec/v3.json', - input: './test/spec/3.1.0/duplicate-null.json', + input: './test/spec/v3.json', + // input: './test/spec/3.1.0/duplicate-null.json', // input: './test/spec/v2.json', // input: 'https://mongodb-mms-prod-build-server.s3.amazonaws.com/openapi/2caffd88277a4e27c95dcefc7e3b6a63a3b03297-v2-2023-11-15.json', // name: 'foo', output: { path: './test/generated/sample/', }, - // plugins: [ - // { - // // infiniteQueryOptions: false, - // // mutationOptions: false, - // name: '@tanstack/react-query', - // // queryOptions: false, - // }, - // // '@hey-api/services', - // ], + plugins: [ + { + // infiniteQueryOptions: false, + // mutationOptions: false, + name: '@tanstack/react-query', + // queryOptions: false, + }, + // '@hey-api/services', + ], schemas: { export: false, }, services: { - export: false, - // asClass: true, + // export: false, + asClass: true, // filter: '^GET /api/v{api-version}/simple:operation$', // export: false, // name: '^Parameters', -- 2.51.2 From 4925131d0546bf77f331e196fd4cc2c186193780 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 26 Sep 2024 15:54:36 +0000 Subject: [PATCH 35/49] Version Packages --- .changeset/clean-badgers-heal.md | 5 ----- .changeset/four-moose-love.md | 5 ----- .changeset/modern-queens-tan.md | 6 ------ .changeset/tidy-maps-buy.md | 5 ----- examples/openapi-ts-axios/CHANGELOG.md | 7 +++++++ examples/openapi-ts-axios/package.json | 2 +- examples/openapi-ts-fetch/CHANGELOG.md | 7 +++++++ examples/openapi-ts-fetch/package.json | 2 +- examples/openapi-ts-tanstack-react-query/CHANGELOG.md | 7 +++++++ examples/openapi-ts-tanstack-react-query/package.json | 2 +- examples/openapi-ts-tanstack-svelte-query/CHANGELOG.md | 7 +++++++ examples/openapi-ts-tanstack-svelte-query/package.json | 2 +- examples/openapi-ts-tanstack-vue-query/CHANGELOG.md | 7 +++++++ examples/openapi-ts-tanstack-vue-query/package.json | 2 +- packages/client-axios/CHANGELOG.md | 6 ++++++ packages/client-axios/package.json | 2 +- packages/client-fetch/CHANGELOG.md | 6 ++++++ packages/client-fetch/package.json | 2 +- packages/openapi-ts/CHANGELOG.md | 10 ++++++++++ packages/openapi-ts/package.json | 2 +- 20 files changed, 65 insertions(+), 29 deletions(-) delete mode 100644 .changeset/clean-badgers-heal.md delete mode 100644 .changeset/four-moose-love.md delete mode 100644 .changeset/modern-queens-tan.md delete mode 100644 .changeset/tidy-maps-buy.md diff --git a/.changeset/clean-badgers-heal.md b/.changeset/clean-badgers-heal.md deleted file mode 100644 index d738f86b2..000000000 --- a/.changeset/clean-badgers-heal.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@hey-api/openapi-ts': patch ---- - -fix: make TanStack Query plugin work with class-based services diff --git a/.changeset/four-moose-love.md b/.changeset/four-moose-love.md deleted file mode 100644 index 1fc7a124e..000000000 --- a/.changeset/four-moose-love.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@hey-api/openapi-ts': patch ---- - -fix: avoid printing duplicate null nodes diff --git a/.changeset/modern-queens-tan.md b/.changeset/modern-queens-tan.md deleted file mode 100644 index bba906df1..000000000 --- a/.changeset/modern-queens-tan.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -'@hey-api/client-axios': patch -'@hey-api/client-fetch': patch ---- - -fix: export RequestResult type diff --git a/.changeset/tidy-maps-buy.md b/.changeset/tidy-maps-buy.md deleted file mode 100644 index da555aae4..000000000 --- a/.changeset/tidy-maps-buy.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@hey-api/openapi-ts': patch ---- - -fix: attach TanStack Query infinite page params only if they exist diff --git a/examples/openapi-ts-axios/CHANGELOG.md b/examples/openapi-ts-axios/CHANGELOG.md index f55df6aae..7c43f1848 100644 --- a/examples/openapi-ts-axios/CHANGELOG.md +++ b/examples/openapi-ts-axios/CHANGELOG.md @@ -1,5 +1,12 @@ # @example/openapi-ts-axios +## 0.0.11 + +### Patch Changes + +- Updated dependencies [[`7f986c2`](https://github.com/hey-api/openapi-ts/commit/7f986c2c7726ed8fbf16f8b235b7769c7d990502)]: + - @hey-api/client-axios@0.2.7 + ## 0.0.10 ### Patch Changes diff --git a/examples/openapi-ts-axios/package.json b/examples/openapi-ts-axios/package.json index 681d04fdb..6f8ab7f55 100644 --- a/examples/openapi-ts-axios/package.json +++ b/examples/openapi-ts-axios/package.json @@ -1,7 +1,7 @@ { "name": "@example/openapi-ts-axios", "private": true, - "version": "0.0.10", + "version": "0.0.11", "type": "module", "scripts": { "build": "tsc && vite build", diff --git a/examples/openapi-ts-fetch/CHANGELOG.md b/examples/openapi-ts-fetch/CHANGELOG.md index b0ab431ed..6148beacc 100644 --- a/examples/openapi-ts-fetch/CHANGELOG.md +++ b/examples/openapi-ts-fetch/CHANGELOG.md @@ -1,5 +1,12 @@ # @example/openapi-ts-fetch +## 0.0.26 + +### Patch Changes + +- Updated dependencies [[`7f986c2`](https://github.com/hey-api/openapi-ts/commit/7f986c2c7726ed8fbf16f8b235b7769c7d990502)]: + - @hey-api/client-fetch@0.3.4 + ## 0.0.25 ### Patch Changes diff --git a/examples/openapi-ts-fetch/package.json b/examples/openapi-ts-fetch/package.json index e58e86f1c..6323a1588 100644 --- a/examples/openapi-ts-fetch/package.json +++ b/examples/openapi-ts-fetch/package.json @@ -1,7 +1,7 @@ { "name": "@example/openapi-ts-fetch", "private": true, - "version": "0.0.25", + "version": "0.0.26", "type": "module", "scripts": { "build": "tsc && vite build", diff --git a/examples/openapi-ts-tanstack-react-query/CHANGELOG.md b/examples/openapi-ts-tanstack-react-query/CHANGELOG.md index 2273e32ba..c6ed780ed 100644 --- a/examples/openapi-ts-tanstack-react-query/CHANGELOG.md +++ b/examples/openapi-ts-tanstack-react-query/CHANGELOG.md @@ -1,5 +1,12 @@ # @example/openapi-ts-tanstack-react-query +## 0.0.8 + +### Patch Changes + +- Updated dependencies [[`7f986c2`](https://github.com/hey-api/openapi-ts/commit/7f986c2c7726ed8fbf16f8b235b7769c7d990502)]: + - @hey-api/client-fetch@0.3.4 + ## 0.0.7 ### Patch Changes diff --git a/examples/openapi-ts-tanstack-react-query/package.json b/examples/openapi-ts-tanstack-react-query/package.json index a99823088..48003726b 100644 --- a/examples/openapi-ts-tanstack-react-query/package.json +++ b/examples/openapi-ts-tanstack-react-query/package.json @@ -1,7 +1,7 @@ { "name": "@example/openapi-ts-tanstack-react-query", "private": true, - "version": "0.0.7", + "version": "0.0.8", "type": "module", "scripts": { "build": "tsc && vite build", diff --git a/examples/openapi-ts-tanstack-svelte-query/CHANGELOG.md b/examples/openapi-ts-tanstack-svelte-query/CHANGELOG.md index b0e93500b..75db57b9c 100644 --- a/examples/openapi-ts-tanstack-svelte-query/CHANGELOG.md +++ b/examples/openapi-ts-tanstack-svelte-query/CHANGELOG.md @@ -1,5 +1,12 @@ # @example/openapi-ts-tanstack-svelte-query +## 0.0.8 + +### Patch Changes + +- Updated dependencies [[`7f986c2`](https://github.com/hey-api/openapi-ts/commit/7f986c2c7726ed8fbf16f8b235b7769c7d990502)]: + - @hey-api/client-fetch@0.3.4 + ## 0.0.7 ### Patch Changes diff --git a/examples/openapi-ts-tanstack-svelte-query/package.json b/examples/openapi-ts-tanstack-svelte-query/package.json index 0818aeee2..6887b8d31 100644 --- a/examples/openapi-ts-tanstack-svelte-query/package.json +++ b/examples/openapi-ts-tanstack-svelte-query/package.json @@ -1,7 +1,7 @@ { "name": "@example/openapi-ts-tanstack-svelte-query", "private": true, - "version": "0.0.7", + "version": "0.0.8", "type": "module", "scripts": { "build": "vite build", diff --git a/examples/openapi-ts-tanstack-vue-query/CHANGELOG.md b/examples/openapi-ts-tanstack-vue-query/CHANGELOG.md index f83064f08..5150e44a2 100644 --- a/examples/openapi-ts-tanstack-vue-query/CHANGELOG.md +++ b/examples/openapi-ts-tanstack-vue-query/CHANGELOG.md @@ -1,5 +1,12 @@ # @example/openapi-ts-tanstack-vue-query +## 0.0.8 + +### Patch Changes + +- Updated dependencies [[`7f986c2`](https://github.com/hey-api/openapi-ts/commit/7f986c2c7726ed8fbf16f8b235b7769c7d990502)]: + - @hey-api/client-fetch@0.3.4 + ## 0.0.7 ### Patch Changes diff --git a/examples/openapi-ts-tanstack-vue-query/package.json b/examples/openapi-ts-tanstack-vue-query/package.json index 3695df245..ab8435d51 100644 --- a/examples/openapi-ts-tanstack-vue-query/package.json +++ b/examples/openapi-ts-tanstack-vue-query/package.json @@ -1,7 +1,7 @@ { "name": "@example/openapi-ts-tanstack-vue-query", "private": true, - "version": "0.0.7", + "version": "0.0.8", "type": "module", "scripts": { "build-only": "vite build", diff --git a/packages/client-axios/CHANGELOG.md b/packages/client-axios/CHANGELOG.md index 1a8d6bde3..f713d2203 100644 --- a/packages/client-axios/CHANGELOG.md +++ b/packages/client-axios/CHANGELOG.md @@ -1,5 +1,11 @@ # @hey-api/client-axios +## 0.2.7 + +### Patch Changes + +- [#1092](https://github.com/hey-api/openapi-ts/pull/1092) [`7f986c2`](https://github.com/hey-api/openapi-ts/commit/7f986c2c7726ed8fbf16f8b235b7769c7d990502) Thanks [@mrlubos](https://github.com/mrlubos)! - fix: export RequestResult type + ## 0.2.6 ### Patch Changes diff --git a/packages/client-axios/package.json b/packages/client-axios/package.json index b44aa119d..3cee8a461 100644 --- a/packages/client-axios/package.json +++ b/packages/client-axios/package.json @@ -1,6 +1,6 @@ { "name": "@hey-api/client-axios", - "version": "0.2.6", + "version": "0.2.7", "description": "Type-safe Axios client for your @hey-api/openapi-ts types", "homepage": "https://heyapi.vercel.app/", "repository": { diff --git a/packages/client-fetch/CHANGELOG.md b/packages/client-fetch/CHANGELOG.md index 758710c3d..b8bd8aeb0 100644 --- a/packages/client-fetch/CHANGELOG.md +++ b/packages/client-fetch/CHANGELOG.md @@ -1,5 +1,11 @@ # @hey-api/client-fetch +## 0.3.4 + +### Patch Changes + +- [#1092](https://github.com/hey-api/openapi-ts/pull/1092) [`7f986c2`](https://github.com/hey-api/openapi-ts/commit/7f986c2c7726ed8fbf16f8b235b7769c7d990502) Thanks [@mrlubos](https://github.com/mrlubos)! - fix: export RequestResult type + ## 0.3.3 ### Patch Changes diff --git a/packages/client-fetch/package.json b/packages/client-fetch/package.json index 16fbfc0fe..8b255b590 100644 --- a/packages/client-fetch/package.json +++ b/packages/client-fetch/package.json @@ -1,6 +1,6 @@ { "name": "@hey-api/client-fetch", - "version": "0.3.3", + "version": "0.3.4", "description": "Type-safe Fetch API client for your @hey-api/openapi-ts types", "homepage": "https://heyapi.vercel.app/", "repository": { diff --git a/packages/openapi-ts/CHANGELOG.md b/packages/openapi-ts/CHANGELOG.md index 917c76394..1f032a789 100644 --- a/packages/openapi-ts/CHANGELOG.md +++ b/packages/openapi-ts/CHANGELOG.md @@ -1,5 +1,15 @@ # @hey-api/openapi-ts +## 0.53.5 + +### Patch Changes + +- [#1096](https://github.com/hey-api/openapi-ts/pull/1096) [`b6e350a`](https://github.com/hey-api/openapi-ts/commit/b6e350a9cc2d82ac4496b7d57ec8b58978c951c2) Thanks [@mrlubos](https://github.com/mrlubos)! - fix: make TanStack Query plugin work with class-based services + +- [#1095](https://github.com/hey-api/openapi-ts/pull/1095) [`11ee53f`](https://github.com/hey-api/openapi-ts/commit/11ee53f4f519643ae7e3f0997ce4fe9b6cb050a8) Thanks [@mrlubos](https://github.com/mrlubos)! - fix: avoid printing duplicate null nodes + +- [#1094](https://github.com/hey-api/openapi-ts/pull/1094) [`713ccd5`](https://github.com/hey-api/openapi-ts/commit/713ccd5e5e250a14cacf96fd1dffad252cc4cc6a) Thanks [@mrlubos](https://github.com/mrlubos)! - fix: attach TanStack Query infinite page params only if they exist + ## 0.53.4 ### Patch Changes diff --git a/packages/openapi-ts/package.json b/packages/openapi-ts/package.json index 83a5cd470..86bd8c4d0 100644 --- a/packages/openapi-ts/package.json +++ b/packages/openapi-ts/package.json @@ -1,6 +1,6 @@ { "name": "@hey-api/openapi-ts", - "version": "0.53.4", + "version": "0.53.5", "description": "Turn your OpenAPI specification into a beautiful TypeScript client", "homepage": "https://heyapi.vercel.app/", "repository": { -- 2.51.2 From df5c69048a03a1c7729a5200c586164287a8a6fa Mon Sep 17 00:00:00 2001 From: Lubos Date: Fri, 27 Sep 2024 20:50:19 +0800 Subject: [PATCH 36/49] feat: add error interceptors to fetch client --- .changeset/old-spoons-listen.md | 5 ++++ .changeset/small-goats-look.md | 5 ++++ examples/openapi-ts-fetch/src/App.tsx | 5 ++++ packages/client-fetch/src/index.ts | 26 ++++++++++++++----- packages/client-fetch/src/types.ts | 3 ++- packages/client-fetch/src/utils.ts | 16 ++++++++++-- .../client/index.ts.snap | 26 ++++++++++++++----- .../client/types.ts.snap | 3 ++- .../client/utils.ts.snap | 16 ++++++++++-- .../client/index.ts.snap | 26 ++++++++++++++----- .../client/types.ts.snap | 3 ++- .../client/utils.ts.snap | 16 ++++++++++-- 12 files changed, 123 insertions(+), 27 deletions(-) create mode 100644 .changeset/old-spoons-listen.md create mode 100644 .changeset/small-goats-look.md diff --git a/.changeset/old-spoons-listen.md b/.changeset/old-spoons-listen.md new file mode 100644 index 000000000..3fc433aae --- /dev/null +++ b/.changeset/old-spoons-listen.md @@ -0,0 +1,5 @@ +--- +'@hey-api/client-fetch': minor +--- + +feat: add error interceptors diff --git a/.changeset/small-goats-look.md b/.changeset/small-goats-look.md new file mode 100644 index 000000000..b84e5b17b --- /dev/null +++ b/.changeset/small-goats-look.md @@ -0,0 +1,5 @@ +--- +'@hey-api/client-fetch': patch +--- + +fix: throw raw error when throwOnError is true diff --git a/examples/openapi-ts-fetch/src/App.tsx b/examples/openapi-ts-fetch/src/App.tsx index 03c848868..4e5f079cb 100644 --- a/examples/openapi-ts-fetch/src/App.tsx +++ b/examples/openapi-ts-fetch/src/App.tsx @@ -48,6 +48,11 @@ localClient.interceptors.request.use((request, options) => { return request; }); +localClient.interceptors.error.use((error) => { + console.log(error); + return error; +}); + function App() { const [pet, setPet] = useState(); const [isRequiredNameError, setIsRequiredNameError] = useState(false); diff --git a/packages/client-fetch/src/index.ts b/packages/client-fetch/src/index.ts index 29cc066a6..9e8f86945 100644 --- a/packages/client-fetch/src/index.ts +++ b/packages/client-fetch/src/index.ts @@ -24,7 +24,12 @@ export const createClient = (config: Config = {}): Client => { return getConfig(); }; - const interceptors = createInterceptors(); + const interceptors = createInterceptors< + Request, + Response, + unknown, + RequestOptions + >(); // @ts-expect-error const request: Client['request'] = async (options) => { @@ -113,17 +118,26 @@ export const createClient = (config: Config = {}): Client => { let error = await response.text(); - if (opts.throwOnError) { - throw new Error(error); - } - try { error = JSON.parse(error); } catch { // noop } + + let finalError = error; + + for (const fn of interceptors.error._fns) { + finalError = (await fn(error, response, request, opts)) as string; + } + + finalError = finalError || ({} as string); + + if (opts.throwOnError) { + throw finalError; + } + return { - error: error || {}, + error: finalError, ...result, }; }; diff --git a/packages/client-fetch/src/types.ts b/packages/client-fetch/src/types.ts index d53ca45da..1a3eb3ebc 100644 --- a/packages/client-fetch/src/types.ts +++ b/packages/client-fetch/src/types.ts @@ -145,6 +145,7 @@ type RequestFn = < export interface Client< Req = Request, Res = Response, + Err = unknown, Options = RequestOptions, > { connect: MethodFn; @@ -152,7 +153,7 @@ export interface Client< get: MethodFn; getConfig: () => Config; head: MethodFn; - interceptors: Middleware; + interceptors: Middleware; options: MethodFn; patch: MethodFn; post: MethodFn; diff --git a/packages/client-fetch/src/utils.ts b/packages/client-fetch/src/utils.ts index 2bcc2e5e5..8e5185670 100644 --- a/packages/client-fetch/src/utils.ts +++ b/packages/client-fetch/src/utils.ts @@ -422,6 +422,13 @@ export const mergeHeaders = ( return mergedHeaders; }; +type ErrInterceptor = ( + error: Err, + response: Res, + request: Req, + options: Options, +) => Err | Promise; + type ReqInterceptor = ( request: Req, options: Options, @@ -462,7 +469,11 @@ class Interceptors { // `createInterceptors()` response, meant for external use as it does not // expose internals -export interface Middleware { +export interface Middleware { + error: Pick< + Interceptors>, + 'eject' | 'use' + >; request: Pick>, 'eject' | 'use'>; response: Pick< Interceptors>, @@ -471,7 +482,8 @@ export interface Middleware { } // do not add `Middleware` as return type so we can use _fns internally -export const createInterceptors = () => ({ +export const createInterceptors = () => ({ + error: new Interceptors>(), request: new Interceptors>(), response: new Interceptors>(), }); diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle/client/index.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle/client/index.ts.snap index 29cc066a6..9e8f86945 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle/client/index.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle/client/index.ts.snap @@ -24,7 +24,12 @@ export const createClient = (config: Config = {}): Client => { return getConfig(); }; - const interceptors = createInterceptors(); + const interceptors = createInterceptors< + Request, + Response, + unknown, + RequestOptions + >(); // @ts-expect-error const request: Client['request'] = async (options) => { @@ -113,17 +118,26 @@ export const createClient = (config: Config = {}): Client => { let error = await response.text(); - if (opts.throwOnError) { - throw new Error(error); - } - try { error = JSON.parse(error); } catch { // noop } + + let finalError = error; + + for (const fn of interceptors.error._fns) { + finalError = (await fn(error, response, request, opts)) as string; + } + + finalError = finalError || ({} as string); + + if (opts.throwOnError) { + throw finalError; + } + return { - error: error || {}, + error: finalError, ...result, }; }; diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle/client/types.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle/client/types.ts.snap index d53ca45da..1a3eb3ebc 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle/client/types.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle/client/types.ts.snap @@ -145,6 +145,7 @@ type RequestFn = < export interface Client< Req = Request, Res = Response, + Err = unknown, Options = RequestOptions, > { connect: MethodFn; @@ -152,7 +153,7 @@ export interface Client< get: MethodFn; getConfig: () => Config; head: MethodFn; - interceptors: Middleware; + interceptors: Middleware; options: MethodFn; patch: MethodFn; post: MethodFn; diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle/client/utils.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle/client/utils.ts.snap index 2bcc2e5e5..8e5185670 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle/client/utils.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle/client/utils.ts.snap @@ -422,6 +422,13 @@ export const mergeHeaders = ( return mergedHeaders; }; +type ErrInterceptor = ( + error: Err, + response: Res, + request: Req, + options: Options, +) => Err | Promise; + type ReqInterceptor = ( request: Req, options: Options, @@ -462,7 +469,11 @@ class Interceptors { // `createInterceptors()` response, meant for external use as it does not // expose internals -export interface Middleware { +export interface Middleware { + error: Pick< + Interceptors>, + 'eject' | 'use' + >; request: Pick>, 'eject' | 'use'>; response: Pick< Interceptors>, @@ -471,7 +482,8 @@ export interface Middleware { } // do not add `Middleware` as return type so we can use _fns internally -export const createInterceptors = () => ({ +export const createInterceptors = () => ({ + error: new Interceptors>(), request: new Interceptors>(), response: new Interceptors>(), }); diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle_transform/client/index.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle_transform/client/index.ts.snap index 29cc066a6..9e8f86945 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle_transform/client/index.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle_transform/client/index.ts.snap @@ -24,7 +24,12 @@ export const createClient = (config: Config = {}): Client => { return getConfig(); }; - const interceptors = createInterceptors(); + const interceptors = createInterceptors< + Request, + Response, + unknown, + RequestOptions + >(); // @ts-expect-error const request: Client['request'] = async (options) => { @@ -113,17 +118,26 @@ export const createClient = (config: Config = {}): Client => { let error = await response.text(); - if (opts.throwOnError) { - throw new Error(error); - } - try { error = JSON.parse(error); } catch { // noop } + + let finalError = error; + + for (const fn of interceptors.error._fns) { + finalError = (await fn(error, response, request, opts)) as string; + } + + finalError = finalError || ({} as string); + + if (opts.throwOnError) { + throw finalError; + } + return { - error: error || {}, + error: finalError, ...result, }; }; diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle_transform/client/types.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle_transform/client/types.ts.snap index d53ca45da..1a3eb3ebc 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle_transform/client/types.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle_transform/client/types.ts.snap @@ -145,6 +145,7 @@ type RequestFn = < export interface Client< Req = Request, Res = Response, + Err = unknown, Options = RequestOptions, > { connect: MethodFn; @@ -152,7 +153,7 @@ export interface Client< get: MethodFn; getConfig: () => Config; head: MethodFn; - interceptors: Middleware; + interceptors: Middleware; options: MethodFn; patch: MethodFn; post: MethodFn; diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle_transform/client/utils.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle_transform/client/utils.ts.snap index 2bcc2e5e5..8e5185670 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle_transform/client/utils.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle_transform/client/utils.ts.snap @@ -422,6 +422,13 @@ export const mergeHeaders = ( return mergedHeaders; }; +type ErrInterceptor = ( + error: Err, + response: Res, + request: Req, + options: Options, +) => Err | Promise; + type ReqInterceptor = ( request: Req, options: Options, @@ -462,7 +469,11 @@ class Interceptors { // `createInterceptors()` response, meant for external use as it does not // expose internals -export interface Middleware { +export interface Middleware { + error: Pick< + Interceptors>, + 'eject' | 'use' + >; request: Pick>, 'eject' | 'use'>; response: Pick< Interceptors>, @@ -471,7 +482,8 @@ export interface Middleware { } // do not add `Middleware` as return type so we can use _fns internally -export const createInterceptors = () => ({ +export const createInterceptors = () => ({ + error: new Interceptors>(), request: new Interceptors>(), response: new Interceptors>(), }); -- 2.51.2 From 2ef5b1a3c7850e06520eb0a68a1bee652b7be342 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Fri, 27 Sep 2024 13:00:42 +0000 Subject: [PATCH 37/49] Version Packages --- .changeset/old-spoons-listen.md | 5 ----- .changeset/small-goats-look.md | 5 ----- examples/openapi-ts-fetch/CHANGELOG.md | 7 +++++++ examples/openapi-ts-fetch/package.json | 2 +- examples/openapi-ts-tanstack-react-query/CHANGELOG.md | 7 +++++++ examples/openapi-ts-tanstack-react-query/package.json | 2 +- examples/openapi-ts-tanstack-svelte-query/CHANGELOG.md | 7 +++++++ examples/openapi-ts-tanstack-svelte-query/package.json | 2 +- examples/openapi-ts-tanstack-vue-query/CHANGELOG.md | 7 +++++++ examples/openapi-ts-tanstack-vue-query/package.json | 2 +- packages/client-fetch/CHANGELOG.md | 10 ++++++++++ packages/client-fetch/package.json | 2 +- 12 files changed, 43 insertions(+), 15 deletions(-) delete mode 100644 .changeset/old-spoons-listen.md delete mode 100644 .changeset/small-goats-look.md diff --git a/.changeset/old-spoons-listen.md b/.changeset/old-spoons-listen.md deleted file mode 100644 index 3fc433aae..000000000 --- a/.changeset/old-spoons-listen.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@hey-api/client-fetch': minor ---- - -feat: add error interceptors diff --git a/.changeset/small-goats-look.md b/.changeset/small-goats-look.md deleted file mode 100644 index b84e5b17b..000000000 --- a/.changeset/small-goats-look.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@hey-api/client-fetch': patch ---- - -fix: throw raw error when throwOnError is true diff --git a/examples/openapi-ts-fetch/CHANGELOG.md b/examples/openapi-ts-fetch/CHANGELOG.md index 6148beacc..83747f0db 100644 --- a/examples/openapi-ts-fetch/CHANGELOG.md +++ b/examples/openapi-ts-fetch/CHANGELOG.md @@ -1,5 +1,12 @@ # @example/openapi-ts-fetch +## 0.0.27 + +### Patch Changes + +- Updated dependencies [[`df5c690`](https://github.com/hey-api/openapi-ts/commit/df5c69048a03a1c7729a5200c586164287a8a6fa), [`df5c690`](https://github.com/hey-api/openapi-ts/commit/df5c69048a03a1c7729a5200c586164287a8a6fa)]: + - @hey-api/client-fetch@0.4.0 + ## 0.0.26 ### Patch Changes diff --git a/examples/openapi-ts-fetch/package.json b/examples/openapi-ts-fetch/package.json index 6323a1588..f5fbab511 100644 --- a/examples/openapi-ts-fetch/package.json +++ b/examples/openapi-ts-fetch/package.json @@ -1,7 +1,7 @@ { "name": "@example/openapi-ts-fetch", "private": true, - "version": "0.0.26", + "version": "0.0.27", "type": "module", "scripts": { "build": "tsc && vite build", diff --git a/examples/openapi-ts-tanstack-react-query/CHANGELOG.md b/examples/openapi-ts-tanstack-react-query/CHANGELOG.md index c6ed780ed..1134354aa 100644 --- a/examples/openapi-ts-tanstack-react-query/CHANGELOG.md +++ b/examples/openapi-ts-tanstack-react-query/CHANGELOG.md @@ -1,5 +1,12 @@ # @example/openapi-ts-tanstack-react-query +## 0.0.9 + +### Patch Changes + +- Updated dependencies [[`df5c690`](https://github.com/hey-api/openapi-ts/commit/df5c69048a03a1c7729a5200c586164287a8a6fa), [`df5c690`](https://github.com/hey-api/openapi-ts/commit/df5c69048a03a1c7729a5200c586164287a8a6fa)]: + - @hey-api/client-fetch@0.4.0 + ## 0.0.8 ### Patch Changes diff --git a/examples/openapi-ts-tanstack-react-query/package.json b/examples/openapi-ts-tanstack-react-query/package.json index 48003726b..6c3d4aab7 100644 --- a/examples/openapi-ts-tanstack-react-query/package.json +++ b/examples/openapi-ts-tanstack-react-query/package.json @@ -1,7 +1,7 @@ { "name": "@example/openapi-ts-tanstack-react-query", "private": true, - "version": "0.0.8", + "version": "0.0.9", "type": "module", "scripts": { "build": "tsc && vite build", diff --git a/examples/openapi-ts-tanstack-svelte-query/CHANGELOG.md b/examples/openapi-ts-tanstack-svelte-query/CHANGELOG.md index 75db57b9c..76266ec11 100644 --- a/examples/openapi-ts-tanstack-svelte-query/CHANGELOG.md +++ b/examples/openapi-ts-tanstack-svelte-query/CHANGELOG.md @@ -1,5 +1,12 @@ # @example/openapi-ts-tanstack-svelte-query +## 0.0.9 + +### Patch Changes + +- Updated dependencies [[`df5c690`](https://github.com/hey-api/openapi-ts/commit/df5c69048a03a1c7729a5200c586164287a8a6fa), [`df5c690`](https://github.com/hey-api/openapi-ts/commit/df5c69048a03a1c7729a5200c586164287a8a6fa)]: + - @hey-api/client-fetch@0.4.0 + ## 0.0.8 ### Patch Changes diff --git a/examples/openapi-ts-tanstack-svelte-query/package.json b/examples/openapi-ts-tanstack-svelte-query/package.json index 6887b8d31..407a563a1 100644 --- a/examples/openapi-ts-tanstack-svelte-query/package.json +++ b/examples/openapi-ts-tanstack-svelte-query/package.json @@ -1,7 +1,7 @@ { "name": "@example/openapi-ts-tanstack-svelte-query", "private": true, - "version": "0.0.8", + "version": "0.0.9", "type": "module", "scripts": { "build": "vite build", diff --git a/examples/openapi-ts-tanstack-vue-query/CHANGELOG.md b/examples/openapi-ts-tanstack-vue-query/CHANGELOG.md index 5150e44a2..5238e90f7 100644 --- a/examples/openapi-ts-tanstack-vue-query/CHANGELOG.md +++ b/examples/openapi-ts-tanstack-vue-query/CHANGELOG.md @@ -1,5 +1,12 @@ # @example/openapi-ts-tanstack-vue-query +## 0.0.9 + +### Patch Changes + +- Updated dependencies [[`df5c690`](https://github.com/hey-api/openapi-ts/commit/df5c69048a03a1c7729a5200c586164287a8a6fa), [`df5c690`](https://github.com/hey-api/openapi-ts/commit/df5c69048a03a1c7729a5200c586164287a8a6fa)]: + - @hey-api/client-fetch@0.4.0 + ## 0.0.8 ### Patch Changes diff --git a/examples/openapi-ts-tanstack-vue-query/package.json b/examples/openapi-ts-tanstack-vue-query/package.json index ab8435d51..5c482f80e 100644 --- a/examples/openapi-ts-tanstack-vue-query/package.json +++ b/examples/openapi-ts-tanstack-vue-query/package.json @@ -1,7 +1,7 @@ { "name": "@example/openapi-ts-tanstack-vue-query", "private": true, - "version": "0.0.8", + "version": "0.0.9", "type": "module", "scripts": { "build-only": "vite build", diff --git a/packages/client-fetch/CHANGELOG.md b/packages/client-fetch/CHANGELOG.md index b8bd8aeb0..07fd273ab 100644 --- a/packages/client-fetch/CHANGELOG.md +++ b/packages/client-fetch/CHANGELOG.md @@ -1,5 +1,15 @@ # @hey-api/client-fetch +## 0.4.0 + +### Minor Changes + +- [#1098](https://github.com/hey-api/openapi-ts/pull/1098) [`df5c690`](https://github.com/hey-api/openapi-ts/commit/df5c69048a03a1c7729a5200c586164287a8a6fa) Thanks [@mrlubos](https://github.com/mrlubos)! - feat: add error interceptors + +### Patch Changes + +- [#1098](https://github.com/hey-api/openapi-ts/pull/1098) [`df5c690`](https://github.com/hey-api/openapi-ts/commit/df5c69048a03a1c7729a5200c586164287a8a6fa) Thanks [@mrlubos](https://github.com/mrlubos)! - fix: throw raw error when throwOnError is true + ## 0.3.4 ### Patch Changes diff --git a/packages/client-fetch/package.json b/packages/client-fetch/package.json index 8b255b590..775a00c81 100644 --- a/packages/client-fetch/package.json +++ b/packages/client-fetch/package.json @@ -1,6 +1,6 @@ { "name": "@hey-api/client-fetch", - "version": "0.3.4", + "version": "0.4.0", "description": "Type-safe Fetch API client for your @hey-api/openapi-ts types", "homepage": "https://heyapi.vercel.app/", "repository": { -- 2.51.2 From a1eada1896046f0de1710682635efc59434a1e2c Mon Sep 17 00:00:00 2001 From: Lubos Date: Mon, 30 Sep 2024 17:30:14 +0800 Subject: [PATCH 38/49] fix: export spec-compliant OpenAPI 3.1 interface --- .changeset/dry-laws-smash.md | 5 + package.json | 2 +- packages/openapi-ts/src/index.ts | 1 + .../openapi-ts/src/openApi/3.1/types/spec.ts | 976 +++++++++++++++++- pnpm-lock.yaml | 214 ++-- 5 files changed, 1049 insertions(+), 149 deletions(-) create mode 100644 .changeset/dry-laws-smash.md diff --git a/.changeset/dry-laws-smash.md b/.changeset/dry-laws-smash.md new file mode 100644 index 000000000..6919d6538 --- /dev/null +++ b/.changeset/dry-laws-smash.md @@ -0,0 +1,5 @@ +--- +'@hey-api/openapi-ts': patch +--- + +fix: export spec-compliant OpenAPI 3.1 interface diff --git a/package.json b/package.json index fbfa582af..6341229d1 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,7 @@ "devDependencies": { "@arethetypeswrong/cli": "0.16.4", "@changesets/changelog-github": "0.5.0", - "@changesets/cli": "2.27.7", + "@changesets/cli": "2.27.8", "@types/node": "20.14.10", "@typescript-eslint/eslint-plugin": "7.15.0", "@vitest/coverage-v8": "1.6.0", diff --git a/packages/openapi-ts/src/index.ts b/packages/openapi-ts/src/index.ts index 85a8c7334..f1c33ddd6 100644 --- a/packages/openapi-ts/src/index.ts +++ b/packages/openapi-ts/src/index.ts @@ -426,4 +426,5 @@ export default { defineConfig, }; +export type { OpenApiV3_1 } from './openApi/3.1/types/spec'; export type { UserConfig } from './types/config'; diff --git a/packages/openapi-ts/src/openApi/3.1/types/spec.ts b/packages/openapi-ts/src/openApi/3.1/types/spec.ts index 3df9f0ff9..65ea81395 100644 --- a/packages/openapi-ts/src/openApi/3.1/types/spec.ts +++ b/packages/openapi-ts/src/openApi/3.1/types/spec.ts @@ -53,10 +53,85 @@ export interface OpenApiV3_1 { * * This object MAY be extended with {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specification-extensions Specification Extensions}. * - * TODO... + * **Key Expression** + * + * The key that identifies the {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#path-item-object Path Item Object} is a {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#runtime-expressions runtime expression} that can be evaluated in the context of a runtime HTTP request/response to identify the URL to be used for the callback request. A simple example might be $request.body#/url. However, using a {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#runtime-expressions runtime expression} the complete HTTP message can be accessed. This includes accessing any part of a body that a JSON Pointer {@link https://tools.ietf.org/html/rfc6901 RFC6901} can reference. + * + * For example, given the following HTTP request: + * + * ```http + * POST /subscribe/myevent?queryUrl=https://clientdomain.com/stillrunning HTTP/1.1 + * Host: example.org + * Content-Type: application/json + * Content-Length: 187 + * + * { + * "failedUrl" : "https://clientdomain.com/failed", + * "successUrls" : [ + * "https://clientdomain.com/fast", + * "https://clientdomain.com/medium", + * "https://clientdomain.com/slow" + * ] + * } + * + * 201 Created + * Location: https://example.org/subscription/1 + * ``` + * + * The following examples show how the various expressions evaluate, assuming the callback operation has a path parameter named `eventType` and a query parameter named `queryUrl`. + * + * | Expression | Value | + * | -------- | ------- | + * | $url | https://example.org/subscribe/myevent?queryUrl=https://clientdomain.com/stillrunning | + * | $method | POST | + * | $request.path.eventType | myevent | + * | $request.query.queryUrl | https://clientdomain.com/stillrunning | + * | $request.header.content-Type | application/json | + * | $request.body#/failedUrl | https://clientdomain.com/failed | + * | $request.body#/successUrls/2 | https://clientdomain.com/medium | + * | $response.header.Location | https://example.org/subscription/1 | + * + * **Callback Object Examples** + * + * The following example uses the user provided `queryUrl` query string parameter to define the callback URL. This is an example of how to use a callback object to describe a WebHook callback that goes with the subscription operation to enable registering for the WebHook. + * + * ```yaml + * myCallback: + * '{$request.query.queryUrl}': + * post: + * requestBody: + * description: Callback payload + * content: + * 'application/json': + * schema: + * $ref: '#/components/schemas/SomePayload' + * responses: + * '200': + * description: callback successfully processed + * ``` + * + * The following example shows a callback where the server is hard-coded, but the query string parameters are populated from the `id` and `email` property in the request body. + * + * ```yaml + * transactionCallback: + * 'http://notificationServer.com?transactionId={$request.body#/id}&email={$request.body#/email}': + * post: + * requestBody: + * description: Callback payload + * content: + * 'application/json': + * schema: + * $ref: '#/components/schemas/SomePayload' + * responses: + * '200': + * description: callback successfully processed + * ``` */ export interface CallbackObject { - // TODO... + /** + * A Path Item Object, or a reference to one, used to define a callback request and expected responses. A {@link https://github.com/OAI/OpenAPI-Specification/blob/main/examples/v3.0/callback-example.yaml complete example} is available. + */ + [expression: string]: PathItemObject | ReferenceObject; } /** @@ -66,7 +141,87 @@ export interface CallbackObject { * * All the fixed fields declared above are objects that MUST use keys that match the regular expression: `^[a-zA-Z0-9\.\-_]+$`. * - * TODO... + * Field Name Examples: + * + * ``` + * User + * User_1 + * User_Name + * user-name + * my.org.User + * ``` + * + * **Components Object Example** + * + * ```yaml + * components: + * schemas: + * GeneralError: + * type: object + * properties: + * code: + * type: integer + * format: int32 + * message: + * type: string + * Category: + * type: object + * properties: + * id: + * type: integer + * format: int64 + * name: + * type: string + * Tag: + * type: object + * properties: + * id: + * type: integer + * format: int64 + * name: + * type: string + * parameters: + * skipParam: + * name: skip + * in: query + * description: number of items to skip + * required: true + * schema: + * type: integer + * format: int32 + * limitParam: + * name: limit + * in: query + * description: max records to return + * required: true + * schema: + * type: integer + * format: int32 + * responses: + * NotFound: + * description: Entity not found. + * IllegalInput: + * description: Illegal input for operation. + * GeneralError: + * description: General Error + * content: + * application/json: + * schema: + * $ref: '#/components/schemas/GeneralError' + * securitySchemes: + * api_key: + * type: apiKey + * name: api_key + * in: header + * petstore_auth: + * type: oauth2 + * flows: + * implicit: + * authorizationUrl: https://example.org/api/oauth/dialog + * scopes: + * write:pets: modify pets in your account + * read:pets: read your pets + * ``` */ export interface ComponentsObject { /** @@ -138,6 +293,143 @@ export interface ContactObject { url?: string; } +/** + * When request bodies or response payloads may be one of a number of different schemas, a `discriminator` object can be used to aid in serialization, deserialization, and validation. The discriminator is a specific object in a schema which is used to inform the consumer of the document of an alternative schema based on the value associated with it. + * + * When using the discriminator, _inline_ schemas will not be considered. + * + * This object MAY be extended with {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specification-extensions Specification Extensions}. + * + * The discriminator object is legal only when using one of the composite keywords `oneOf`, `anyOf`, `allOf`. + * + * In OAS 3.0, a response payload MAY be described to be exactly one of any number of types: + * + * ```yaml + * MyResponseType: + * oneOf: + * - $ref: '#/components/schemas/Cat' + * - $ref: '#/components/schemas/Dog' + * - $ref: '#/components/schemas/Lizard' + * ``` + * + * which means the payload _MUST_, by validation, match exactly one of the schemas described by `Cat`, `Dog`, or `Lizard`. In this case, a discriminator MAY act as a "hint" to shortcut validation and selection of the matching schema which may be a costly operation, depending on the complexity of the schema. We can then describe exactly which field tells us which schema to use: + * + * ```yaml + * MyResponseType: + * oneOf: + * - $ref: '#/components/schemas/Cat' + * - $ref: '#/components/schemas/Dog' + * - $ref: '#/components/schemas/Lizard' + * discriminator: + * propertyName: petType + * ``` + * + * The expectation now is that a property with name `petType` _MUST_ be present in the response payload, and the value will correspond to the name of a schema defined in the OAS document. Thus the response payload: + * + * ```json + * { + * "id": 12345, + * "petType": "Cat" + * } + * ``` + * + * Will indicate that the `Cat` schema be used in conjunction with this payload. + * + * In scenarios where the value of the discriminator field does not match the schema name or implicit mapping is not possible, an optional `mapping` definition MAY be used: + * + * ```yaml + * MyResponseType: + * oneOf: + * - $ref: '#/components/schemas/Cat' + * - $ref: '#/components/schemas/Dog' + * - $ref: '#/components/schemas/Lizard' + * - $ref: 'https://gigantic-server.com/schemas/Monster/schema.json' + * discriminator: + * propertyName: petType + * mapping: + * dog: '#/components/schemas/Dog' + * monster: 'https://gigantic-server.com/schemas/Monster/schema.json' + * ``` + * + * Here the discriminator _value_ of `dog` will map to the schema `#/components/schemas/Dog`, rather than the default (implicit) value of `Dog`. If the discriminator _value_ does not match an implicit or explicit mapping, no schema can be determined and validation SHOULD fail. Mapping keys MUST be string values, but tooling MAY convert response values to strings for comparison. + * + * When used in conjunction with the `anyOf` construct, the use of the discriminator can avoid ambiguity where multiple schemas may satisfy a single payload. + * + * In both the `oneOf` and `anyOf` use cases, all possible schemas MUST be listed explicitly. To avoid redundancy, the discriminator MAY be added to a parent schema definition, and all schemas comprising the parent schema in an `allOf` construct may be used as an alternate schema. + * + * For example: + * + * ```yaml + * components: + * schemas: + * Pet: + * type: object + * required: + * - petType + * properties: + * petType: + * type: string + * discriminator: + * propertyName: petType + * mapping: + * dog: Dog + * Cat: + * allOf: + * - $ref: '#/components/schemas/Pet' + * - type: object + * # all other properties specific to a `Cat` + * properties: + * name: + * type: string + * Dog: + * allOf: + * - $ref: '#/components/schemas/Pet' + * - type: object + * # all other properties specific to a `Dog` + * properties: + * bark: + * type: string + * Lizard: + * allOf: + * - $ref: '#/components/schemas/Pet' + * - type: object + * # all other properties specific to a `Lizard` + * properties: + * lovesRocks: + * type: boolean + * ``` + * + * a payload like this: + * + * ```json + * { + * "petType": "Cat", + * "name": "misty" + * } + * ``` + * + * will indicate that the `Cat` schema be used. Likewise this schema: + * + * ```json + * { + * "petType": "dog", + * "bark": "soft" + * } + * ``` + * + * will map to `Dog` because of the definition in the `mapping` element. + */ +export interface DiscriminatorObject { + /** + * An object to hold mappings between payload values and schema names or references. + */ + mapping?: Record; + /** + * **REQUIRED**. The name of the property in the payload that will hold the discriminator value. + */ + propertyName: string; +} + /** * A single encoding definition applied to a single schema property. * @@ -414,10 +706,167 @@ export interface LicenseObject { * * A linked operation MUST be identified using either an `operationRef` or `operationId`. In the case of an `operationId`, it MUST be unique and resolved in the scope of the OAS document. Because of the potential for name clashes, the `operationRef` syntax is preferred for OpenAPI documents with external references. * - * TODO... + * **Examples** + * + * Computing a link from a request operation where the `$request.path.id` is used to pass a request parameter to the linked operation. + * + * ```yaml + * paths: + * /users/{id}: + * parameters: + * - name: id + * in: path + * required: true + * description: the user identifier, as userId + * schema: + * type: string + * get: + * responses: + * '200': + * description: the user being returned + * content: + * application/json: + * schema: + * type: object + * properties: + * uuid: # the unique user id + * type: string + * format: uuid + * links: + * address: + * # the target link operationId + * operationId: getUserAddress + * parameters: + * # get the `id` field from the request path parameter named `id` + * userId: $request.path.id + * # the path item of the linked operation + * /users/{userid}/address: + * parameters: + * - name: userid + * in: path + * required: true + * description: the user identifier, as userId + * schema: + * type: string + * # linked operation + * get: + * operationId: getUserAddress + * responses: + * '200': + * description: the user's address + * ``` + * + * When a runtime expression fails to evaluate, no parameter value is passed to the target operation. + * + * Values from the response body can be used to drive a linked operation. + * + * ```yaml + * links: + * address: + * operationId: getUserAddressByUUID + * parameters: + * # get the `uuid` field from the `uuid` field in the response body + * userUuid: $response.body#/uuid + * ``` + * + * Clients follow all links at their discretion. Neither permissions, nor the capability to make a successful call to that link, is guaranteed solely by the existence of a relationship. + * + * **OperationRef Examples** + * + * As references to `operationId` MAY NOT be possible (the `operationId` is an optional field in an {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#operation-object Operation Object}), references MAY also be made through a relative `operationRef`: + * + * ```yaml + * links: + * UserRepositories: + * # returns array of '#/components/schemas/repository' + * operationRef: '#/paths/~12.0~1repositories~1{username}/get' + * parameters: + * username: $response.body#/username + * ``` + * + * or an absolute `operationRef`: + * + * ```yaml + * links: + * UserRepositories: + * # returns array of '#/components/schemas/repository' + * operationRef: 'https://na2.gigantic-server.com/#/paths/~12.0~1repositories~1{username}/get' + * parameters: + * username: $response.body#/username + * ``` + * + * Note that in the use of `operationRef`, the _escaped forward-slash_ is necessary when using JSON references. + * + * **Runtime Expressions** + * + * Runtime expressions allow defining values based on information that will only be available within the HTTP message in an actual API call. This mechanism is used by {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#link-object Link Objects} and {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#callback-object Callback Objects}. + * + * The runtime expression is defined by the following {@link https://tools.ietf.org/html/rfc5234 ABNF} syntax + * + * ```abnf + * expression = ( "$url" / "$method" / "$statusCode" / "$request." source / "$response." source ) + * source = ( header-reference / query-reference / path-reference / body-reference ) + * header-reference = "header." token + * query-reference = "query." name + * path-reference = "path." name + * body-reference = "body" ["#" json-pointer ] + * json-pointer = *( "/" reference-token ) + * reference-token = *( unescaped / escaped ) + * unescaped = %x00-2E / %x30-7D / %x7F-10FFFF + * ; %x2F ('/') and %x7E ('~') are excluded from 'unescaped' + * escaped = "~" ( "0" / "1" ) + * ; representing '~' and '/', respectively + * name = *( CHAR ) + * token = 1*tchar + * tchar = "!" / "#" / "$" / "%" / "&" / "'" / "*" / "+" / "-" / "." / + * "^" / "_" / "`" / "|" / "~" / DIGIT / ALPHA + * ``` + * + * Here, `json-pointer` is taken from {@link https://tools.ietf.org/html/rfc6901 RFC6901}, `char` from {@link https://tools.ietf.org/html/rfc7159#section-7 RFC7159} and `token` from {@link https://tools.ietf.org/html/rfc7230#section-3.2.6 RFC7230}. + * + * The `name` identifier is case-sensitive, whereas `token` is not. + * + * The table below provides examples of runtime expressions and examples of their use in a value: + * + * **Examples** + * + * | Source Location | example expression | notes | + * | -------- | ------- | ------- | + * | HTTP Method | `$method` | The allowable values for the `$method` will be those for the HTTP operation. | + * | Requested media type | `$request.header.accept` | | + * | Request parameter | `$request.path.id` | Request parameters MUST be declared in the `parameters` section of the parent operation or they cannot be evaluated. This includes request headers. | + * | Request body property | `$request.body#/user/uuid` | In operations which accept payloads, references may be made to portions of the `requestBody` or the entire body. | + * | Request URL | `$url` | | + * | Response value | `$response.body#/status` | In operations which return payloads, references may be made to portions of the response body or the entire body. | + * | Response header | `$response.header.Server` | Single header values only are available | + * + * Runtime expressions preserve the type of the referenced value. Expressions can be embedded into string values by surrounding the expression with `{}` curly braces. */ export interface LinkObject { - // TODO... + /** + * A description of the link. {@link https://spec.commonmark.org/ CommonMark syntax} MAY be used for rich text representation. + */ + description?: string; + /** + * The name of an _existing_, resolvable OAS operation, as defined with a unique `operationId`. This field is mutually exclusive of the `operationRef` field. + */ + operationId?: string; + /** + * A relative or absolute URI reference to an OAS operation. This field is mutually exclusive of the `operationId` field, and MUST point to an {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#operation-object Operation Object}. Relative `operationRef` values MAY be used to locate an existing {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#operation-object Operation Object} in the OpenAPI definition. See the rules for resolving {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#relative-references-in-uris Relative References}. + */ + operationRef?: string; + /** + * A map representing parameters to pass to an operation as specified with `operationId` or identified via `operationRef`. The key is the parameter name to be used, whereas the value can be a constant or an expression to be evaluated and passed to the linked operation. The parameter name can be qualified using the {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#parameterIn parameter location} `[{in}.]{name}` for operations that use the same parameter name in different locations (e.g. path.id). + */ + parameters?: Record; + /** + * A literal value or {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#runtime-expressions {expression}} to use as a request body when calling the target operation. + */ + requestBody?: unknown | string; + /** + * A server object to be used by the target operation. + */ + server?: ServerObject; } /** @@ -425,6 +874,8 @@ export interface LinkObject { * * This object MAY be extended with {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specification-extensions Specification Extensions}. * + * **Media Type Examples** + * * @example * ```yaml * application/json: @@ -470,6 +921,72 @@ export interface MediaTypeObject { schema?: SchemaObject; } +/** + * Configuration details for a supported OAuth Flow + * + * This object MAY be extended with {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specification-extensions Specification Extensions}. + * + * **OAuth Flow Object Examples** + * + * ```yaml + * type: oauth2 + * flows: + * implicit: + * authorizationUrl: https://example.com/api/oauth/dialog + * scopes: + * write:pets: modify pets in your account + * read:pets: read your pets + * authorizationCode: + * authorizationUrl: https://example.com/api/oauth/dialog + * tokenUrl: https://example.com/api/oauth/token + * scopes: + * write:pets: modify pets in your account + * read:pets: read your pets + * ``` + */ +export interface OAuthFlowObject { + /** + * **REQUIRED**. The authorization URL to be used for this flow. This MUST be in the form of a URL. The OAuth2 standard requires the use of TLS. + */ + authorizationUrl: string; + /** + * The URL to be used for obtaining refresh tokens. This MUST be in the form of a URL. The OAuth2 standard requires the use of TLS. + */ + refreshUrl?: string; + /** + * **REQUIRED**. The available scopes for the OAuth2 security scheme. A map between the scope name and a short description for it. The map MAY be empty. + */ + scopes: Record; + /** + * **REQUIRED**. The token URL to be used for this flow. This MUST be in the form of a URL. The OAuth2 standard requires the use of TLS. + */ + tokenUrl: string; +} + +/** + * Allows configuration of the supported OAuth Flows. + * + * This object MAY be extended with {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specification-extensions Specification Extensions}. + */ +export interface OAuthFlowsObject { + /** + * Configuration for the OAuth Authorization Code flow. Previously called `accessCode` in OpenAPI 2.0. + */ + authorizationCode?: OAuthFlowObject; + /** + * Configuration for the OAuth Client Credentials flow. Previously called `application` in OpenAPI 2.0. + */ + clientCredentials?: OAuthFlowObject; + /** + * Configuration for the OAuth Implicit flow + */ + implicit?: OAuthFlowObject; + /** + * Configuration for the OAuth Resource Owner Password flow + */ + password?: OAuthFlowObject; +} + /** * Describes a single API operation on a path. * @@ -830,7 +1347,45 @@ export interface PathItemObject { * * This object MAY be extended with {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specification-extensions Specification Extensions}. * - * TODO... + * **Path Templating Matching** + * + * Assuming the following paths, the concrete definition, `/pets/mine`, will be matched first if used: + * + * ``` + * /pets/{petId} + * /pets/mine + * ``` + * + * The following paths are considered identical and invalid: + * + * ``` + * /pets/{petId} + * /pets/{name} + * ``` + * + * The following may lead to ambiguous resolution: + * + * ``` + * /{entity}/me + * /books/{id} + * ``` + * + * **Paths Object Example** + * + * ```yaml + * /pets: + * get: + * description: Returns all pets from the system that the user has access to + * responses: + * '200': + * description: A list of pets. + * content: + * application/json: + * schema: + * type: array + * items: + * $ref: '#/components/schemas/pet' + * ``` */ export interface PathsObject { /** @@ -891,10 +1446,65 @@ export interface ReferenceObject { * * This object MAY be extended with {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specification-extensions Specification Extensions}. * - * TODO... + * **Request Body Examples** + * + * A request body with a referenced model definition. + * + * ```yaml + * description: user to add to the system + * content: + * 'application/json': + * schema: + * $ref: '#/components/schemas/User' + * examples: + * user: + * summary: User Example + * externalValue: 'https://foo.bar/examples/user-example.json' + * 'application/xml': + * schema: + * $ref: '#/components/schemas/User' + * examples: + * user: + * summary: User example in XML + * externalValue: 'https://foo.bar/examples/user-example.xml' + * 'text/plain': + * examples: + * user: + * summary: User example in Plain text + * externalValue: 'https://foo.bar/examples/user-example.txt' + * '*\/*': + * examples: + * user: + * summary: User example in other format + * externalValue: 'https://foo.bar/examples/user-example.whatever' + * ``` + * + * A body parameter that is an array of string values: + * + * ```yaml + * description: user to add to the system + * required: true + * content: + * text/plain: + * schema: + * type: array + * items: + * type: string + * ``` */ export interface RequestBodyObject { - // TODO... + /** + * **REQUIRED**. The content of the request body. The key is a media type or {@link https://tools.ietf.org/html/rfc7231#appendix-D media type range} and the value describes it. For requests that match multiple keys, only the most specific key is applicable. e.g. text/plain overrides text/* + */ + content: Record; + /** + * A brief description of the request body. This could contain examples of use. {@link https://spec.commonmark.org/ CommonMark syntax} MAY be used for rich text representation. + */ + description?: string; + /** + * Determines if the request body is required in the request. Defaults to `false`. + */ + required?: boolean; } /** @@ -1026,10 +1636,40 @@ export interface ResponsesObject { * * **Properties** * - * TODO... + * The OpenAPI Schema Object {@link https://tools.ietf.org/html/draft-bhutton-json-schema-00#section-4.3.3 dialect} is defined as requiring the {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#fixed-fields-20 OAS base vocabulary}, in addition to the vocabularies as specified in the JSON Schema draft 2020-12 {@link https://tools.ietf.org/html/draft-bhutton-json-schema-00#section-8 general purpose meta-schema}. + * + * The OpenAPI Schema Object dialect for this version of the specification is identified by the URI `https://spec.openapis.org/oas/3.1/dialect/base` (the "OAS dialect schema id"). + * + * The following properties are taken from the JSON Schema specification but their definitions have been extended by the OAS: + * + * - description - {@link https://spec.commonmark.org/ CommonMark syntax} MAY be used for rich text representation. + * - format - See {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#dataTypeFormat Data Type Formats} for further details. While relying on JSON Schema's defined formats, the OAS offers a few additional predefined formats. + * + * In addition to the JSON Schema properties comprising the OAS dialect, the Schema Object supports keywords from any other vocabularies, or entirely arbitrary properties. + * + * The OpenAPI Specification's base vocabulary is comprised of the following keywords: + * + * This object MAY be extended with {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specification-extensions Specification Extensions}, though as noted, additional properties MAY omit the `x-` prefix within this object. */ export interface SchemaObject { - // TODO... + /** + * Adds support for polymorphism. The discriminator is an object name that is used to differentiate between other schemas which may satisfy the payload description. See {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#composition-and-inheritance-polymorphism Composition and Inheritance} for more details. + */ + discriminator?: DiscriminatorObject; + /** + * A free-form property to include an example of an instance for this schema. To represent examples that cannot be naturally represented in JSON or YAML, a string value can be used to contain the example with escaping where necessary. + * + * **Deprecated**: The `example` property has been deprecated in favor of the JSON Schema `examples` keyword. Use of `example` is discouraged, and later versions of this specification may remove it. + */ + example?: unknown; + /** + * Additional external documentation for this schema. + */ + externalDocs?: ExternalDocumentationObject; + /** + * This MAY be used only on properties schemas. It has no effect on root schemas. Adds additional metadata to describe the XML representation of this property. + */ + xml?: XMLObject; } /** @@ -1080,11 +1720,104 @@ export interface SecurityRequirementObject { * * This object MAY be extended with {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specification-extensions Specification Extensions}. * - * TODO... + * **Security Scheme Object Example** + * + * **Basic Authentication Sample** + * + * ```yaml + * type: http + * scheme: basic + * ``` + * + * **API Key Sample** + * + * ```yaml + * type: apiKey + * name: api_key + * in: header + * ``` + * + * **JWT Bearer Sample** + * + * ```yaml + * type: http + * scheme: bearer + * bearerFormat: JWT + * ``` + * + * **Implicit OAuth2 Sample** + * + * ```yaml + * type: oauth2 + * flows: + * implicit: + * authorizationUrl: https://example.com/api/oauth/dialog + * scopes: + * write:pets: modify pets in your account + * read:pets: read your pets + * ``` */ -export interface SecuritySchemeObject { - // TODO... -} +export type SecuritySchemeObject = { + /** + * A description for security scheme. {@link https://spec.commonmark.org/ CommonMark syntax} MAY be used for rich text representation. + */ + description?: string; +} & ( + | { + /** + * **REQUIRED**. The location of the API key. Valid values are "query", "header" or "cookie". + */ + in: 'cookie' | 'header' | 'query'; + /** + * **REQUIRED**. The name of the header, query or cookie parameter to be used. + */ + name: string; + /** + * **REQUIRED**. The type of the security scheme. Valid values are `"apiKey"`, `"http"`, `"mutualTLS"`, `"oauth2"`, `"openIdConnect"`. + */ + type: 'apiKey'; + } + | { + /** + * A hint to the client to identify how the bearer token is formatted. Bearer tokens are usually generated by an authorization server, so this information is primarily for documentation purposes. + */ + bearerFormat?: string; + /** + * **REQUIRED**. The name of the HTTP Authorization scheme to be used in the {@link https://tools.ietf.org/html/rfc7235#section-5.1 Authorization header as defined in RFC7235}. The values used SHOULD be registered in the {@link https://www.iana.org/assignments/http-authschemes/http-authschemes.xhtml IANA Authentication Scheme registry}. + */ + scheme: string; + /** + * **REQUIRED**. The type of the security scheme. Valid values are `"apiKey"`, `"http"`, `"mutualTLS"`, `"oauth2"`, `"openIdConnect"`. + */ + type: 'http'; + } + | { + /** + * **REQUIRED**. The type of the security scheme. Valid values are `"apiKey"`, `"http"`, `"mutualTLS"`, `"oauth2"`, `"openIdConnect"`. + */ + type: 'mutualTLS'; + } + | { + /** + * **REQUIRED**. An object containing configuration information for the flow types supported. + */ + flows: OAuthFlowsObject; + /** + * **REQUIRED**. The type of the security scheme. Valid values are `"apiKey"`, `"http"`, `"mutualTLS"`, `"oauth2"`, `"openIdConnect"`. + */ + type: 'oauth2'; + } + | { + /** + * **REQUIRED**. OpenId Connect URL to discover OAuth2 configuration values. This MUST be in the form of a URL. The OpenID Connect standard requires the use of TLS. + */ + openIdConnectUrl: string; + /** + * **REQUIRED**. The type of the security scheme. Valid values are `"apiKey"`, `"http"`, `"mutualTLS"`, `"oauth2"`, `"openIdConnect"`. + */ + type: 'openIdConnect'; + } +); /** * An object representing a Server. @@ -1157,3 +1890,218 @@ export interface TagObject { */ name: string; } + +/** + * A metadata object that allows for more fine-tuned XML model definitions. + * + * When using arrays, XML element names are _not_ inferred (for singular/plural forms) and the `name` property SHOULD be used to add that information. See examples for expected behavior. + * + * This object MAY be extended with {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specification-extensions Specification Extensions}. + * + * **XML Object Examples** + * + * The examples of the XML object definitions are included inside a property definition of a {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#schema-object Schema Object} with a sample of the XML representation of it. + * + * **No XML Element** + * + * Basic string property: + * + * ```yaml + * animals: + * type: string + * ``` + * + * ```xml + * ... + * ``` + * + * Basic string array property ({@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#xmlWrapped `wrapped`} is `false` by default): + * + * ```yaml + * animals: + * type: array + * items: + * type: string + * ``` + * + * ```xml + * ... + * ... + * ... + * ``` + * + * **XML Name Replacement** + * + * ```yaml + * animals: + * type: string + * xml: + * name: animal + * ``` + * + * ```xml + * ... + * ``` + * + * **XML Attribute, Prefix and Namespace** + * + * In this example, a full model definition is shown. + * + * ```yaml + * Person: + * type: object + * properties: + * id: + * type: integer + * format: int32 + * xml: + * attribute: true + * name: + * type: string + * xml: + * namespace: https://example.com/schema/sample + * prefix: sample + * ``` + * + * ```xml + * + * example + * + * ``` + * + * **XML Arrays** + * + * Changing the element names: + * + * ```yaml + * animals: + * type: array + * items: + * type: string + * xml: + * name: animal + * ``` + * + * ```xml + * value + * value + * ``` + * + * The external `name` property has no effect on the XML: + * + * ```yaml + * animals: + * type: array + * items: + * type: string + * xml: + * name: animal + * xml: + * name: aliens + * ``` + * + * ```xml + * value + * value + * ``` + * + * Even when the array is wrapped, if a name is not explicitly defined, the same name will be used both internally and externally: + * + * ```yaml + * animals: + * type: array + * items: + * type: string + * xml: + * wrapped: true + * ``` + * + * ```xml + * + * value + * value + * + * ``` + * + * To overcome the naming problem in the example above, the following definition can be used: + * + * ```yaml + * animals: + * type: array + * items: + * type: string + * xml: + * name: animal + * xml: + * wrapped: true + * ``` + * + * ```xml + * + * value + * value + * + * ``` + * + * Affecting both internal and external names: + * + * ```yaml + * animals: + * type: array + * items: + * type: string + * xml: + * name: animal + * xml: + * name: aliens + * wrapped: true + * ``` + * + * ```xml + * + * value + * value + * + * ``` + * + * If we change the external element but not the internal ones: + * + * ```yaml + * animals: + * type: array + * items: + * type: string + * xml: + * name: aliens + * wrapped: true + * ``` + * + * ```xml + * + * value + * value + * + * ``` + */ +export interface XMLObject { + /** + * Declares whether the property definition translates to an attribute instead of an element. Default value is `false`. + */ + attribute?: boolean; + /** + * Replaces the name of the element/attribute used for the described schema property. When defined within `items`, it will affect the name of the individual XML elements within the list. When defined alongside `type` being `array` (outside the `items`), it will affect the wrapping element and only if `wrapped` is `true`. If `wrapped` is `false`, it will be ignored. + */ + name?: string; + /** + * The URI of the namespace definition. This MUST be in the form of an absolute URI. + */ + namespace?: string; + /** + * The prefix to be used for the {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#xmlName name}. + */ + prefix?: string; + /** + * MAY be used only for an array definition. Signifies whether the array is wrapped (for example, ``) or unwrapped (``). Default value is `false`. The definition takes effect only when defined alongside `type` being `array` (outside the `items`). + */ + wrapped?: boolean; +} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 7ea945702..b4baad027 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -15,8 +15,8 @@ importers: specifier: 0.5.0 version: 0.5.0(encoding@0.1.13) '@changesets/cli': - specifier: 2.27.7 - version: 2.27.7 + specifier: 2.27.8 + version: 2.27.8 '@types/node': specifier: 20.14.10 version: 20.14.10 @@ -1497,11 +1497,11 @@ packages: '@bcoe/v8-coverage@0.2.3': resolution: {integrity: sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==} - '@changesets/apply-release-plan@7.0.4': - resolution: {integrity: sha512-HLFwhKWayKinWAul0Vj+76jVx1Pc2v55MGPVjZ924Y/ROeSsBMFutv9heHmCUj48lJyRfOTJG5+ar+29FUky/A==} + '@changesets/apply-release-plan@7.0.5': + resolution: {integrity: sha512-1cWCk+ZshEkSVEZrm2fSj1Gz8sYvxgUL4Q78+1ZZqeqfuevPTPk033/yUZ3df8BKMohkqqHfzj0HOOrG0KtXTw==} - '@changesets/assemble-release-plan@6.0.3': - resolution: {integrity: sha512-bLNh9/Lgl1VwkjWZTq8JmRqH+hj7/Yzfz0jsQ/zJJ+FTmVqmqPj3szeKOri8O/hEM8JmHW019vh2gTO9iq5Cuw==} + '@changesets/assemble-release-plan@6.0.4': + resolution: {integrity: sha512-nqICnvmrwWj4w2x0fOhVj2QEGdlUuwVAwESrUo5HLzWMI1rE5SWfsr9ln+rDqWB6RQ2ZyaMZHUcU7/IRaUJS+Q==} '@changesets/changelog-git@0.2.0': resolution: {integrity: sha512-bHOx97iFI4OClIT35Lok3sJAwM31VbUM++gnMBV16fdbtBhgYu4dxsphBF/0AZZsyAHMrnM0yFcj5gZM1py6uQ==} @@ -1509,45 +1509,45 @@ packages: '@changesets/changelog-github@0.5.0': resolution: {integrity: sha512-zoeq2LJJVcPJcIotHRJEEA2qCqX0AQIeFE+L21L8sRLPVqDhSXY8ZWAt2sohtBpFZkBwu+LUwMSKRr2lMy3LJA==} - '@changesets/cli@2.27.7': - resolution: {integrity: sha512-6lr8JltiiXPIjDeYg4iM2MeePP6VN/JkmqBsVA5XRiy01hGS3y629LtSDvKcycj/w/5Eur1rEwby/MjcYS+e2A==} + '@changesets/cli@2.27.8': + resolution: {integrity: sha512-gZNyh+LdSsI82wBSHLQ3QN5J30P4uHKJ4fXgoGwQxfXwYFTJzDdvIJasZn8rYQtmKhyQuiBj4SSnLuKlxKWq4w==} hasBin: true - '@changesets/config@3.0.2': - resolution: {integrity: sha512-cdEhS4t8woKCX2M8AotcV2BOWnBp09sqICxKapgLHf9m5KdENpWjyrFNMjkLqGJtUys9U+w93OxWT0czorVDfw==} + '@changesets/config@3.0.3': + resolution: {integrity: sha512-vqgQZMyIcuIpw9nqFIpTSNyc/wgm/Lu1zKN5vECy74u95Qx/Wa9g27HdgO4NkVAaq+BGA8wUc/qvbvVNs93n6A==} '@changesets/errors@0.2.0': resolution: {integrity: sha512-6BLOQUscTpZeGljvyQXlWOItQyU71kCdGz7Pi8H8zdw6BI0g3m43iL4xKUVPWtG+qrrL9DTjpdn8eYuCQSRpow==} - '@changesets/get-dependents-graph@2.1.1': - resolution: {integrity: sha512-LRFjjvigBSzfnPU2n/AhFsuWR5DK++1x47aq6qZ8dzYsPtS/I5mNhIGAS68IAxh1xjO9BTtz55FwefhANZ+FCA==} + '@changesets/get-dependents-graph@2.1.2': + resolution: {integrity: sha512-sgcHRkiBY9i4zWYBwlVyAjEM9sAzs4wYVwJUdnbDLnVG3QwAaia1Mk5P8M7kraTOZN+vBET7n8KyB0YXCbFRLQ==} '@changesets/get-github-info@0.6.0': resolution: {integrity: sha512-v/TSnFVXI8vzX9/w3DU2Ol+UlTZcu3m0kXTjTT4KlAdwSvwutcByYwyYn9hwerPWfPkT2JfpoX0KgvCEi8Q/SA==} - '@changesets/get-release-plan@4.0.3': - resolution: {integrity: sha512-6PLgvOIwTSdJPTtpdcr3sLtGatT+Jr22+cQwEBJBy6wP0rjB4yJ9lv583J9fVpn1bfQlBkDa8JxbS2g/n9lIyA==} + '@changesets/get-release-plan@4.0.4': + resolution: {integrity: sha512-SicG/S67JmPTrdcc9Vpu0wSQt7IiuN0dc8iR5VScnnTVPfIaLvKmEGRvIaF0kcn8u5ZqLbormZNTO77bCEvyWw==} '@changesets/get-version-range-type@0.4.0': resolution: {integrity: sha512-hwawtob9DryoGTpixy1D3ZXbGgJu1Rhr+ySH2PvTLHvkZuQ7sRT4oQwMh0hbqZH1weAooedEjRsbrWcGLCeyVQ==} - '@changesets/git@3.0.0': - resolution: {integrity: sha512-vvhnZDHe2eiBNRFHEgMiGd2CT+164dfYyrJDhwwxTVD/OW0FUD6G7+4DIx1dNwkwjHyzisxGAU96q0sVNBns0w==} + '@changesets/git@3.0.1': + resolution: {integrity: sha512-pdgHcYBLCPcLd82aRcuO0kxCDbw/yISlOtkmwmE8Odo1L6hSiZrBOsRl84eYG7DRCab/iHnOkWqExqc4wxk2LQ==} - '@changesets/logger@0.1.0': - resolution: {integrity: sha512-pBrJm4CQm9VqFVwWnSqKEfsS2ESnwqwH+xR7jETxIErZcfd1u2zBSqrHbRHR7xjhSgep9x2PSKFKY//FAshA3g==} + '@changesets/logger@0.1.1': + resolution: {integrity: sha512-OQtR36ZlnuTxKqoW4Sv6x5YIhOmClRd5pWsjZsddYxpWs517R0HkyiefQPIytCVh4ZcC5x9XaG8KTdd5iRQUfg==} '@changesets/parse@0.4.0': resolution: {integrity: sha512-TS/9KG2CdGXS27S+QxbZXgr8uPsP4yNJYb4BC2/NeFUj80Rni3TeD2qwWmabymxmrLo7JEsytXH1FbpKTbvivw==} - '@changesets/pre@2.0.0': - resolution: {integrity: sha512-HLTNYX/A4jZxc+Sq8D1AMBsv+1qD6rmmJtjsCJa/9MSRybdxh0mjbTvE6JYZQ/ZiQ0mMlDOlGPXTm9KLTU3jyw==} + '@changesets/pre@2.0.1': + resolution: {integrity: sha512-vvBJ/If4jKM4tPz9JdY2kGOgWmCowUYOi5Ycv8dyLnEE8FgpYYUo1mgJZxcdtGGP3aG8rAQulGLyyXGSLkIMTQ==} - '@changesets/read@0.6.0': - resolution: {integrity: sha512-ZypqX8+/im1Fm98K4YcZtmLKgjs1kDQ5zHpc2U1qdtNBmZZfo/IBiG162RoP0CUF05tvp2y4IspH11PLnPxuuw==} + '@changesets/read@0.6.1': + resolution: {integrity: sha512-jYMbyXQk3nwP25nRzQQGa1nKLY0KfoOV7VLgwucI0bUO8t8ZLCr6LZmgjXsiKuRDc+5A6doKPr9w2d+FEJ55zQ==} - '@changesets/should-skip-package@0.1.0': - resolution: {integrity: sha512-FxG6Mhjw7yFStlSM7Z0Gmg3RiyQ98d/9VpQAZ3Fzr59dCOM9G6ZdYbjiSAt0XtFr9JR5U2tBaJWPjrkGGc618g==} + '@changesets/should-skip-package@0.1.1': + resolution: {integrity: sha512-H9LjLbF6mMHLtJIc/eHR9Na+MifJ3VxtgP/Y+XLn4BF7tDTEN1HNYtH6QMcjP1uxp9sjaFYmW8xqloaCi/ckTg==} '@changesets/types@4.1.0': resolution: {integrity: sha512-LDQvVDv5Kb50ny2s25Fhm3d9QSZimsoUGBsUioj6MC3qbMUCuC8GPIvk/M6IvXx3lYhAs0lwWUQLb+VIEUCECw==} @@ -1555,8 +1555,8 @@ packages: '@changesets/types@6.0.0': resolution: {integrity: sha512-b1UkfNulgKoWfqyHtzKS5fOZYSJO+77adgL7DLRDr+/7jhChN+QcHnbjiQVOz/U+Ts3PGNySq7diAItzDgugfQ==} - '@changesets/write@0.3.1': - resolution: {integrity: sha512-SyGtMXzH3qFqlHKcvFY2eX+6b0NGiFcNav8AFsYwy5l8hejOeoeTDemu5Yjmke2V5jpzY+pBvM0vCCQ3gdZpfw==} + '@changesets/write@0.3.2': + resolution: {integrity: sha512-kDxDrPNpUgsjDbWBvUo27PzKX4gqeKOlhibaOXDJA6kuBisGqNHv/HwGJrAu8U/dSf8ZEFIeHIPtvSlZI1kULw==} '@colors/colors@1.5.0': resolution: {integrity: sha512-ooWCrlZP11i8GImSjTHYHLkvFDP48nS4+204nGb1RiX/WXYHmJA2III9/e2DWVabCESdW7hBAEzHRqUn9OUVvQ==} @@ -5155,9 +5155,6 @@ packages: resolution: {integrity: sha512-v2ZsoEuVHYy8ZIlYqwPe/39Cy+cFDzp4dXPaxNvkEuouymu+2Jbz0PxpKarJHYJTmv2HWT3O382qY8l4jMWthw==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} - find-yarn-workspace-root2@1.2.16: - resolution: {integrity: sha512-hr6hb1w8ePMpPVUK39S4RlwJzi+xPLuVuG8XlwXU3KD5Yn3qgBWVfy3AzNlDhWvE1EORCE65/Qm26rFQt3VLVA==} - flat-cache@4.0.1: resolution: {integrity: sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw==} engines: {node: '>=16'} @@ -5880,10 +5877,6 @@ packages: resolution: {integrity: sha512-IXO6OCs9yg8tMKzfPZ1YmheJbZCiEsnBdcB03l0OcfK9prKnJb96siuHCr5Fl37/yo9DnKU+TLpxzTUspw9shg==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} - load-yaml-file@0.2.0: - resolution: {integrity: sha512-OfCBkGEw4nN6JLtgRidPX6QxjBQGQf72q3si2uvqyFEMbycSFFHwAZeXx6cJgFM9wmLrf9zBwCP3Ivqa+LLZPw==} - engines: {node: '>=6'} - loader-runner@4.3.0: resolution: {integrity: sha512-3R/1M+yS3j5ou80Me59j7F9IMs4PXs3VqRrm0TU3AbKPxlmpoY1TNscJV/oGJXo8qCatFGTfDbY6W6ipGOYXfg==} engines: {node: '>=6.11.5'} @@ -6448,6 +6441,9 @@ packages: package-json-from-dist@1.0.0: resolution: {integrity: sha512-dATvCeZN/8wQsGywez1mzHtTlP22H8OEfPrVMLNr4/eGa+ijtLn/6M5f0dY8UKNrC2O9UCU6SSoG3qRKnt7STw==} + package-manager-detector@0.2.0: + resolution: {integrity: sha512-E385OSk9qDcXhcM9LNSe4sdhx8a9mAPrZ4sMLW+tmxl5ZuGtPUcdFu+MPP2jbgiWAZ6Pfe5soGFMd+0Db5Vrog==} + pacote@17.0.6: resolution: {integrity: sha512-cJKrW21VRE8vVTRskJo78c/RCvwJCn1f4qgfxL4w77SOWrTCRcmfkYHlHtS0gqpgjv3zhXflRtgsrUCX5xwNnQ==} engines: {node: ^16.14.0 || >=18.0.0} @@ -6593,10 +6589,6 @@ packages: piscina@4.4.0: resolution: {integrity: sha512-+AQduEJefrOApE4bV7KRmp3N2JnnyErlVqq4P/jmko4FPz9Z877BCccl/iB3FdrWSUkvbGV9Kan/KllJgat3Vg==} - pkg-dir@4.2.0: - resolution: {integrity: sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==} - engines: {node: '>=8'} - pkg-dir@7.0.0: resolution: {integrity: sha512-Ie9z/WINcxxLp27BKOCHGde4ITq9UklYKDzVo1nhk5sqGEXU3FpkwP5GM2voTGJkGd9B3Otl+Q4uwSOeSUtOBA==} engines: {node: '>=14.16'} @@ -6749,10 +6741,6 @@ packages: preact@10.22.0: resolution: {integrity: sha512-RRurnSjJPj4rp5K6XoP45Ui33ncb7e4H7WiOHVpjbkvqvA3U+N8Z6Qbo0AE6leGYBV66n8EhEaFixvIu3SkxFw==} - preferred-pm@3.1.4: - resolution: {integrity: sha512-lEHd+yEm22jXdCphDrkvIJQU66EuLojPPtvZkpKIkiD+l0DMThF/niqZKJSoU8Vl7iuvtmzyMhir9LdVy5WMnA==} - engines: {node: '>=10'} - prelude-ls@1.2.1: resolution: {integrity: sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==} engines: {node: '>= 0.8.0'} @@ -8260,10 +8248,6 @@ packages: whatwg-url@7.1.0: resolution: {integrity: sha512-WUu7Rg1DroM7oQvGWfOiAK21n74Gg+T4elXEQYkOhtyLeWiJFoOGLXPKI/9gzIie9CtwVLm8wtw6YJdKyxSjeg==} - which-pm@2.2.0: - resolution: {integrity: sha512-MOiaDbA5ZZgUjkeMWM5EkJp4loW5ZRoa5bc3/aeMox/PJelMhE6t7S/mLuiY43DBupyxH+S0U1bTui9kWUlmsw==} - engines: {node: '>=8.15'} - which@1.3.1: resolution: {integrity: sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==} hasBin: true @@ -8766,7 +8750,7 @@ snapshots: '@babel/code-frame@7.24.7': dependencies: '@babel/highlight': 7.24.7 - picocolors: 1.0.1 + picocolors: 1.1.0 '@babel/compat-data@7.24.7': {} @@ -9086,7 +9070,7 @@ snapshots: '@babel/helper-validator-identifier': 7.24.7 chalk: 2.4.2 js-tokens: 4.0.0 - picocolors: 1.0.1 + picocolors: 1.1.0 '@babel/parser@7.24.7': dependencies: @@ -9757,13 +9741,12 @@ snapshots: '@bcoe/v8-coverage@0.2.3': {} - '@changesets/apply-release-plan@7.0.4': + '@changesets/apply-release-plan@7.0.5': dependencies: - '@babel/runtime': 7.24.7 - '@changesets/config': 3.0.2 + '@changesets/config': 3.0.3 '@changesets/get-version-range-type': 0.4.0 - '@changesets/git': 3.0.0 - '@changesets/should-skip-package': 0.1.0 + '@changesets/git': 3.0.1 + '@changesets/should-skip-package': 0.1.1 '@changesets/types': 6.0.0 '@manypkg/get-packages': 1.1.3 detect-indent: 6.1.0 @@ -9774,12 +9757,11 @@ snapshots: resolve-from: 5.0.0 semver: 7.6.2 - '@changesets/assemble-release-plan@6.0.3': + '@changesets/assemble-release-plan@6.0.4': dependencies: - '@babel/runtime': 7.24.7 '@changesets/errors': 0.2.0 - '@changesets/get-dependents-graph': 2.1.1 - '@changesets/should-skip-package': 0.1.0 + '@changesets/get-dependents-graph': 2.1.2 + '@changesets/should-skip-package': 0.1.1 '@changesets/types': 6.0.0 '@manypkg/get-packages': 1.1.3 semver: 7.6.2 @@ -9796,46 +9778,44 @@ snapshots: transitivePeerDependencies: - encoding - '@changesets/cli@2.27.7': + '@changesets/cli@2.27.8': dependencies: - '@babel/runtime': 7.24.7 - '@changesets/apply-release-plan': 7.0.4 - '@changesets/assemble-release-plan': 6.0.3 + '@changesets/apply-release-plan': 7.0.5 + '@changesets/assemble-release-plan': 6.0.4 '@changesets/changelog-git': 0.2.0 - '@changesets/config': 3.0.2 + '@changesets/config': 3.0.3 '@changesets/errors': 0.2.0 - '@changesets/get-dependents-graph': 2.1.1 - '@changesets/get-release-plan': 4.0.3 - '@changesets/git': 3.0.0 - '@changesets/logger': 0.1.0 - '@changesets/pre': 2.0.0 - '@changesets/read': 0.6.0 - '@changesets/should-skip-package': 0.1.0 + '@changesets/get-dependents-graph': 2.1.2 + '@changesets/get-release-plan': 4.0.4 + '@changesets/git': 3.0.1 + '@changesets/logger': 0.1.1 + '@changesets/pre': 2.0.1 + '@changesets/read': 0.6.1 + '@changesets/should-skip-package': 0.1.1 '@changesets/types': 6.0.0 - '@changesets/write': 0.3.1 + '@changesets/write': 0.3.2 '@manypkg/get-packages': 1.1.3 '@types/semver': 7.5.8 ansi-colors: 4.1.3 - chalk: 2.4.2 ci-info: 3.9.0 enquirer: 2.4.1 external-editor: 3.1.0 fs-extra: 7.0.1 - human-id: 1.0.2 mri: 1.2.0 outdent: 0.5.0 p-limit: 2.3.0 - preferred-pm: 3.1.4 + package-manager-detector: 0.2.0 + picocolors: 1.1.0 resolve-from: 5.0.0 semver: 7.6.2 spawndamnit: 2.0.0 term-size: 2.2.1 - '@changesets/config@3.0.2': + '@changesets/config@3.0.3': dependencies: '@changesets/errors': 0.2.0 - '@changesets/get-dependents-graph': 2.1.1 - '@changesets/logger': 0.1.0 + '@changesets/get-dependents-graph': 2.1.2 + '@changesets/logger': 0.1.1 '@changesets/types': 6.0.0 '@manypkg/get-packages': 1.1.3 fs-extra: 7.0.1 @@ -9845,12 +9825,11 @@ snapshots: dependencies: extendable-error: 0.1.7 - '@changesets/get-dependents-graph@2.1.1': + '@changesets/get-dependents-graph@2.1.2': dependencies: '@changesets/types': 6.0.0 '@manypkg/get-packages': 1.1.3 - chalk: 2.4.2 - fs-extra: 7.0.1 + picocolors: 1.1.0 semver: 7.6.2 '@changesets/get-github-info@0.6.0(encoding@0.1.13)': @@ -9860,59 +9839,53 @@ snapshots: transitivePeerDependencies: - encoding - '@changesets/get-release-plan@4.0.3': + '@changesets/get-release-plan@4.0.4': dependencies: - '@babel/runtime': 7.24.7 - '@changesets/assemble-release-plan': 6.0.3 - '@changesets/config': 3.0.2 - '@changesets/pre': 2.0.0 - '@changesets/read': 0.6.0 + '@changesets/assemble-release-plan': 6.0.4 + '@changesets/config': 3.0.3 + '@changesets/pre': 2.0.1 + '@changesets/read': 0.6.1 '@changesets/types': 6.0.0 '@manypkg/get-packages': 1.1.3 '@changesets/get-version-range-type@0.4.0': {} - '@changesets/git@3.0.0': + '@changesets/git@3.0.1': dependencies: - '@babel/runtime': 7.24.7 '@changesets/errors': 0.2.0 - '@changesets/types': 6.0.0 '@manypkg/get-packages': 1.1.3 is-subdir: 1.2.0 micromatch: 4.0.7 spawndamnit: 2.0.0 - '@changesets/logger@0.1.0': + '@changesets/logger@0.1.1': dependencies: - chalk: 2.4.2 + picocolors: 1.1.0 '@changesets/parse@0.4.0': dependencies: '@changesets/types': 6.0.0 js-yaml: 3.14.1 - '@changesets/pre@2.0.0': + '@changesets/pre@2.0.1': dependencies: - '@babel/runtime': 7.24.7 '@changesets/errors': 0.2.0 '@changesets/types': 6.0.0 '@manypkg/get-packages': 1.1.3 fs-extra: 7.0.1 - '@changesets/read@0.6.0': + '@changesets/read@0.6.1': dependencies: - '@babel/runtime': 7.24.7 - '@changesets/git': 3.0.0 - '@changesets/logger': 0.1.0 + '@changesets/git': 3.0.1 + '@changesets/logger': 0.1.1 '@changesets/parse': 0.4.0 '@changesets/types': 6.0.0 - chalk: 2.4.2 fs-extra: 7.0.1 p-filter: 2.1.0 + picocolors: 1.1.0 - '@changesets/should-skip-package@0.1.0': + '@changesets/should-skip-package@0.1.1': dependencies: - '@babel/runtime': 7.24.7 '@changesets/types': 6.0.0 '@manypkg/get-packages': 1.1.3 @@ -9920,9 +9893,8 @@ snapshots: '@changesets/types@6.0.0': {} - '@changesets/write@0.3.1': + '@changesets/write@0.3.2': dependencies: - '@babel/runtime': 7.24.7 '@changesets/types': 6.0.0 fs-extra: 7.0.1 human-id: 1.0.2 @@ -10456,7 +10428,7 @@ snapshots: agent-base: 7.1.1 http-proxy-agent: 7.0.2 https-proxy-agent: 7.0.4 - lru-cache: 10.4.0 + lru-cache: 10.4.3 socks-proxy-agent: 8.0.3 transitivePeerDependencies: - supports-color @@ -13836,11 +13808,6 @@ snapshots: locate-path: 7.2.0 path-exists: 5.0.0 - find-yarn-workspace-root2@1.2.16: - dependencies: - micromatch: 4.0.7 - pkg-dir: 4.2.0 - flat-cache@4.0.1: dependencies: flatted: 3.3.1 @@ -14482,7 +14449,7 @@ snapshots: launch-editor@2.8.0: dependencies: - picocolors: 1.0.1 + picocolors: 1.1.0 shell-quote: 1.8.1 less-loader@11.1.0(less@4.2.0)(webpack@5.90.3(esbuild@0.20.1)): @@ -14548,13 +14515,6 @@ snapshots: load-tsconfig@0.2.5: {} - load-yaml-file@0.2.0: - dependencies: - graceful-fs: 4.2.11 - js-yaml: 3.14.1 - pify: 4.0.1 - strip-bom: 3.0.0 - loader-runner@4.3.0: {} loader-utils@2.0.4: @@ -15140,6 +15100,8 @@ snapshots: package-json-from-dist@1.0.0: {} + package-manager-detector@0.2.0: {} + pacote@17.0.6: dependencies: '@npmcli/git': 5.0.7 @@ -15270,10 +15232,6 @@ snapshots: optionalDependencies: nice-napi: 1.0.2 - pkg-dir@4.2.0: - dependencies: - find-up: 4.1.0 - pkg-dir@7.0.0: dependencies: find-up: 6.3.0 @@ -15421,13 +15379,6 @@ snapshots: preact@10.22.0: {} - preferred-pm@3.1.4: - dependencies: - find-up: 5.0.0 - find-yarn-workspace-root2: 1.2.16 - path-exists: 4.0.0 - which-pm: 2.2.0 - prelude-ls@1.2.1: {} prettier-linter-helpers@1.0.0: @@ -16533,7 +16484,7 @@ snapshots: '@tsconfig/node14': 1.0.3 '@tsconfig/node16': 1.0.4 '@types/node': 20.14.5 - acorn: 8.12.0 + acorn: 8.12.1 acorn-walk: 8.3.3 arg: 4.1.3 create-require: 1.1.1 @@ -16692,13 +16643,13 @@ snapshots: dependencies: browserslist: 4.23.1 escalade: 3.1.2 - picocolors: 1.0.1 + picocolors: 1.1.0 update-browserslist-db@1.1.0(browserslist@4.23.3): dependencies: browserslist: 4.23.3 escalade: 3.1.2 - picocolors: 1.0.1 + picocolors: 1.1.0 uri-js@4.4.1: dependencies: @@ -16810,7 +16761,7 @@ snapshots: fs-extra: 11.2.0 open: 10.1.0 perfect-debounce: 1.0.0 - picocolors: 1.0.1 + picocolors: 1.1.0 sirv: 2.0.4 vite: 5.4.6(@types/node@20.14.5)(less@4.2.0)(sass@1.71.1)(terser@5.31.1) transitivePeerDependencies: @@ -17254,11 +17205,6 @@ snapshots: tr46: 1.0.1 webidl-conversions: 4.0.2 - which-pm@2.2.0: - dependencies: - load-yaml-file: 0.2.0 - path-exists: 4.0.0 - which@1.3.1: dependencies: isexe: 2.0.0 -- 2.51.2 From 76779246534391deca5a371df2c7dc76e9d2eb73 Mon Sep 17 00:00:00 2001 From: Lubos Date: Mon, 30 Sep 2024 19:29:46 +0800 Subject: [PATCH 39/49] fix: handle multiple form-data parameters in Swagger 2.0 --- .changeset/neat-windows-build.md | 5 ++ .../openapi-ts.config.ts | 2 - packages/openapi-ts/src/generate/services.ts | 6 +- packages/openapi-ts/src/generate/types.ts | 43 +++++++++---- packages/openapi-ts/src/index.ts | 3 +- .../openapi-ts/src/openApi/3.0.3/index.ts | 2 + .../src/openApi/3.0.3/parser/index.ts | 6 ++ .../src/openApi/3.0.3/types/spec.ts | 7 ++ .../openapi-ts/src/openApi/3.1/types/spec.ts | 2 +- packages/openapi-ts/src/openApi/index.ts | 5 +- .../src/plugins/@hey-api/schemas/types.ts | 2 +- .../src/plugins/@hey-api/services/types.ts | 2 +- .../src/plugins/@hey-api/types/types.ts | 2 +- .../plugins/@tanstack/react-query/types.ts | 2 +- .../plugins/@tanstack/solid-query/types.ts | 2 +- .../plugins/@tanstack/svelte-query/types.ts | 2 +- .../src/plugins/@tanstack/vue-query/types.ts | 2 +- packages/openapi-ts/src/plugins/index.ts | 37 +++++++---- packages/openapi-ts/src/types/config.ts | 6 +- packages/openapi-ts/test/2.0.spec.ts | 64 +++++++++++++++++++ packages/openapi-ts/test/3.1.0.spec.ts | 10 +-- .../test/__snapshots__/2.0/index.ts | 3 + .../test/__snapshots__/2.0/services.gen.ts | 16 +++++ .../test/__snapshots__/2.0/types.gen.ts | 16 +++++ packages/openapi-ts/test/sample.cjs | 24 +++---- .../openapi-ts/test/spec/2.0/form-data.json | 51 +++++++++++++++ 26 files changed, 267 insertions(+), 55 deletions(-) create mode 100644 .changeset/neat-windows-build.md create mode 100644 packages/openapi-ts/src/openApi/3.0.3/index.ts create mode 100644 packages/openapi-ts/src/openApi/3.0.3/parser/index.ts create mode 100644 packages/openapi-ts/src/openApi/3.0.3/types/spec.ts create mode 100644 packages/openapi-ts/test/2.0.spec.ts create mode 100644 packages/openapi-ts/test/__snapshots__/2.0/index.ts create mode 100644 packages/openapi-ts/test/__snapshots__/2.0/services.gen.ts create mode 100644 packages/openapi-ts/test/__snapshots__/2.0/types.gen.ts create mode 100644 packages/openapi-ts/test/spec/2.0/form-data.json diff --git a/.changeset/neat-windows-build.md b/.changeset/neat-windows-build.md new file mode 100644 index 000000000..3ed9454ce --- /dev/null +++ b/.changeset/neat-windows-build.md @@ -0,0 +1,5 @@ +--- +'@hey-api/openapi-ts': patch +--- + +fix: handle multiple form-data parameters in Swagger 2.0 diff --git a/examples/openapi-ts-tanstack-react-query/openapi-ts.config.ts b/examples/openapi-ts-tanstack-react-query/openapi-ts.config.ts index 2aa9e83f4..dceebc9ef 100644 --- a/examples/openapi-ts-tanstack-react-query/openapi-ts.config.ts +++ b/examples/openapi-ts-tanstack-react-query/openapi-ts.config.ts @@ -4,8 +4,6 @@ export default defineConfig({ client: '@hey-api/client-fetch', input: 'https://raw.githubusercontent.com/swagger-api/swagger-petstore/master/src/main/resources/openapi.yaml', - // 'https://raw.githubusercontent.com/Redocly/museum-openapi-example/main/openapi.yaml', - // '../../packages/openapi-ts/test/spec/v3.json', output: { format: 'prettier', lint: 'eslint', diff --git a/packages/openapi-ts/src/generate/services.ts b/packages/openapi-ts/src/generate/services.ts index c1c7fa758..80bbac70d 100644 --- a/packages/openapi-ts/src/generate/services.ts +++ b/packages/openapi-ts/src/generate/services.ts @@ -284,7 +284,11 @@ const toRequestOptions = ( (parameter) => parameter.in === 'body' || parameter.in === 'formData', ); const contents = bodyParameters - .map((parameter) => parameter.mediaType) + .map( + (parameter) => + parameter.mediaType || + (parameter.in === 'formData' ? 'multipart/form-data' : undefined), + ) .filter(Boolean) .filter(unique); if (contents.length === 1) { diff --git a/packages/openapi-ts/src/generate/types.ts b/packages/openapi-ts/src/generate/types.ts index 864a82c02..4b0f84b4e 100644 --- a/packages/openapi-ts/src/generate/types.ts +++ b/packages/openapi-ts/src/generate/types.ts @@ -335,23 +335,44 @@ const processServiceTypes = ({ } if (operation.parameters.length > 0) { - let bodyParameter = operation.parameters.find( - (parameter) => parameter.in === 'body', - ); - if (!bodyParameter) { - bodyParameter = operation.parameters.find( - (parameter) => parameter.in === 'formData', - ); - } - const bodyParameters: OperationParameter = { + let bodyParameters: OperationParameter = { mediaType: null, ...emptyModel, - ...bodyParameter, in: 'body', - isRequired: bodyParameter ? bodyParameter.isRequired : false, name: 'body', prop: 'body', }; + let bodyParameter = operation.parameters.filter( + (parameter) => parameter.in === 'body', + ); + if (!bodyParameter.length) { + bodyParameter = operation.parameters.filter( + (parameter) => parameter.in === 'formData', + ); + } + + if (bodyParameter.length === 1) { + bodyParameters = { + ...emptyModel, + ...bodyParameter[0], + in: 'body', + isRequired: bodyParameter[0].isRequired, + name: 'body', + prop: 'body', + }; + // assume we have multiple formData parameters from Swagger 2.0 + } else if (bodyParameter.length > 1) { + bodyParameters = { + ...emptyModel, + in: 'body', + isRequired: bodyParameter.some((parameter) => parameter.isRequired), + mediaType: 'multipart/form-data', + name: 'body', + prop: 'body', + properties: bodyParameter, + }; + } + const headerParameters: OperationParameter = { ...emptyModel, in: 'header', diff --git a/packages/openapi-ts/src/index.ts b/packages/openapi-ts/src/index.ts index f1c33ddd6..b074e6343 100644 --- a/packages/openapi-ts/src/index.ts +++ b/packages/openapi-ts/src/index.ts @@ -426,5 +426,6 @@ export default { defineConfig, }; -export type { OpenApiV3_1 } from './openApi/3.1/types/spec'; +export type { OpenApiV3_0_3 } from './openApi/3.0.3'; +export type { OpenApiV3_1 } from './openApi/3.1'; export type { UserConfig } from './types/config'; diff --git a/packages/openapi-ts/src/openApi/3.0.3/index.ts b/packages/openapi-ts/src/openApi/3.0.3/index.ts new file mode 100644 index 000000000..7b24221c9 --- /dev/null +++ b/packages/openapi-ts/src/openApi/3.0.3/index.ts @@ -0,0 +1,2 @@ +export { parseV3_0_3 } from './parser'; +export type { OpenApiV3_0_3 } from './types/spec'; diff --git a/packages/openapi-ts/src/openApi/3.0.3/parser/index.ts b/packages/openapi-ts/src/openApi/3.0.3/parser/index.ts new file mode 100644 index 000000000..873231950 --- /dev/null +++ b/packages/openapi-ts/src/openApi/3.0.3/parser/index.ts @@ -0,0 +1,6 @@ +import type { OpenApiV3_0_3 } from '../types/spec'; + +export const parseV3_0_3 = (spec: OpenApiV3_0_3) => { + // TODO + console.log(spec); +}; diff --git a/packages/openapi-ts/src/openApi/3.0.3/types/spec.ts b/packages/openapi-ts/src/openApi/3.0.3/types/spec.ts new file mode 100644 index 000000000..d5545adcf --- /dev/null +++ b/packages/openapi-ts/src/openApi/3.0.3/types/spec.ts @@ -0,0 +1,7 @@ +export interface OpenApiV3_0_3 { + /** + * **REQUIRED**. This string MUST be the {@link https://semver.org/spec/v2.0.0.html semantic version number} of the {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#versions OpenAPI Specification version} that the OpenAPI document uses. The `openapi` field SHOULD be used by tooling specifications and clients to interpret the OpenAPI document. This is _not_ related to the API {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#infoVersion `info.version`} string. + */ + openapi: '3.0.3'; + // TODO +} diff --git a/packages/openapi-ts/src/openApi/3.1/types/spec.ts b/packages/openapi-ts/src/openApi/3.1/types/spec.ts index 65ea81395..322224bb8 100644 --- a/packages/openapi-ts/src/openApi/3.1/types/spec.ts +++ b/packages/openapi-ts/src/openApi/3.1/types/spec.ts @@ -21,7 +21,7 @@ export interface OpenApiV3_1 { */ jsonSchemaDialect?: string; /** - * **REQUIRED**. This string MUST be the {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#versions version number} of the OpenAPI Specification that the OpenAPI document uses. The `openapi` field SHOULD be used by tooling to interpret the OpenAPI document. This is _not_ related to the API {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#infoVersion info.version} string. + * **REQUIRED**. This string MUST be the {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#versions version number} of the OpenAPI Specification that the OpenAPI document uses. The `openapi` field SHOULD be used by tooling to interpret the OpenAPI document. This is _not_ related to the API {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#infoVersion `info.version`} string. */ openapi: '3.1.0'; /** diff --git a/packages/openapi-ts/src/openApi/index.ts b/packages/openapi-ts/src/openApi/index.ts index 44eea94fd..d97cee768 100644 --- a/packages/openapi-ts/src/openApi/index.ts +++ b/packages/openapi-ts/src/openApi/index.ts @@ -1,3 +1,4 @@ +import { type OpenApiV3_0_3, parseV3_0_3 } from './3.0.3'; import { type OpenApiV3_1, parseV3_1 } from './3.1'; import type { Client } from './common/interfaces/client'; import type { Config } from './common/interfaces/config'; @@ -56,9 +57,11 @@ export function parse({ } export const parseExperimental = ({ spec }: { spec: unknown }) => { - const s = spec as OpenApiV3_1; + const s = spec as OpenApiV3_0_3 | OpenApiV3_1; switch (s.openapi) { + case '3.0.3': + return parseV3_0_3(s); case '3.1.0': return parseV3_1(s); default: diff --git a/packages/openapi-ts/src/plugins/@hey-api/schemas/types.ts b/packages/openapi-ts/src/plugins/@hey-api/schemas/types.ts index 22dbf0916..1837a7f0f 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/schemas/types.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/schemas/types.ts @@ -12,4 +12,4 @@ export interface PluginConfig extends PluginDefinition { output?: string; } -export interface UserConfig extends Pick {} +export interface UserConfig extends Pick {} diff --git a/packages/openapi-ts/src/plugins/@hey-api/services/types.ts b/packages/openapi-ts/src/plugins/@hey-api/services/types.ts index c186ffb92..977414f66 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/services/types.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/services/types.ts @@ -12,4 +12,4 @@ export interface PluginConfig extends PluginDefinition { output?: string; } -export interface UserConfig extends Pick {} +export interface UserConfig extends Pick {} diff --git a/packages/openapi-ts/src/plugins/@hey-api/types/types.ts b/packages/openapi-ts/src/plugins/@hey-api/types/types.ts index 90f6cd91a..1290e7ea8 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/types/types.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/types/types.ts @@ -12,4 +12,4 @@ export interface PluginConfig extends PluginDefinition { output?: string; } -export interface UserConfig extends Pick {} +export interface UserConfig extends Pick {} diff --git a/packages/openapi-ts/src/plugins/@tanstack/react-query/types.ts b/packages/openapi-ts/src/plugins/@tanstack/react-query/types.ts index 7764dbfa4..6482456d5 100644 --- a/packages/openapi-ts/src/plugins/@tanstack/react-query/types.ts +++ b/packages/openapi-ts/src/plugins/@tanstack/react-query/types.ts @@ -31,5 +31,5 @@ export interface PluginConfig extends PluginDefinition { export interface UserConfig extends Pick< PluginConfig, - 'infiniteQueryOptions' | 'mutationOptions' | 'output' | 'queryOptions' + 'infiniteQueryOptions' | 'mutationOptions' | 'name' | 'queryOptions' > {} diff --git a/packages/openapi-ts/src/plugins/@tanstack/solid-query/types.ts b/packages/openapi-ts/src/plugins/@tanstack/solid-query/types.ts index 6c06db797..111e95266 100644 --- a/packages/openapi-ts/src/plugins/@tanstack/solid-query/types.ts +++ b/packages/openapi-ts/src/plugins/@tanstack/solid-query/types.ts @@ -31,5 +31,5 @@ export interface PluginConfig extends PluginDefinition { export interface UserConfig extends Pick< PluginConfig, - 'infiniteQueryOptions' | 'mutationOptions' | 'output' | 'queryOptions' + 'infiniteQueryOptions' | 'mutationOptions' | 'name' | 'queryOptions' > {} diff --git a/packages/openapi-ts/src/plugins/@tanstack/svelte-query/types.ts b/packages/openapi-ts/src/plugins/@tanstack/svelte-query/types.ts index 244e03688..6792c663d 100644 --- a/packages/openapi-ts/src/plugins/@tanstack/svelte-query/types.ts +++ b/packages/openapi-ts/src/plugins/@tanstack/svelte-query/types.ts @@ -31,5 +31,5 @@ export interface PluginConfig extends PluginDefinition { export interface UserConfig extends Pick< PluginConfig, - 'infiniteQueryOptions' | 'mutationOptions' | 'output' | 'queryOptions' + 'infiniteQueryOptions' | 'mutationOptions' | 'name' | 'queryOptions' > {} diff --git a/packages/openapi-ts/src/plugins/@tanstack/vue-query/types.ts b/packages/openapi-ts/src/plugins/@tanstack/vue-query/types.ts index 858ba2869..70441c31c 100644 --- a/packages/openapi-ts/src/plugins/@tanstack/vue-query/types.ts +++ b/packages/openapi-ts/src/plugins/@tanstack/vue-query/types.ts @@ -31,5 +31,5 @@ export interface PluginConfig extends PluginDefinition { export interface UserConfig extends Pick< PluginConfig, - 'infiniteQueryOptions' | 'mutationOptions' | 'output' | 'queryOptions' + 'infiniteQueryOptions' | 'mutationOptions' | 'name' | 'queryOptions' > {} diff --git a/packages/openapi-ts/src/plugins/index.ts b/packages/openapi-ts/src/plugins/index.ts index e2612ff8c..48c6834a7 100644 --- a/packages/openapi-ts/src/plugins/index.ts +++ b/packages/openapi-ts/src/plugins/index.ts @@ -1,43 +1,56 @@ import { defaultConfig as heyApiSchemasDefaultConfig, - type PluginConfig as HeyApiSchemas, + type PluginConfig as PluginHeyApiSchemas, } from './@hey-api/schemas'; import { defaultConfig as heyApiServicesDefaultConfig, - type PluginConfig as HeyApiServices, + type PluginConfig as PluginHeyApiServices, } from './@hey-api/services'; import { defaultConfig as heyApiTypesDefaultConfig, - type PluginConfig as HeyApiTypes, + type PluginConfig as PluginHeyApiTypes, } from './@hey-api/types'; import { defaultConfig as tanStackReactQueryDefaultConfig, - type PluginConfig as TanStackReactQuery, + type PluginConfig as PluginTanStackReactQuery, + type UserConfig as TanStackReactQuery, } from './@tanstack/react-query'; import { defaultConfig as tanStackSolidQueryDefaultConfig, - type PluginConfig as TanStackSolidQuery, + type PluginConfig as PluginTanStackSolidQuery, + type UserConfig as TanStackSolidQuery, } from './@tanstack/solid-query'; import { defaultConfig as tanStackSvelteQueryDefaultConfig, - type PluginConfig as TanStackSvelteQuery, + type PluginConfig as PluginTanStackSvelteQuery, + type UserConfig as TanStackSvelteQuery, } from './@tanstack/svelte-query'; import { defaultConfig as tanStackVueQueryDefaultConfig, - type PluginConfig as TanStackVueQuery, + type PluginConfig as PluginTanStackVueQuery, + type UserConfig as TanStackVueQuery, } from './@tanstack/vue-query'; import type { DefaultPluginConfigsMap } from './types'; -export type Plugins = - | HeyApiSchemas - | HeyApiServices - | HeyApiTypes +/** + * User-facing plugin types. + */ +export type UserPlugins = | TanStackReactQuery | TanStackSolidQuery | TanStackSvelteQuery | TanStackVueQuery; -export const defaultPluginConfigs: DefaultPluginConfigsMap = { +export type ClientPlugins = + | PluginHeyApiSchemas + | PluginHeyApiServices + | PluginHeyApiTypes + | PluginTanStackReactQuery + | PluginTanStackSolidQuery + | PluginTanStackSvelteQuery + | PluginTanStackVueQuery; + +export const defaultPluginConfigs: DefaultPluginConfigsMap = { '@hey-api/schemas': heyApiSchemasDefaultConfig, '@hey-api/services': heyApiServicesDefaultConfig, '@hey-api/types': heyApiTypesDefaultConfig, diff --git a/packages/openapi-ts/src/types/config.ts b/packages/openapi-ts/src/types/config.ts index 07c1fc0e4..ba4e4b2d0 100644 --- a/packages/openapi-ts/src/types/config.ts +++ b/packages/openapi-ts/src/types/config.ts @@ -1,5 +1,5 @@ import type { OpenApiV2Schema, OpenApiV3Schema } from '../openApi'; -import type { Plugins } from '../plugins/'; +import type { ClientPlugins, UserPlugins } from '../plugins/'; import type { Operation } from '../types/client'; import type { ExtractArrayOfObjects } from './utils'; @@ -101,7 +101,7 @@ export interface ClientConfig { /** * Plugins are used to generate additional output files from provided input. */ - plugins?: ReadonlyArray; + plugins?: ReadonlyArray; /** * Path to custom request file * @deprecated @@ -262,7 +262,7 @@ export type Config = Omit< client: Extract['client'], object>; output: Extract['output'], object>; plugins: ExtractArrayOfObjects< - Required['plugins'], + ReadonlyArray, { name: string } >; schemas: Extract['schemas'], object>; diff --git a/packages/openapi-ts/test/2.0.spec.ts b/packages/openapi-ts/test/2.0.spec.ts new file mode 100644 index 000000000..2b418ef23 --- /dev/null +++ b/packages/openapi-ts/test/2.0.spec.ts @@ -0,0 +1,64 @@ +import { readFileSync } from 'node:fs'; +import path from 'node:path'; +import { fileURLToPath } from 'node:url'; + +import { describe, expect, it } from 'vitest'; + +import { createClient } from '../'; +import type { UserConfig } from '../src/types/config'; +import { getFilePaths } from './utils'; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); + +const VERSION = '2.0'; + +describe(`OpenAPI ${VERSION}`, () => { + const createConfig = (userConfig: UserConfig): UserConfig => ({ + client: '@hey-api/client-fetch', + schemas: false, + ...userConfig, + input: path.join( + __dirname, + 'spec', + VERSION, + typeof userConfig.input === 'string' ? userConfig.input : '', + ), + output: path.join( + __dirname, + 'generated', + VERSION, + typeof userConfig.output === 'string' ? userConfig.output : '', + ), + }); + + const scenarios = [ + { + config: createConfig({ + input: 'form-data.json', + output: 'form-data', + }), + description: 'handles form data', + }, + ]; + + it.each(scenarios)('$description', async ({ config }) => { + // @ts-ignore + await createClient(config); + + const outputPath = typeof config.output === 'string' ? config.output : ''; + const filePaths = getFilePaths(outputPath); + + filePaths.forEach((filePath) => { + const fileContent = readFileSync(filePath, 'utf-8'); + expect(fileContent).toMatchFileSnapshot( + path.join( + __dirname, + '__snapshots__', + VERSION, + filePath.slice(outputPath.length + 1), + ), + ); + }); + }); +}); diff --git a/packages/openapi-ts/test/3.1.0.spec.ts b/packages/openapi-ts/test/3.1.0.spec.ts index da6df707b..159f09ccc 100644 --- a/packages/openapi-ts/test/3.1.0.spec.ts +++ b/packages/openapi-ts/test/3.1.0.spec.ts @@ -11,7 +11,9 @@ import { getFilePaths } from './utils'; const __filename = fileURLToPath(import.meta.url); const __dirname = path.dirname(__filename); -describe('OpenAPI 3.1.0', () => { +const VERSION = '3.1.0'; + +describe(`OpenAPI ${VERSION}`, () => { const createConfig = (userConfig: UserConfig): UserConfig => ({ client: '@hey-api/client-fetch', schemas: false, @@ -19,13 +21,13 @@ describe('OpenAPI 3.1.0', () => { input: path.join( __dirname, 'spec', - '3.1.0', + VERSION, typeof userConfig.input === 'string' ? userConfig.input : '', ), output: path.join( __dirname, 'generated', - '3.1.0', + VERSION, typeof userConfig.output === 'string' ? userConfig.output : '', ), }); @@ -56,7 +58,7 @@ describe('OpenAPI 3.1.0', () => { path.join( __dirname, '__snapshots__', - '3.1.0', + VERSION, filePath.slice(outputPath.length + 1), ), ); diff --git a/packages/openapi-ts/test/__snapshots__/2.0/index.ts b/packages/openapi-ts/test/__snapshots__/2.0/index.ts new file mode 100644 index 000000000..e11f63ca0 --- /dev/null +++ b/packages/openapi-ts/test/__snapshots__/2.0/index.ts @@ -0,0 +1,3 @@ +// This file is auto-generated by @hey-api/openapi-ts +export * from './services.gen'; +export * from './types.gen'; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/2.0/services.gen.ts b/packages/openapi-ts/test/__snapshots__/2.0/services.gen.ts new file mode 100644 index 000000000..0b85b40e2 --- /dev/null +++ b/packages/openapi-ts/test/__snapshots__/2.0/services.gen.ts @@ -0,0 +1,16 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { createClient, createConfig, type Options, formDataBodySerializer } from '@hey-api/client-fetch'; +import type { PostV1FooData, PostV1FooError, PostV1FooResponse } from './types.gen'; + +export const client = createClient(createConfig()); + +export const postV1Foo = (options: Options) => { return (options?.client ?? client).post({ + ...options, + ...formDataBodySerializer, + headers: { + 'Content-Type': null, + ...options?.headers + }, + url: '/v1/foo' +}); }; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/2.0/types.gen.ts b/packages/openapi-ts/test/__snapshots__/2.0/types.gen.ts new file mode 100644 index 000000000..bfd9b326c --- /dev/null +++ b/packages/openapi-ts/test/__snapshots__/2.0/types.gen.ts @@ -0,0 +1,16 @@ +// This file is auto-generated by @hey-api/openapi-ts + +export type Foo = { + status?: number; +}; + +export type PostV1FooData = { + body: { + file: (Blob | File); + info: string; + }; +}; + +export type PostV1FooResponse = (Foo); + +export type PostV1FooError = unknown; \ No newline at end of file diff --git a/packages/openapi-ts/test/sample.cjs b/packages/openapi-ts/test/sample.cjs index 193206995..e63cd25d0 100644 --- a/packages/openapi-ts/test/sample.cjs +++ b/packages/openapi-ts/test/sample.cjs @@ -11,29 +11,29 @@ const main = async () => { // debug: true, // experimental_parser: true, // input: './test/spec/v3-transforms.json', - input: './test/spec/v3.json', - // input: './test/spec/3.1.0/duplicate-null.json', + // input: './test/spec/v3.json', + input: './test/spec/2.0/form-data.json', // input: './test/spec/v2.json', // input: 'https://mongodb-mms-prod-build-server.s3.amazonaws.com/openapi/2caffd88277a4e27c95dcefc7e3b6a63a3b03297-v2-2023-11-15.json', // name: 'foo', output: { path: './test/generated/sample/', }, - plugins: [ - { - // infiniteQueryOptions: false, - // mutationOptions: false, - name: '@tanstack/react-query', - // queryOptions: false, - }, - // '@hey-api/services', - ], + // plugins: [ + // { + // // infiniteQueryOptions: false, + // // mutationOptions: false, + // name: '@tanstack/react-query', + // // queryOptions: false, + // }, + // // '@hey-api/services', + // ], schemas: { export: false, }, services: { // export: false, - asClass: true, + // asClass: true, // filter: '^GET /api/v{api-version}/simple:operation$', // export: false, // name: '^Parameters', diff --git a/packages/openapi-ts/test/spec/2.0/form-data.json b/packages/openapi-ts/test/spec/2.0/form-data.json new file mode 100644 index 000000000..639e215bf --- /dev/null +++ b/packages/openapi-ts/test/spec/2.0/form-data.json @@ -0,0 +1,51 @@ +{ + "basePath": "/", + "host": "foo.bar.com", + "info": { + "description": "", + "title": "", + "version": "v1" + }, + "schemes": ["https"], + "swagger": "2.0", + "tags": [], + "paths": { + "/v1/foo": { + "post": { + "consumes": ["multipart/form-data"], + "parameters": [ + { + "in": "formData", + "name": "file", + "required": true, + "type": "file" + }, + { + "in": "formData", + "name": "info", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "", + "schema": { + "$ref": "#/definitions/Foo" + } + } + } + } + } + }, + "definitions": { + "Foo": { + "type": "object", + "properties": { + "status": { + "type": "integer" + } + } + } + } +} -- 2.51.2 From cd08c5a250401bb0c3b1735e14905f6d994e748b Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 30 Sep 2024 11:49:32 +0000 Subject: [PATCH 40/49] Version Packages --- .changeset/dry-laws-smash.md | 5 ----- .changeset/neat-windows-build.md | 5 ----- packages/openapi-ts/CHANGELOG.md | 8 ++++++++ packages/openapi-ts/package.json | 2 +- 4 files changed, 9 insertions(+), 11 deletions(-) delete mode 100644 .changeset/dry-laws-smash.md delete mode 100644 .changeset/neat-windows-build.md diff --git a/.changeset/dry-laws-smash.md b/.changeset/dry-laws-smash.md deleted file mode 100644 index 6919d6538..000000000 --- a/.changeset/dry-laws-smash.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@hey-api/openapi-ts': patch ---- - -fix: export spec-compliant OpenAPI 3.1 interface diff --git a/.changeset/neat-windows-build.md b/.changeset/neat-windows-build.md deleted file mode 100644 index 3ed9454ce..000000000 --- a/.changeset/neat-windows-build.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@hey-api/openapi-ts': patch ---- - -fix: handle multiple form-data parameters in Swagger 2.0 diff --git a/packages/openapi-ts/CHANGELOG.md b/packages/openapi-ts/CHANGELOG.md index 1f032a789..58c7dbfae 100644 --- a/packages/openapi-ts/CHANGELOG.md +++ b/packages/openapi-ts/CHANGELOG.md @@ -1,5 +1,13 @@ # @hey-api/openapi-ts +## 0.53.6 + +### Patch Changes + +- [#1104](https://github.com/hey-api/openapi-ts/pull/1104) [`a1eada1`](https://github.com/hey-api/openapi-ts/commit/a1eada1896046f0de1710682635efc59434a1e2c) Thanks [@mrlubos](https://github.com/mrlubos)! - fix: export spec-compliant OpenAPI 3.1 interface + +- [#1108](https://github.com/hey-api/openapi-ts/pull/1108) [`7677924`](https://github.com/hey-api/openapi-ts/commit/76779246534391deca5a371df2c7dc76e9d2eb73) Thanks [@mrlubos](https://github.com/mrlubos)! - fix: handle multiple form-data parameters in Swagger 2.0 + ## 0.53.5 ### Patch Changes diff --git a/packages/openapi-ts/package.json b/packages/openapi-ts/package.json index 86bd8c4d0..80552d9a7 100644 --- a/packages/openapi-ts/package.json +++ b/packages/openapi-ts/package.json @@ -1,6 +1,6 @@ { "name": "@hey-api/openapi-ts", - "version": "0.53.5", + "version": "0.53.6", "description": "Turn your OpenAPI specification into a beautiful TypeScript client", "homepage": "https://heyapi.vercel.app/", "repository": { -- 2.51.2 From dc696e0b4500dba5ceb4c772110b123bd2f71b40 Mon Sep 17 00:00:00 2001 From: Lubos Date: Thu, 3 Oct 2024 16:05:03 +0800 Subject: [PATCH 41/49] fix: do not handle nested properties in oneOf and anyOf compositions --- .changeset/gorgeous-mayflies-joke.md | 5 +++++ .../openapi-ts/src/openApi/v2/parser/getModelComposition.ts | 2 +- .../openapi-ts/src/openApi/v3/parser/getModelComposition.ts | 3 ++- .../v3/parser/getRequiredPropertiesFromComposition.ts | 5 +++++ 4 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 .changeset/gorgeous-mayflies-joke.md diff --git a/.changeset/gorgeous-mayflies-joke.md b/.changeset/gorgeous-mayflies-joke.md new file mode 100644 index 000000000..07d153ed6 --- /dev/null +++ b/.changeset/gorgeous-mayflies-joke.md @@ -0,0 +1,5 @@ +--- +'@hey-api/openapi-ts': patch +--- + +fix: skip nested properties in oneOf and anyOf compositions diff --git a/packages/openapi-ts/src/openApi/v2/parser/getModelComposition.ts b/packages/openapi-ts/src/openApi/v2/parser/getModelComposition.ts index a1b246a26..c130c8766 100644 --- a/packages/openapi-ts/src/openApi/v2/parser/getModelComposition.ts +++ b/packages/openapi-ts/src/openApi/v2/parser/getModelComposition.ts @@ -46,7 +46,7 @@ export const getModelComposition = ({ composition.properties.push(model); }); - if (definition.required) { + if (definition.required && type === 'all-of') { const requiredProperties = getRequiredPropertiesFromComposition({ definitions, getModel, diff --git a/packages/openapi-ts/src/openApi/v3/parser/getModelComposition.ts b/packages/openapi-ts/src/openApi/v3/parser/getModelComposition.ts index efc0bafac..583eca71e 100644 --- a/packages/openapi-ts/src/openApi/v3/parser/getModelComposition.ts +++ b/packages/openapi-ts/src/openApi/v3/parser/getModelComposition.ts @@ -81,8 +81,9 @@ export const getModelComposition = ({ composition.properties = [...composition.properties, model]; }); - if (definition.required) { + if (definition.required && type === 'all-of') { const requiredProperties = getRequiredPropertiesFromComposition({ + debug, definitions, getModel, openApi, diff --git a/packages/openapi-ts/src/openApi/v3/parser/getRequiredPropertiesFromComposition.ts b/packages/openapi-ts/src/openApi/v3/parser/getRequiredPropertiesFromComposition.ts index 8fdfa308b..187e0f92a 100644 --- a/packages/openapi-ts/src/openApi/v3/parser/getRequiredPropertiesFromComposition.ts +++ b/packages/openapi-ts/src/openApi/v3/parser/getRequiredPropertiesFromComposition.ts @@ -7,12 +7,14 @@ import type { OpenApi } from '../interfaces/OpenApi'; import type { OpenApiSchema } from '../interfaces/OpenApiSchema'; export const getRequiredPropertiesFromComposition = ({ + debug, definitions, getModel, openApi, required, types, }: { + debug?: boolean; definitions: OpenApiSchema[]; getModel: GetModelFn; openApi: OpenApi; @@ -38,6 +40,7 @@ export const getRequiredPropertiesFromComposition = ({ return [ ...properties, ...getModel({ + debug, definition: schema, meta, openApi, @@ -49,6 +52,7 @@ export const getRequiredPropertiesFromComposition = ({ return [ ...properties, ...getModel({ + debug, definition, openApi, parentDefinition: definition, @@ -63,5 +67,6 @@ export const getRequiredPropertiesFromComposition = ({ ...property, isRequired: true, })); + return requiredProperties; }; -- 2.51.2 From 5f077dd8d144bbfe71d8775bad5fe7ddda2315d6 Mon Sep 17 00:00:00 2001 From: Lubos Date: Thu, 3 Oct 2024 19:04:54 +0800 Subject: [PATCH 42/49] fix: abstract page params logic in TanStack Query plugin --- .changeset/metal-mayflies-rest.md | 5 + packages/openapi-ts/src/compiler/return.ts | 15 +- .../openapi-ts/src/generate/transformers.ts | 2 +- .../plugins/@tanstack/query-core/plugin.ts | 339 ++++++++++-------- packages/openapi-ts/test/3.1.0.spec.ts | 41 +++ .../test/__snapshots__/3.1.0/types.gen.ts | 14 +- .../asClass/@tanstack/react-query.gen.ts | 110 ++---- .../axios/@tanstack/react-query.gen.ts | 110 ++---- .../fetch/@tanstack/react-query.gen.ts | 110 ++---- .../asClass/@tanstack/solid-query.gen.ts | 110 ++---- .../axios/@tanstack/solid-query.gen.ts | 110 ++---- .../fetch/@tanstack/solid-query.gen.ts | 110 ++---- .../asClass/@tanstack/svelte-query.gen.ts | 110 ++---- .../axios/@tanstack/svelte-query.gen.ts | 110 ++---- .../fetch/@tanstack/svelte-query.gen.ts | 110 ++---- .../asClass/@tanstack/vue-query.gen.ts | 110 ++---- .../axios/@tanstack/vue-query.gen.ts | 110 ++---- .../fetch/@tanstack/vue-query.gen.ts | 110 ++---- packages/openapi-ts/test/sample.cjs | 2 +- .../test/spec/3.1.0/required-all-of-ref.json | 35 ++ .../test/spec/3.1.0/required-any-of-ref.json | 35 ++ .../test/spec/3.1.0/required-one-of-ref.json | 35 ++ 22 files changed, 755 insertions(+), 1088 deletions(-) create mode 100644 .changeset/metal-mayflies-rest.md create mode 100644 packages/openapi-ts/test/spec/3.1.0/required-all-of-ref.json create mode 100644 packages/openapi-ts/test/spec/3.1.0/required-any-of-ref.json create mode 100644 packages/openapi-ts/test/spec/3.1.0/required-one-of-ref.json diff --git a/.changeset/metal-mayflies-rest.md b/.changeset/metal-mayflies-rest.md new file mode 100644 index 000000000..f41a6c33b --- /dev/null +++ b/.changeset/metal-mayflies-rest.md @@ -0,0 +1,5 @@ +--- +'@hey-api/openapi-ts': patch +--- + +fix: abstract page params logic in TanStack Query plugin diff --git a/packages/openapi-ts/src/compiler/return.ts b/packages/openapi-ts/src/compiler/return.ts index a9d82c1c6..a51a91944 100644 --- a/packages/openapi-ts/src/compiler/return.ts +++ b/packages/openapi-ts/src/compiler/return.ts @@ -44,7 +44,16 @@ export const createReturnFunctionCall = ({ return statement; }; -export const createReturnVariable = ({ name }: { name: string }) => - createReturnStatement({ - expression: createIdentifier({ text: name }), +export const createReturnVariable = ({ + expression, +}: { + expression: string | ts.Expression; +}) => { + const statement = createReturnStatement({ + expression: + typeof expression === 'string' + ? createIdentifier({ text: expression }) + : expression, }); + return statement; +}; diff --git a/packages/openapi-ts/src/generate/transformers.ts b/packages/openapi-ts/src/generate/transformers.ts index 805a207ec..c5cd1a090 100644 --- a/packages/openapi-ts/src/generate/transformers.ts +++ b/packages/openapi-ts/src/generate/transformers.ts @@ -225,7 +225,7 @@ const generateResponseTransformer = ({ statements: [ ...statements, compiler.returnVariable({ - name: dataVariableName, + expression: dataVariableName, }), ], }); diff --git a/packages/openapi-ts/src/plugins/@tanstack/query-core/plugin.ts b/packages/openapi-ts/src/plugins/@tanstack/query-core/plugin.ts index d677d0d62..ff0c24e40 100644 --- a/packages/openapi-ts/src/plugins/@tanstack/query-core/plugin.ts +++ b/packages/openapi-ts/src/plugins/@tanstack/query-core/plugin.ts @@ -62,6 +62,7 @@ const getPaginationIn = (parameter: OperationParameter) => { const paginationWordsRegExp = /^(cursor|offset|page|start)/; +const createInfiniteParamsFn = 'createInfiniteParams'; const createQueryKeyFn = 'createQueryKey'; const infiniteQueryOptionsFn = 'infiniteQueryOptions'; const mutationOptionsFn = 'mutationOptions'; @@ -74,6 +75,189 @@ const getClientBaseUrlKey = () => { return config.client.name === '@hey-api/client-axios' ? 'baseURL' : 'baseUrl'; }; +const createInfiniteParamsFunction = ({ + file, +}: { + file: Files[keyof Files]; +}) => { + const fn = compiler.constVariable({ + expression: compiler.arrowFunction({ + multiLine: true, + parameters: [ + { + name: 'queryKey', + type: compiler.typeNode('QueryKey'), + }, + { + name: 'page', + type: compiler.typeNode('K'), + }, + ], + statements: [ + compiler.constVariable({ + expression: compiler.identifier({ + text: 'queryKey[0]', + }), + name: 'params', + }), + compiler.ifStatement({ + expression: compiler.propertyAccessExpression({ + expression: compiler.identifier({ + text: 'page', + }), + name: compiler.identifier({ text: 'body' }), + }), + thenStatement: ts.factory.createBlock( + [ + compiler.expressionToStatement({ + expression: compiler.binaryExpression({ + left: compiler.propertyAccessExpression({ + expression: 'params', + name: 'body', + }), + right: compiler.objectExpression({ + multiLine: true, + obj: [ + { + assertion: 'any', + spread: 'queryKey[0].body', + }, + { + assertion: 'any', + spread: 'page.body', + }, + ], + }), + }), + }), + ], + true, + ), + }), + compiler.ifStatement({ + expression: compiler.propertyAccessExpression({ + expression: compiler.identifier({ + text: 'page', + }), + name: compiler.identifier({ text: 'headers' }), + }), + thenStatement: ts.factory.createBlock( + [ + compiler.expressionToStatement({ + expression: compiler.binaryExpression({ + left: compiler.propertyAccessExpression({ + expression: 'params', + name: 'headers', + }), + right: compiler.objectExpression({ + multiLine: true, + obj: [ + { + spread: 'queryKey[0].headers', + }, + { + spread: 'page.headers', + }, + ], + }), + }), + }), + ], + true, + ), + }), + compiler.ifStatement({ + expression: compiler.propertyAccessExpression({ + expression: compiler.identifier({ + text: 'page', + }), + name: compiler.identifier({ text: 'path' }), + }), + thenStatement: ts.factory.createBlock( + [ + compiler.expressionToStatement({ + expression: compiler.binaryExpression({ + left: compiler.propertyAccessExpression({ + expression: 'params', + name: 'path', + }), + right: compiler.objectExpression({ + multiLine: true, + obj: [ + { + spread: 'queryKey[0].path', + }, + { + spread: 'page.path', + }, + ], + }), + }), + }), + ], + true, + ), + }), + compiler.ifStatement({ + expression: compiler.propertyAccessExpression({ + expression: compiler.identifier({ + text: 'page', + }), + name: compiler.identifier({ text: 'query' }), + }), + thenStatement: ts.factory.createBlock( + [ + compiler.expressionToStatement({ + expression: compiler.binaryExpression({ + left: compiler.propertyAccessExpression({ + expression: 'params', + name: 'query', + }), + right: compiler.objectExpression({ + multiLine: true, + obj: [ + { + spread: 'queryKey[0].query', + }, + { + spread: 'page.query', + }, + ], + }), + }), + }), + ], + true, + ), + }), + compiler.returnVariable({ + expression: ts.factory.createAsExpression( + ts.factory.createAsExpression( + compiler.identifier({ text: 'params' }), + ts.factory.createKeywordTypeNode(ts.SyntaxKind.UnknownKeyword), + ), + ts.factory.createTypeQueryNode( + compiler.identifier({ text: 'page' }), + ), + ), + }), + ], + types: [ + { + extends: compiler.typeReferenceNode({ + typeName: compiler.identifier({ + text: "Pick[0], 'body' | 'headers' | 'path' | 'query'>", + }), + }), + name: 'K', + }, + ], + }), + name: createInfiniteParamsFn, + }); + file.add(fn); +}; + const createQueryKeyFunction = ({ file }: { file: Files[keyof Files] }) => { const returnType = compiler.indexedAccessTypeNode({ indexType: compiler.typeNode(0), @@ -239,7 +423,7 @@ const createQueryKeyFunction = ({ file }: { file: Files[keyof Files] }) => { ), }), compiler.returnVariable({ - name: 'params', + expression: 'params', }), ], types: [ @@ -493,6 +677,7 @@ export const handler: PluginDefinition['handler'] = ({ : 'UseMutationOptions'; let typeInfiniteData!: ImportExportItem; + let hasCreateInfiniteParamsFunction = false; let hasCreateQueryKeyParamsFunction = false; let hasInfiniteQueries = false; let hasMutations = false; @@ -621,7 +806,7 @@ export const handler: PluginDefinition['handler'] = ({ name: 'data', }), compiler.returnVariable({ - name: 'data', + expression: 'data', }), ], }), @@ -704,6 +889,11 @@ export const handler: PluginDefinition['handler'] = ({ hasCreateQueryKeyParamsFunction = true; } + if (!hasCreateInfiniteParamsFunction) { + createInfiniteParamsFunction({ file }); + hasCreateInfiniteParamsFunction = true; + } + file.import({ module: plugin.name, name: infiniteQueryOptionsFn, @@ -845,141 +1035,11 @@ export const handler: PluginDefinition['handler'] = ({ typeName: typePageObjectParam, }), compiler.constVariable({ - expression: compiler.objectExpression({ - obj: [], + expression: compiler.callExpression({ + functionName: 'createInfiniteParams', + parameters: ['queryKey', 'page'], }), name: 'params', - typeName: `Partial<${typeData}>`, - }), - compiler.ifStatement({ - expression: compiler.propertyAccessExpression({ - expression: compiler.identifier({ - text: 'page', - }), - name: compiler.identifier({ text: 'body' }), - }), - thenStatement: ts.factory.createBlock( - [ - compiler.expressionToStatement({ - expression: compiler.binaryExpression({ - left: compiler.propertyAccessExpression({ - expression: 'params', - name: 'body', - }), - right: compiler.objectExpression({ - multiLine: true, - obj: [ - { - assertion: 'any', - spread: 'queryKey[0].body', - }, - { - assertion: 'any', - spread: 'page.body', - }, - ], - }), - }), - }), - ], - true, - ), - }), - compiler.ifStatement({ - expression: compiler.propertyAccessExpression({ - expression: compiler.identifier({ - text: 'page', - }), - name: compiler.identifier({ text: 'headers' }), - }), - thenStatement: ts.factory.createBlock( - [ - compiler.expressionToStatement({ - expression: compiler.binaryExpression({ - left: compiler.propertyAccessExpression({ - expression: 'params', - name: 'headers', - }), - right: compiler.objectExpression({ - multiLine: true, - obj: [ - { - spread: 'queryKey[0].headers', - }, - { - spread: 'page.headers', - }, - ], - }), - }), - }), - ], - true, - ), - }), - compiler.ifStatement({ - expression: compiler.propertyAccessExpression({ - expression: compiler.identifier({ - text: 'page', - }), - name: compiler.identifier({ text: 'path' }), - }), - thenStatement: ts.factory.createBlock( - [ - compiler.expressionToStatement({ - expression: compiler.binaryExpression({ - left: compiler.propertyAccessExpression({ - expression: 'params', - name: 'path', - }), - right: compiler.objectExpression({ - multiLine: true, - obj: [ - { - spread: 'queryKey[0].path', - }, - { - spread: 'page.path', - }, - ], - }), - }), - }), - ], - true, - ), - }), - compiler.ifStatement({ - expression: compiler.propertyAccessExpression({ - expression: compiler.identifier({ - text: 'page', - }), - name: compiler.identifier({ text: 'query' }), - }), - thenStatement: ts.factory.createBlock( - [ - compiler.expressionToStatement({ - expression: compiler.binaryExpression({ - left: compiler.propertyAccessExpression({ - expression: 'params', - name: 'query', - }), - right: compiler.objectExpression({ - multiLine: true, - obj: [ - { - spread: 'queryKey[0].query', - }, - { - spread: 'page.query', - }, - ], - }), - }), - }), - ], - true, - ), }), compiler.constVariable({ destructure: true, @@ -993,9 +1053,6 @@ export const handler: PluginDefinition['handler'] = ({ { spread: 'options', }, - { - spread: 'queryKey[0]', - }, { spread: 'params', }, @@ -1011,7 +1068,7 @@ export const handler: PluginDefinition['handler'] = ({ name: 'data', }), compiler.returnVariable({ - name: 'data', + expression: 'data', }), ], }), @@ -1128,7 +1185,7 @@ export const handler: PluginDefinition['handler'] = ({ name: 'data', }), compiler.returnVariable({ - name: 'data', + expression: 'data', }), ], }), @@ -1140,7 +1197,7 @@ export const handler: PluginDefinition['handler'] = ({ typeName: `${mutationsType}<${typeResponse}, ${typeError.name}, ${typeData}>`, }), compiler.returnVariable({ - name: mutationOptionsFn, + expression: mutationOptionsFn, }), ], }); diff --git a/packages/openapi-ts/test/3.1.0.spec.ts b/packages/openapi-ts/test/3.1.0.spec.ts index 159f09ccc..fefc1beb0 100644 --- a/packages/openapi-ts/test/3.1.0.spec.ts +++ b/packages/openapi-ts/test/3.1.0.spec.ts @@ -43,6 +43,47 @@ describe(`OpenAPI ${VERSION}`, () => { }), description: 'does not generate duplicate null', }, + { + config: createConfig({ + input: 'required-all-of-ref.json', + output: 'required-all-of-ref', + services: { + export: false, + }, + types: { + tree: false, + }, + }), + description: 'sets allOf composition ref model properties as required', + }, + { + config: createConfig({ + input: 'required-any-of-ref.json', + output: 'required-any-of-ref', + services: { + export: false, + }, + types: { + tree: false, + }, + }), + description: + 'does not set anyOf composition ref model properties as required', + }, + { + config: createConfig({ + input: 'required-one-of-ref.json', + output: 'required-one-of-ref', + services: { + export: false, + }, + types: { + tree: false, + }, + }), + description: + 'does not set oneOf composition ref model properties as required', + }, ]; it.each(scenarios)('$description', async ({ config }) => { diff --git a/packages/openapi-ts/test/__snapshots__/3.1.0/types.gen.ts b/packages/openapi-ts/test/__snapshots__/3.1.0/types.gen.ts index d4f186e88..afdb67392 100644 --- a/packages/openapi-ts/test/__snapshots__/3.1.0/types.gen.ts +++ b/packages/openapi-ts/test/__snapshots__/3.1.0/types.gen.ts @@ -1,11 +1,13 @@ // This file is auto-generated by @hey-api/openapi-ts -export type PostTestData = { - /** - * should not produce duplicate null - */ - body?: { - weirdEnum?: ('' | (string) | null); +export type Foo = { + foo?: string; + baz?: string; +}; + +export type Bar = Foo | { + bar: number; +}; weirdEnum?: ('' | (string) | null); }; }; diff --git a/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/react-query/asClass/@tanstack/react-query.gen.ts b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/react-query/asClass/@tanstack/react-query.gen.ts index 9cac1815e..0eb58fabe 100644 --- a/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/react-query/asClass/@tanstack/react-query.gen.ts +++ b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/react-query/asClass/@tanstack/react-query.gen.ts @@ -560,6 +560,35 @@ export const callWithParametersOptions = (options: Options[0], 'body' | 'headers' | 'path' | 'query'>>(queryKey: QueryKey, page: K) => { + const params = queryKey[0]; + if (page.body) { + params.body = { + ...queryKey[0].body as any, + ...page.body as any + }; + } + if (page.headers) { + params.headers = { + ...queryKey[0].headers, + ...page.headers + }; + } + if (page.path) { + params.path = { + ...queryKey[0].path, + ...page.path + }; + } + if (page.query) { + params.query = { + ...queryKey[0].query, + ...page.query + }; + } + return params as unknown as typeof page; +}; + export const callWithParametersInfiniteQueryKey = (options: Options): QueryKey> => [ createQueryKey("callWithParameters", options, true) ]; @@ -574,34 +603,9 @@ export const callWithParametersInfiniteOptions = (options: Options> = {}; - if (page.body) { - params.body = { - ...queryKey[0].body as any, - ...page.body as any - }; - } - if (page.headers) { - params.headers = { - ...queryKey[0].headers, - ...page.headers - }; - } - if (page.path) { - params.path = { - ...queryKey[0].path, - ...page.path - }; - } - if (page.query) { - params.query = { - ...queryKey[0].query, - ...page.query - }; - } + const params = createInfiniteParams(queryKey, page); const { data } = await ParametersService.callWithParameters({ ...options, - ...queryKey[0], ...params, throwOnError: true }); @@ -676,34 +680,9 @@ export const getCallWithOptionalParamInfiniteOptions = (options: Options> = {}; - if (page.body) { - params.body = { - ...queryKey[0].body as any, - ...page.body as any - }; - } - if (page.headers) { - params.headers = { - ...queryKey[0].headers, - ...page.headers - }; - } - if (page.path) { - params.path = { - ...queryKey[0].path, - ...page.path - }; - } - if (page.query) { - params.query = { - ...queryKey[0].query, - ...page.query - }; - } + const params = createInfiniteParams(queryKey, page); const { data } = await ParametersService.getCallWithOptionalParam({ ...options, - ...queryKey[0], ...params, throwOnError: true }); @@ -742,34 +721,9 @@ export const postCallWithOptionalParamInfiniteOptions = (options: Options> = {}; - if (page.body) { - params.body = { - ...queryKey[0].body as any, - ...page.body as any - }; - } - if (page.headers) { - params.headers = { - ...queryKey[0].headers, - ...page.headers - }; - } - if (page.path) { - params.path = { - ...queryKey[0].path, - ...page.path - }; - } - if (page.query) { - params.query = { - ...queryKey[0].query, - ...page.query - }; - } + const params = createInfiniteParams(queryKey, page); const { data } = await ParametersService.postCallWithOptionalParam({ ...options, - ...queryKey[0], ...params, throwOnError: true }); diff --git a/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/react-query/axios/@tanstack/react-query.gen.ts b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/react-query/axios/@tanstack/react-query.gen.ts index e1b7e20e4..a33a8d62a 100644 --- a/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/react-query/axios/@tanstack/react-query.gen.ts +++ b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/react-query/axios/@tanstack/react-query.gen.ts @@ -257,6 +257,35 @@ export const callWithParametersOptions = (options: Options[0], 'body' | 'headers' | 'path' | 'query'>>(queryKey: QueryKey, page: K) => { + const params = queryKey[0]; + if (page.body) { + params.body = { + ...queryKey[0].body as any, + ...page.body as any + }; + } + if (page.headers) { + params.headers = { + ...queryKey[0].headers, + ...page.headers + }; + } + if (page.path) { + params.path = { + ...queryKey[0].path, + ...page.path + }; + } + if (page.query) { + params.query = { + ...queryKey[0].query, + ...page.query + }; + } + return params as unknown as typeof page; +}; + export const callWithParametersInfiniteQueryKey = (options: Options): QueryKey> => [ createQueryKey("callWithParameters", options, true) ]; @@ -271,34 +300,9 @@ export const callWithParametersInfiniteOptions = (options: Options> = {}; - if (page.body) { - params.body = { - ...queryKey[0].body as any, - ...page.body as any - }; - } - if (page.headers) { - params.headers = { - ...queryKey[0].headers, - ...page.headers - }; - } - if (page.path) { - params.path = { - ...queryKey[0].path, - ...page.path - }; - } - if (page.query) { - params.query = { - ...queryKey[0].query, - ...page.query - }; - } + const params = createInfiniteParams(queryKey, page); const { data } = await callWithParameters({ ...options, - ...queryKey[0], ...params, throwOnError: true }); @@ -373,34 +377,9 @@ export const getCallWithOptionalParamInfiniteOptions = (options: Options> = {}; - if (page.body) { - params.body = { - ...queryKey[0].body as any, - ...page.body as any - }; - } - if (page.headers) { - params.headers = { - ...queryKey[0].headers, - ...page.headers - }; - } - if (page.path) { - params.path = { - ...queryKey[0].path, - ...page.path - }; - } - if (page.query) { - params.query = { - ...queryKey[0].query, - ...page.query - }; - } + const params = createInfiniteParams(queryKey, page); const { data } = await getCallWithOptionalParam({ ...options, - ...queryKey[0], ...params, throwOnError: true }); @@ -439,34 +418,9 @@ export const postCallWithOptionalParamInfiniteOptions = (options: Options> = {}; - if (page.body) { - params.body = { - ...queryKey[0].body as any, - ...page.body as any - }; - } - if (page.headers) { - params.headers = { - ...queryKey[0].headers, - ...page.headers - }; - } - if (page.path) { - params.path = { - ...queryKey[0].path, - ...page.path - }; - } - if (page.query) { - params.query = { - ...queryKey[0].query, - ...page.query - }; - } + const params = createInfiniteParams(queryKey, page); const { data } = await postCallWithOptionalParam({ ...options, - ...queryKey[0], ...params, throwOnError: true }); diff --git a/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/react-query/fetch/@tanstack/react-query.gen.ts b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/react-query/fetch/@tanstack/react-query.gen.ts index 59703f688..52f35325d 100644 --- a/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/react-query/fetch/@tanstack/react-query.gen.ts +++ b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/react-query/fetch/@tanstack/react-query.gen.ts @@ -256,6 +256,35 @@ export const callWithParametersOptions = (options: Options[0], 'body' | 'headers' | 'path' | 'query'>>(queryKey: QueryKey, page: K) => { + const params = queryKey[0]; + if (page.body) { + params.body = { + ...queryKey[0].body as any, + ...page.body as any + }; + } + if (page.headers) { + params.headers = { + ...queryKey[0].headers, + ...page.headers + }; + } + if (page.path) { + params.path = { + ...queryKey[0].path, + ...page.path + }; + } + if (page.query) { + params.query = { + ...queryKey[0].query, + ...page.query + }; + } + return params as unknown as typeof page; +}; + export const callWithParametersInfiniteQueryKey = (options: Options): QueryKey> => [ createQueryKey("callWithParameters", options, true) ]; @@ -270,34 +299,9 @@ export const callWithParametersInfiniteOptions = (options: Options> = {}; - if (page.body) { - params.body = { - ...queryKey[0].body as any, - ...page.body as any - }; - } - if (page.headers) { - params.headers = { - ...queryKey[0].headers, - ...page.headers - }; - } - if (page.path) { - params.path = { - ...queryKey[0].path, - ...page.path - }; - } - if (page.query) { - params.query = { - ...queryKey[0].query, - ...page.query - }; - } + const params = createInfiniteParams(queryKey, page); const { data } = await callWithParameters({ ...options, - ...queryKey[0], ...params, throwOnError: true }); @@ -372,34 +376,9 @@ export const getCallWithOptionalParamInfiniteOptions = (options: Options> = {}; - if (page.body) { - params.body = { - ...queryKey[0].body as any, - ...page.body as any - }; - } - if (page.headers) { - params.headers = { - ...queryKey[0].headers, - ...page.headers - }; - } - if (page.path) { - params.path = { - ...queryKey[0].path, - ...page.path - }; - } - if (page.query) { - params.query = { - ...queryKey[0].query, - ...page.query - }; - } + const params = createInfiniteParams(queryKey, page); const { data } = await getCallWithOptionalParam({ ...options, - ...queryKey[0], ...params, throwOnError: true }); @@ -438,34 +417,9 @@ export const postCallWithOptionalParamInfiniteOptions = (options: Options> = {}; - if (page.body) { - params.body = { - ...queryKey[0].body as any, - ...page.body as any - }; - } - if (page.headers) { - params.headers = { - ...queryKey[0].headers, - ...page.headers - }; - } - if (page.path) { - params.path = { - ...queryKey[0].path, - ...page.path - }; - } - if (page.query) { - params.query = { - ...queryKey[0].query, - ...page.query - }; - } + const params = createInfiniteParams(queryKey, page); const { data } = await postCallWithOptionalParam({ ...options, - ...queryKey[0], ...params, throwOnError: true }); diff --git a/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/solid-query/asClass/@tanstack/solid-query.gen.ts b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/solid-query/asClass/@tanstack/solid-query.gen.ts index c746f7155..9bcba823a 100644 --- a/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/solid-query/asClass/@tanstack/solid-query.gen.ts +++ b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/solid-query/asClass/@tanstack/solid-query.gen.ts @@ -560,6 +560,35 @@ export const callWithParametersOptions = (options: Options[0], 'body' | 'headers' | 'path' | 'query'>>(queryKey: QueryKey, page: K) => { + const params = queryKey[0]; + if (page.body) { + params.body = { + ...queryKey[0].body as any, + ...page.body as any + }; + } + if (page.headers) { + params.headers = { + ...queryKey[0].headers, + ...page.headers + }; + } + if (page.path) { + params.path = { + ...queryKey[0].path, + ...page.path + }; + } + if (page.query) { + params.query = { + ...queryKey[0].query, + ...page.query + }; + } + return params as unknown as typeof page; +}; + export const callWithParametersInfiniteQueryKey = (options: Options): QueryKey> => [ createQueryKey("callWithParameters", options, true) ]; @@ -574,34 +603,9 @@ export const callWithParametersInfiniteOptions = (options: Options> = {}; - if (page.body) { - params.body = { - ...queryKey[0].body as any, - ...page.body as any - }; - } - if (page.headers) { - params.headers = { - ...queryKey[0].headers, - ...page.headers - }; - } - if (page.path) { - params.path = { - ...queryKey[0].path, - ...page.path - }; - } - if (page.query) { - params.query = { - ...queryKey[0].query, - ...page.query - }; - } + const params = createInfiniteParams(queryKey, page); const { data } = await ParametersService.callWithParameters({ ...options, - ...queryKey[0], ...params, throwOnError: true }); @@ -676,34 +680,9 @@ export const getCallWithOptionalParamInfiniteOptions = (options: Options> = {}; - if (page.body) { - params.body = { - ...queryKey[0].body as any, - ...page.body as any - }; - } - if (page.headers) { - params.headers = { - ...queryKey[0].headers, - ...page.headers - }; - } - if (page.path) { - params.path = { - ...queryKey[0].path, - ...page.path - }; - } - if (page.query) { - params.query = { - ...queryKey[0].query, - ...page.query - }; - } + const params = createInfiniteParams(queryKey, page); const { data } = await ParametersService.getCallWithOptionalParam({ ...options, - ...queryKey[0], ...params, throwOnError: true }); @@ -742,34 +721,9 @@ export const postCallWithOptionalParamInfiniteOptions = (options: Options> = {}; - if (page.body) { - params.body = { - ...queryKey[0].body as any, - ...page.body as any - }; - } - if (page.headers) { - params.headers = { - ...queryKey[0].headers, - ...page.headers - }; - } - if (page.path) { - params.path = { - ...queryKey[0].path, - ...page.path - }; - } - if (page.query) { - params.query = { - ...queryKey[0].query, - ...page.query - }; - } + const params = createInfiniteParams(queryKey, page); const { data } = await ParametersService.postCallWithOptionalParam({ ...options, - ...queryKey[0], ...params, throwOnError: true }); diff --git a/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/solid-query/axios/@tanstack/solid-query.gen.ts b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/solid-query/axios/@tanstack/solid-query.gen.ts index ef1fc054f..e9a4a7263 100644 --- a/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/solid-query/axios/@tanstack/solid-query.gen.ts +++ b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/solid-query/axios/@tanstack/solid-query.gen.ts @@ -257,6 +257,35 @@ export const callWithParametersOptions = (options: Options[0], 'body' | 'headers' | 'path' | 'query'>>(queryKey: QueryKey, page: K) => { + const params = queryKey[0]; + if (page.body) { + params.body = { + ...queryKey[0].body as any, + ...page.body as any + }; + } + if (page.headers) { + params.headers = { + ...queryKey[0].headers, + ...page.headers + }; + } + if (page.path) { + params.path = { + ...queryKey[0].path, + ...page.path + }; + } + if (page.query) { + params.query = { + ...queryKey[0].query, + ...page.query + }; + } + return params as unknown as typeof page; +}; + export const callWithParametersInfiniteQueryKey = (options: Options): QueryKey> => [ createQueryKey("callWithParameters", options, true) ]; @@ -271,34 +300,9 @@ export const callWithParametersInfiniteOptions = (options: Options> = {}; - if (page.body) { - params.body = { - ...queryKey[0].body as any, - ...page.body as any - }; - } - if (page.headers) { - params.headers = { - ...queryKey[0].headers, - ...page.headers - }; - } - if (page.path) { - params.path = { - ...queryKey[0].path, - ...page.path - }; - } - if (page.query) { - params.query = { - ...queryKey[0].query, - ...page.query - }; - } + const params = createInfiniteParams(queryKey, page); const { data } = await callWithParameters({ ...options, - ...queryKey[0], ...params, throwOnError: true }); @@ -373,34 +377,9 @@ export const getCallWithOptionalParamInfiniteOptions = (options: Options> = {}; - if (page.body) { - params.body = { - ...queryKey[0].body as any, - ...page.body as any - }; - } - if (page.headers) { - params.headers = { - ...queryKey[0].headers, - ...page.headers - }; - } - if (page.path) { - params.path = { - ...queryKey[0].path, - ...page.path - }; - } - if (page.query) { - params.query = { - ...queryKey[0].query, - ...page.query - }; - } + const params = createInfiniteParams(queryKey, page); const { data } = await getCallWithOptionalParam({ ...options, - ...queryKey[0], ...params, throwOnError: true }); @@ -439,34 +418,9 @@ export const postCallWithOptionalParamInfiniteOptions = (options: Options> = {}; - if (page.body) { - params.body = { - ...queryKey[0].body as any, - ...page.body as any - }; - } - if (page.headers) { - params.headers = { - ...queryKey[0].headers, - ...page.headers - }; - } - if (page.path) { - params.path = { - ...queryKey[0].path, - ...page.path - }; - } - if (page.query) { - params.query = { - ...queryKey[0].query, - ...page.query - }; - } + const params = createInfiniteParams(queryKey, page); const { data } = await postCallWithOptionalParam({ ...options, - ...queryKey[0], ...params, throwOnError: true }); diff --git a/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/solid-query/fetch/@tanstack/solid-query.gen.ts b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/solid-query/fetch/@tanstack/solid-query.gen.ts index ceda75bee..f21725166 100644 --- a/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/solid-query/fetch/@tanstack/solid-query.gen.ts +++ b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/solid-query/fetch/@tanstack/solid-query.gen.ts @@ -256,6 +256,35 @@ export const callWithParametersOptions = (options: Options[0], 'body' | 'headers' | 'path' | 'query'>>(queryKey: QueryKey, page: K) => { + const params = queryKey[0]; + if (page.body) { + params.body = { + ...queryKey[0].body as any, + ...page.body as any + }; + } + if (page.headers) { + params.headers = { + ...queryKey[0].headers, + ...page.headers + }; + } + if (page.path) { + params.path = { + ...queryKey[0].path, + ...page.path + }; + } + if (page.query) { + params.query = { + ...queryKey[0].query, + ...page.query + }; + } + return params as unknown as typeof page; +}; + export const callWithParametersInfiniteQueryKey = (options: Options): QueryKey> => [ createQueryKey("callWithParameters", options, true) ]; @@ -270,34 +299,9 @@ export const callWithParametersInfiniteOptions = (options: Options> = {}; - if (page.body) { - params.body = { - ...queryKey[0].body as any, - ...page.body as any - }; - } - if (page.headers) { - params.headers = { - ...queryKey[0].headers, - ...page.headers - }; - } - if (page.path) { - params.path = { - ...queryKey[0].path, - ...page.path - }; - } - if (page.query) { - params.query = { - ...queryKey[0].query, - ...page.query - }; - } + const params = createInfiniteParams(queryKey, page); const { data } = await callWithParameters({ ...options, - ...queryKey[0], ...params, throwOnError: true }); @@ -372,34 +376,9 @@ export const getCallWithOptionalParamInfiniteOptions = (options: Options> = {}; - if (page.body) { - params.body = { - ...queryKey[0].body as any, - ...page.body as any - }; - } - if (page.headers) { - params.headers = { - ...queryKey[0].headers, - ...page.headers - }; - } - if (page.path) { - params.path = { - ...queryKey[0].path, - ...page.path - }; - } - if (page.query) { - params.query = { - ...queryKey[0].query, - ...page.query - }; - } + const params = createInfiniteParams(queryKey, page); const { data } = await getCallWithOptionalParam({ ...options, - ...queryKey[0], ...params, throwOnError: true }); @@ -438,34 +417,9 @@ export const postCallWithOptionalParamInfiniteOptions = (options: Options> = {}; - if (page.body) { - params.body = { - ...queryKey[0].body as any, - ...page.body as any - }; - } - if (page.headers) { - params.headers = { - ...queryKey[0].headers, - ...page.headers - }; - } - if (page.path) { - params.path = { - ...queryKey[0].path, - ...page.path - }; - } - if (page.query) { - params.query = { - ...queryKey[0].query, - ...page.query - }; - } + const params = createInfiniteParams(queryKey, page); const { data } = await postCallWithOptionalParam({ ...options, - ...queryKey[0], ...params, throwOnError: true }); diff --git a/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/svelte-query/asClass/@tanstack/svelte-query.gen.ts b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/svelte-query/asClass/@tanstack/svelte-query.gen.ts index 5891d67f9..8b87b22dc 100644 --- a/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/svelte-query/asClass/@tanstack/svelte-query.gen.ts +++ b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/svelte-query/asClass/@tanstack/svelte-query.gen.ts @@ -560,6 +560,35 @@ export const callWithParametersOptions = (options: Options[0], 'body' | 'headers' | 'path' | 'query'>>(queryKey: QueryKey, page: K) => { + const params = queryKey[0]; + if (page.body) { + params.body = { + ...queryKey[0].body as any, + ...page.body as any + }; + } + if (page.headers) { + params.headers = { + ...queryKey[0].headers, + ...page.headers + }; + } + if (page.path) { + params.path = { + ...queryKey[0].path, + ...page.path + }; + } + if (page.query) { + params.query = { + ...queryKey[0].query, + ...page.query + }; + } + return params as unknown as typeof page; +}; + export const callWithParametersInfiniteQueryKey = (options: Options): QueryKey> => [ createQueryKey("callWithParameters", options, true) ]; @@ -574,34 +603,9 @@ export const callWithParametersInfiniteOptions = (options: Options> = {}; - if (page.body) { - params.body = { - ...queryKey[0].body as any, - ...page.body as any - }; - } - if (page.headers) { - params.headers = { - ...queryKey[0].headers, - ...page.headers - }; - } - if (page.path) { - params.path = { - ...queryKey[0].path, - ...page.path - }; - } - if (page.query) { - params.query = { - ...queryKey[0].query, - ...page.query - }; - } + const params = createInfiniteParams(queryKey, page); const { data } = await ParametersService.callWithParameters({ ...options, - ...queryKey[0], ...params, throwOnError: true }); @@ -676,34 +680,9 @@ export const getCallWithOptionalParamInfiniteOptions = (options: Options> = {}; - if (page.body) { - params.body = { - ...queryKey[0].body as any, - ...page.body as any - }; - } - if (page.headers) { - params.headers = { - ...queryKey[0].headers, - ...page.headers - }; - } - if (page.path) { - params.path = { - ...queryKey[0].path, - ...page.path - }; - } - if (page.query) { - params.query = { - ...queryKey[0].query, - ...page.query - }; - } + const params = createInfiniteParams(queryKey, page); const { data } = await ParametersService.getCallWithOptionalParam({ ...options, - ...queryKey[0], ...params, throwOnError: true }); @@ -742,34 +721,9 @@ export const postCallWithOptionalParamInfiniteOptions = (options: Options> = {}; - if (page.body) { - params.body = { - ...queryKey[0].body as any, - ...page.body as any - }; - } - if (page.headers) { - params.headers = { - ...queryKey[0].headers, - ...page.headers - }; - } - if (page.path) { - params.path = { - ...queryKey[0].path, - ...page.path - }; - } - if (page.query) { - params.query = { - ...queryKey[0].query, - ...page.query - }; - } + const params = createInfiniteParams(queryKey, page); const { data } = await ParametersService.postCallWithOptionalParam({ ...options, - ...queryKey[0], ...params, throwOnError: true }); diff --git a/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/svelte-query/axios/@tanstack/svelte-query.gen.ts b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/svelte-query/axios/@tanstack/svelte-query.gen.ts index 7d2950de3..005864147 100644 --- a/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/svelte-query/axios/@tanstack/svelte-query.gen.ts +++ b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/svelte-query/axios/@tanstack/svelte-query.gen.ts @@ -257,6 +257,35 @@ export const callWithParametersOptions = (options: Options[0], 'body' | 'headers' | 'path' | 'query'>>(queryKey: QueryKey, page: K) => { + const params = queryKey[0]; + if (page.body) { + params.body = { + ...queryKey[0].body as any, + ...page.body as any + }; + } + if (page.headers) { + params.headers = { + ...queryKey[0].headers, + ...page.headers + }; + } + if (page.path) { + params.path = { + ...queryKey[0].path, + ...page.path + }; + } + if (page.query) { + params.query = { + ...queryKey[0].query, + ...page.query + }; + } + return params as unknown as typeof page; +}; + export const callWithParametersInfiniteQueryKey = (options: Options): QueryKey> => [ createQueryKey("callWithParameters", options, true) ]; @@ -271,34 +300,9 @@ export const callWithParametersInfiniteOptions = (options: Options> = {}; - if (page.body) { - params.body = { - ...queryKey[0].body as any, - ...page.body as any - }; - } - if (page.headers) { - params.headers = { - ...queryKey[0].headers, - ...page.headers - }; - } - if (page.path) { - params.path = { - ...queryKey[0].path, - ...page.path - }; - } - if (page.query) { - params.query = { - ...queryKey[0].query, - ...page.query - }; - } + const params = createInfiniteParams(queryKey, page); const { data } = await callWithParameters({ ...options, - ...queryKey[0], ...params, throwOnError: true }); @@ -373,34 +377,9 @@ export const getCallWithOptionalParamInfiniteOptions = (options: Options> = {}; - if (page.body) { - params.body = { - ...queryKey[0].body as any, - ...page.body as any - }; - } - if (page.headers) { - params.headers = { - ...queryKey[0].headers, - ...page.headers - }; - } - if (page.path) { - params.path = { - ...queryKey[0].path, - ...page.path - }; - } - if (page.query) { - params.query = { - ...queryKey[0].query, - ...page.query - }; - } + const params = createInfiniteParams(queryKey, page); const { data } = await getCallWithOptionalParam({ ...options, - ...queryKey[0], ...params, throwOnError: true }); @@ -439,34 +418,9 @@ export const postCallWithOptionalParamInfiniteOptions = (options: Options> = {}; - if (page.body) { - params.body = { - ...queryKey[0].body as any, - ...page.body as any - }; - } - if (page.headers) { - params.headers = { - ...queryKey[0].headers, - ...page.headers - }; - } - if (page.path) { - params.path = { - ...queryKey[0].path, - ...page.path - }; - } - if (page.query) { - params.query = { - ...queryKey[0].query, - ...page.query - }; - } + const params = createInfiniteParams(queryKey, page); const { data } = await postCallWithOptionalParam({ ...options, - ...queryKey[0], ...params, throwOnError: true }); diff --git a/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/svelte-query/fetch/@tanstack/svelte-query.gen.ts b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/svelte-query/fetch/@tanstack/svelte-query.gen.ts index 015e0fe49..7e8acff83 100644 --- a/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/svelte-query/fetch/@tanstack/svelte-query.gen.ts +++ b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/svelte-query/fetch/@tanstack/svelte-query.gen.ts @@ -256,6 +256,35 @@ export const callWithParametersOptions = (options: Options[0], 'body' | 'headers' | 'path' | 'query'>>(queryKey: QueryKey, page: K) => { + const params = queryKey[0]; + if (page.body) { + params.body = { + ...queryKey[0].body as any, + ...page.body as any + }; + } + if (page.headers) { + params.headers = { + ...queryKey[0].headers, + ...page.headers + }; + } + if (page.path) { + params.path = { + ...queryKey[0].path, + ...page.path + }; + } + if (page.query) { + params.query = { + ...queryKey[0].query, + ...page.query + }; + } + return params as unknown as typeof page; +}; + export const callWithParametersInfiniteQueryKey = (options: Options): QueryKey> => [ createQueryKey("callWithParameters", options, true) ]; @@ -270,34 +299,9 @@ export const callWithParametersInfiniteOptions = (options: Options> = {}; - if (page.body) { - params.body = { - ...queryKey[0].body as any, - ...page.body as any - }; - } - if (page.headers) { - params.headers = { - ...queryKey[0].headers, - ...page.headers - }; - } - if (page.path) { - params.path = { - ...queryKey[0].path, - ...page.path - }; - } - if (page.query) { - params.query = { - ...queryKey[0].query, - ...page.query - }; - } + const params = createInfiniteParams(queryKey, page); const { data } = await callWithParameters({ ...options, - ...queryKey[0], ...params, throwOnError: true }); @@ -372,34 +376,9 @@ export const getCallWithOptionalParamInfiniteOptions = (options: Options> = {}; - if (page.body) { - params.body = { - ...queryKey[0].body as any, - ...page.body as any - }; - } - if (page.headers) { - params.headers = { - ...queryKey[0].headers, - ...page.headers - }; - } - if (page.path) { - params.path = { - ...queryKey[0].path, - ...page.path - }; - } - if (page.query) { - params.query = { - ...queryKey[0].query, - ...page.query - }; - } + const params = createInfiniteParams(queryKey, page); const { data } = await getCallWithOptionalParam({ ...options, - ...queryKey[0], ...params, throwOnError: true }); @@ -438,34 +417,9 @@ export const postCallWithOptionalParamInfiniteOptions = (options: Options> = {}; - if (page.body) { - params.body = { - ...queryKey[0].body as any, - ...page.body as any - }; - } - if (page.headers) { - params.headers = { - ...queryKey[0].headers, - ...page.headers - }; - } - if (page.path) { - params.path = { - ...queryKey[0].path, - ...page.path - }; - } - if (page.query) { - params.query = { - ...queryKey[0].query, - ...page.query - }; - } + const params = createInfiniteParams(queryKey, page); const { data } = await postCallWithOptionalParam({ ...options, - ...queryKey[0], ...params, throwOnError: true }); diff --git a/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/vue-query/asClass/@tanstack/vue-query.gen.ts b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/vue-query/asClass/@tanstack/vue-query.gen.ts index fbc84a28d..3e416b24d 100644 --- a/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/vue-query/asClass/@tanstack/vue-query.gen.ts +++ b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/vue-query/asClass/@tanstack/vue-query.gen.ts @@ -560,6 +560,35 @@ export const callWithParametersOptions = (options: Options[0], 'body' | 'headers' | 'path' | 'query'>>(queryKey: QueryKey, page: K) => { + const params = queryKey[0]; + if (page.body) { + params.body = { + ...queryKey[0].body as any, + ...page.body as any + }; + } + if (page.headers) { + params.headers = { + ...queryKey[0].headers, + ...page.headers + }; + } + if (page.path) { + params.path = { + ...queryKey[0].path, + ...page.path + }; + } + if (page.query) { + params.query = { + ...queryKey[0].query, + ...page.query + }; + } + return params as unknown as typeof page; +}; + export const callWithParametersInfiniteQueryKey = (options: Options): QueryKey> => [ createQueryKey("callWithParameters", options, true) ]; @@ -574,34 +603,9 @@ export const callWithParametersInfiniteOptions = (options: Options> = {}; - if (page.body) { - params.body = { - ...queryKey[0].body as any, - ...page.body as any - }; - } - if (page.headers) { - params.headers = { - ...queryKey[0].headers, - ...page.headers - }; - } - if (page.path) { - params.path = { - ...queryKey[0].path, - ...page.path - }; - } - if (page.query) { - params.query = { - ...queryKey[0].query, - ...page.query - }; - } + const params = createInfiniteParams(queryKey, page); const { data } = await ParametersService.callWithParameters({ ...options, - ...queryKey[0], ...params, throwOnError: true }); @@ -676,34 +680,9 @@ export const getCallWithOptionalParamInfiniteOptions = (options: Options> = {}; - if (page.body) { - params.body = { - ...queryKey[0].body as any, - ...page.body as any - }; - } - if (page.headers) { - params.headers = { - ...queryKey[0].headers, - ...page.headers - }; - } - if (page.path) { - params.path = { - ...queryKey[0].path, - ...page.path - }; - } - if (page.query) { - params.query = { - ...queryKey[0].query, - ...page.query - }; - } + const params = createInfiniteParams(queryKey, page); const { data } = await ParametersService.getCallWithOptionalParam({ ...options, - ...queryKey[0], ...params, throwOnError: true }); @@ -742,34 +721,9 @@ export const postCallWithOptionalParamInfiniteOptions = (options: Options> = {}; - if (page.body) { - params.body = { - ...queryKey[0].body as any, - ...page.body as any - }; - } - if (page.headers) { - params.headers = { - ...queryKey[0].headers, - ...page.headers - }; - } - if (page.path) { - params.path = { - ...queryKey[0].path, - ...page.path - }; - } - if (page.query) { - params.query = { - ...queryKey[0].query, - ...page.query - }; - } + const params = createInfiniteParams(queryKey, page); const { data } = await ParametersService.postCallWithOptionalParam({ ...options, - ...queryKey[0], ...params, throwOnError: true }); diff --git a/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/vue-query/axios/@tanstack/vue-query.gen.ts b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/vue-query/axios/@tanstack/vue-query.gen.ts index 43bec55b0..36fe96402 100644 --- a/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/vue-query/axios/@tanstack/vue-query.gen.ts +++ b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/vue-query/axios/@tanstack/vue-query.gen.ts @@ -257,6 +257,35 @@ export const callWithParametersOptions = (options: Options[0], 'body' | 'headers' | 'path' | 'query'>>(queryKey: QueryKey, page: K) => { + const params = queryKey[0]; + if (page.body) { + params.body = { + ...queryKey[0].body as any, + ...page.body as any + }; + } + if (page.headers) { + params.headers = { + ...queryKey[0].headers, + ...page.headers + }; + } + if (page.path) { + params.path = { + ...queryKey[0].path, + ...page.path + }; + } + if (page.query) { + params.query = { + ...queryKey[0].query, + ...page.query + }; + } + return params as unknown as typeof page; +}; + export const callWithParametersInfiniteQueryKey = (options: Options): QueryKey> => [ createQueryKey("callWithParameters", options, true) ]; @@ -271,34 +300,9 @@ export const callWithParametersInfiniteOptions = (options: Options> = {}; - if (page.body) { - params.body = { - ...queryKey[0].body as any, - ...page.body as any - }; - } - if (page.headers) { - params.headers = { - ...queryKey[0].headers, - ...page.headers - }; - } - if (page.path) { - params.path = { - ...queryKey[0].path, - ...page.path - }; - } - if (page.query) { - params.query = { - ...queryKey[0].query, - ...page.query - }; - } + const params = createInfiniteParams(queryKey, page); const { data } = await callWithParameters({ ...options, - ...queryKey[0], ...params, throwOnError: true }); @@ -373,34 +377,9 @@ export const getCallWithOptionalParamInfiniteOptions = (options: Options> = {}; - if (page.body) { - params.body = { - ...queryKey[0].body as any, - ...page.body as any - }; - } - if (page.headers) { - params.headers = { - ...queryKey[0].headers, - ...page.headers - }; - } - if (page.path) { - params.path = { - ...queryKey[0].path, - ...page.path - }; - } - if (page.query) { - params.query = { - ...queryKey[0].query, - ...page.query - }; - } + const params = createInfiniteParams(queryKey, page); const { data } = await getCallWithOptionalParam({ ...options, - ...queryKey[0], ...params, throwOnError: true }); @@ -439,34 +418,9 @@ export const postCallWithOptionalParamInfiniteOptions = (options: Options> = {}; - if (page.body) { - params.body = { - ...queryKey[0].body as any, - ...page.body as any - }; - } - if (page.headers) { - params.headers = { - ...queryKey[0].headers, - ...page.headers - }; - } - if (page.path) { - params.path = { - ...queryKey[0].path, - ...page.path - }; - } - if (page.query) { - params.query = { - ...queryKey[0].query, - ...page.query - }; - } + const params = createInfiniteParams(queryKey, page); const { data } = await postCallWithOptionalParam({ ...options, - ...queryKey[0], ...params, throwOnError: true }); diff --git a/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/vue-query/fetch/@tanstack/vue-query.gen.ts b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/vue-query/fetch/@tanstack/vue-query.gen.ts index 124d3cabe..91765a95e 100644 --- a/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/vue-query/fetch/@tanstack/vue-query.gen.ts +++ b/packages/openapi-ts/test/__snapshots__/plugins/@tanstack/vue-query/fetch/@tanstack/vue-query.gen.ts @@ -256,6 +256,35 @@ export const callWithParametersOptions = (options: Options[0], 'body' | 'headers' | 'path' | 'query'>>(queryKey: QueryKey, page: K) => { + const params = queryKey[0]; + if (page.body) { + params.body = { + ...queryKey[0].body as any, + ...page.body as any + }; + } + if (page.headers) { + params.headers = { + ...queryKey[0].headers, + ...page.headers + }; + } + if (page.path) { + params.path = { + ...queryKey[0].path, + ...page.path + }; + } + if (page.query) { + params.query = { + ...queryKey[0].query, + ...page.query + }; + } + return params as unknown as typeof page; +}; + export const callWithParametersInfiniteQueryKey = (options: Options): QueryKey> => [ createQueryKey("callWithParameters", options, true) ]; @@ -270,34 +299,9 @@ export const callWithParametersInfiniteOptions = (options: Options> = {}; - if (page.body) { - params.body = { - ...queryKey[0].body as any, - ...page.body as any - }; - } - if (page.headers) { - params.headers = { - ...queryKey[0].headers, - ...page.headers - }; - } - if (page.path) { - params.path = { - ...queryKey[0].path, - ...page.path - }; - } - if (page.query) { - params.query = { - ...queryKey[0].query, - ...page.query - }; - } + const params = createInfiniteParams(queryKey, page); const { data } = await callWithParameters({ ...options, - ...queryKey[0], ...params, throwOnError: true }); @@ -372,34 +376,9 @@ export const getCallWithOptionalParamInfiniteOptions = (options: Options> = {}; - if (page.body) { - params.body = { - ...queryKey[0].body as any, - ...page.body as any - }; - } - if (page.headers) { - params.headers = { - ...queryKey[0].headers, - ...page.headers - }; - } - if (page.path) { - params.path = { - ...queryKey[0].path, - ...page.path - }; - } - if (page.query) { - params.query = { - ...queryKey[0].query, - ...page.query - }; - } + const params = createInfiniteParams(queryKey, page); const { data } = await getCallWithOptionalParam({ ...options, - ...queryKey[0], ...params, throwOnError: true }); @@ -438,34 +417,9 @@ export const postCallWithOptionalParamInfiniteOptions = (options: Options> = {}; - if (page.body) { - params.body = { - ...queryKey[0].body as any, - ...page.body as any - }; - } - if (page.headers) { - params.headers = { - ...queryKey[0].headers, - ...page.headers - }; - } - if (page.path) { - params.path = { - ...queryKey[0].path, - ...page.path - }; - } - if (page.query) { - params.query = { - ...queryKey[0].query, - ...page.query - }; - } + const params = createInfiniteParams(queryKey, page); const { data } = await postCallWithOptionalParam({ ...options, - ...queryKey[0], ...params, throwOnError: true }); diff --git a/packages/openapi-ts/test/sample.cjs b/packages/openapi-ts/test/sample.cjs index e63cd25d0..5766da6a2 100644 --- a/packages/openapi-ts/test/sample.cjs +++ b/packages/openapi-ts/test/sample.cjs @@ -12,7 +12,7 @@ const main = async () => { // experimental_parser: true, // input: './test/spec/v3-transforms.json', // input: './test/spec/v3.json', - input: './test/spec/2.0/form-data.json', + input: './test/spec/3.1.0/required-all-of-ref.json', // input: './test/spec/v2.json', // input: 'https://mongodb-mms-prod-build-server.s3.amazonaws.com/openapi/2caffd88277a4e27c95dcefc7e3b6a63a3b03297-v2-2023-11-15.json', // name: 'foo', diff --git a/packages/openapi-ts/test/spec/3.1.0/required-all-of-ref.json b/packages/openapi-ts/test/spec/3.1.0/required-all-of-ref.json new file mode 100644 index 000000000..288d12e35 --- /dev/null +++ b/packages/openapi-ts/test/spec/3.1.0/required-all-of-ref.json @@ -0,0 +1,35 @@ +{ + "openapi": "3.1.0", + "info": { + "version": "1.0.0" + }, + "components": { + "schemas": { + "Foo": { + "type": "object", + "properties": { + "foo": { + "type": "string" + }, + "baz": { + "type": "string" + } + } + }, + "Bar": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/Foo" + } + ], + "properties": { + "bar": { + "type": "number" + } + }, + "required": ["foo", "bar", "baz"] + } + } + } +} diff --git a/packages/openapi-ts/test/spec/3.1.0/required-any-of-ref.json b/packages/openapi-ts/test/spec/3.1.0/required-any-of-ref.json new file mode 100644 index 000000000..eca84a929 --- /dev/null +++ b/packages/openapi-ts/test/spec/3.1.0/required-any-of-ref.json @@ -0,0 +1,35 @@ +{ + "openapi": "3.1.0", + "info": { + "version": "1.0.0" + }, + "components": { + "schemas": { + "Foo": { + "type": "object", + "properties": { + "foo": { + "type": "string" + }, + "baz": { + "type": "string" + } + } + }, + "Bar": { + "type": "object", + "anyOf": [ + { + "$ref": "#/components/schemas/Foo" + } + ], + "properties": { + "bar": { + "type": "number" + } + }, + "required": ["foo", "bar", "baz"] + } + } + } +} diff --git a/packages/openapi-ts/test/spec/3.1.0/required-one-of-ref.json b/packages/openapi-ts/test/spec/3.1.0/required-one-of-ref.json new file mode 100644 index 000000000..c1c96104e --- /dev/null +++ b/packages/openapi-ts/test/spec/3.1.0/required-one-of-ref.json @@ -0,0 +1,35 @@ +{ + "openapi": "3.1.0", + "info": { + "version": "1.0.0" + }, + "components": { + "schemas": { + "Foo": { + "type": "object", + "properties": { + "foo": { + "type": "string" + }, + "baz": { + "type": "string" + } + } + }, + "Bar": { + "type": "object", + "oneOf": [ + { + "$ref": "#/components/schemas/Foo" + } + ], + "properties": { + "bar": { + "type": "number" + } + }, + "required": ["foo", "bar", "baz"] + } + } + } +} -- 2.51.2 From e69478792ff4a4425c6bf475133be0223dd0adb0 Mon Sep 17 00:00:00 2001 From: Lubos Date: Thu, 3 Oct 2024 19:11:43 +0800 Subject: [PATCH 43/49] test: fix snapshots folder --- packages/openapi-ts/test/2.0.spec.ts | 8 ++++---- packages/openapi-ts/test/3.1.0.spec.ts | 8 ++++---- .../__snapshots__/2.0/{ => form-data}/index.ts | 0 .../2.0/{ => form-data}/services.gen.ts | 0 .../__snapshots__/2.0/{ => form-data}/types.gen.ts | 0 .../3.1.0/{ => duplicate-null}/index.ts | 0 .../3.1.0/{ => duplicate-null}/types.gen.ts | 14 ++++++-------- .../3.1.0/required-all-of-ref/index.ts | 2 ++ .../3.1.0/required-all-of-ref/types.gen.ts | 12 ++++++++++++ .../3.1.0/required-any-of-ref/index.ts | 2 ++ .../3.1.0/required-any-of-ref/types.gen.ts | 10 ++++++++++ .../3.1.0/required-one-of-ref/index.ts | 2 ++ .../3.1.0/required-one-of-ref/types.gen.ts | 10 ++++++++++ packages/openapi-ts/test/plugins.spec.ts | 8 +++++--- 14 files changed, 57 insertions(+), 19 deletions(-) rename packages/openapi-ts/test/__snapshots__/2.0/{ => form-data}/index.ts (100%) rename packages/openapi-ts/test/__snapshots__/2.0/{ => form-data}/services.gen.ts (100%) rename packages/openapi-ts/test/__snapshots__/2.0/{ => form-data}/types.gen.ts (100%) rename packages/openapi-ts/test/__snapshots__/3.1.0/{ => duplicate-null}/index.ts (100%) rename packages/openapi-ts/test/__snapshots__/3.1.0/{ => duplicate-null}/types.gen.ts (55%) create mode 100644 packages/openapi-ts/test/__snapshots__/3.1.0/required-all-of-ref/index.ts create mode 100644 packages/openapi-ts/test/__snapshots__/3.1.0/required-all-of-ref/types.gen.ts create mode 100644 packages/openapi-ts/test/__snapshots__/3.1.0/required-any-of-ref/index.ts create mode 100644 packages/openapi-ts/test/__snapshots__/3.1.0/required-any-of-ref/types.gen.ts create mode 100644 packages/openapi-ts/test/__snapshots__/3.1.0/required-one-of-ref/index.ts create mode 100644 packages/openapi-ts/test/__snapshots__/3.1.0/required-one-of-ref/types.gen.ts diff --git a/packages/openapi-ts/test/2.0.spec.ts b/packages/openapi-ts/test/2.0.spec.ts index 2b418ef23..64b239286 100644 --- a/packages/openapi-ts/test/2.0.spec.ts +++ b/packages/openapi-ts/test/2.0.spec.ts @@ -13,6 +13,8 @@ const __dirname = path.dirname(__filename); const VERSION = '2.0'; +const outputDir = path.join(__dirname, 'generated', VERSION); + describe(`OpenAPI ${VERSION}`, () => { const createConfig = (userConfig: UserConfig): UserConfig => ({ client: '@hey-api/client-fetch', @@ -25,9 +27,7 @@ describe(`OpenAPI ${VERSION}`, () => { typeof userConfig.input === 'string' ? userConfig.input : '', ), output: path.join( - __dirname, - 'generated', - VERSION, + outputDir, typeof userConfig.output === 'string' ? userConfig.output : '', ), }); @@ -56,7 +56,7 @@ describe(`OpenAPI ${VERSION}`, () => { __dirname, '__snapshots__', VERSION, - filePath.slice(outputPath.length + 1), + filePath.slice(outputDir.length + 1), ), ); }); diff --git a/packages/openapi-ts/test/3.1.0.spec.ts b/packages/openapi-ts/test/3.1.0.spec.ts index fefc1beb0..b9b1e8586 100644 --- a/packages/openapi-ts/test/3.1.0.spec.ts +++ b/packages/openapi-ts/test/3.1.0.spec.ts @@ -13,6 +13,8 @@ const __dirname = path.dirname(__filename); const VERSION = '3.1.0'; +const outputDir = path.join(__dirname, 'generated', VERSION); + describe(`OpenAPI ${VERSION}`, () => { const createConfig = (userConfig: UserConfig): UserConfig => ({ client: '@hey-api/client-fetch', @@ -25,9 +27,7 @@ describe(`OpenAPI ${VERSION}`, () => { typeof userConfig.input === 'string' ? userConfig.input : '', ), output: path.join( - __dirname, - 'generated', - VERSION, + outputDir, typeof userConfig.output === 'string' ? userConfig.output : '', ), }); @@ -100,7 +100,7 @@ describe(`OpenAPI ${VERSION}`, () => { __dirname, '__snapshots__', VERSION, - filePath.slice(outputPath.length + 1), + filePath.slice(outputDir.length + 1), ), ); }); diff --git a/packages/openapi-ts/test/__snapshots__/2.0/index.ts b/packages/openapi-ts/test/__snapshots__/2.0/form-data/index.ts similarity index 100% rename from packages/openapi-ts/test/__snapshots__/2.0/index.ts rename to packages/openapi-ts/test/__snapshots__/2.0/form-data/index.ts diff --git a/packages/openapi-ts/test/__snapshots__/2.0/services.gen.ts b/packages/openapi-ts/test/__snapshots__/2.0/form-data/services.gen.ts similarity index 100% rename from packages/openapi-ts/test/__snapshots__/2.0/services.gen.ts rename to packages/openapi-ts/test/__snapshots__/2.0/form-data/services.gen.ts diff --git a/packages/openapi-ts/test/__snapshots__/2.0/types.gen.ts b/packages/openapi-ts/test/__snapshots__/2.0/form-data/types.gen.ts similarity index 100% rename from packages/openapi-ts/test/__snapshots__/2.0/types.gen.ts rename to packages/openapi-ts/test/__snapshots__/2.0/form-data/types.gen.ts diff --git a/packages/openapi-ts/test/__snapshots__/3.1.0/index.ts b/packages/openapi-ts/test/__snapshots__/3.1.0/duplicate-null/index.ts similarity index 100% rename from packages/openapi-ts/test/__snapshots__/3.1.0/index.ts rename to packages/openapi-ts/test/__snapshots__/3.1.0/duplicate-null/index.ts diff --git a/packages/openapi-ts/test/__snapshots__/3.1.0/types.gen.ts b/packages/openapi-ts/test/__snapshots__/3.1.0/duplicate-null/types.gen.ts similarity index 55% rename from packages/openapi-ts/test/__snapshots__/3.1.0/types.gen.ts rename to packages/openapi-ts/test/__snapshots__/3.1.0/duplicate-null/types.gen.ts index afdb67392..d4f186e88 100644 --- a/packages/openapi-ts/test/__snapshots__/3.1.0/types.gen.ts +++ b/packages/openapi-ts/test/__snapshots__/3.1.0/duplicate-null/types.gen.ts @@ -1,13 +1,11 @@ // This file is auto-generated by @hey-api/openapi-ts -export type Foo = { - foo?: string; - baz?: string; -}; - -export type Bar = Foo | { - bar: number; -}; weirdEnum?: ('' | (string) | null); +export type PostTestData = { + /** + * should not produce duplicate null + */ + body?: { + weirdEnum?: ('' | (string) | null); }; }; diff --git a/packages/openapi-ts/test/__snapshots__/3.1.0/required-all-of-ref/index.ts b/packages/openapi-ts/test/__snapshots__/3.1.0/required-all-of-ref/index.ts new file mode 100644 index 000000000..56bade120 --- /dev/null +++ b/packages/openapi-ts/test/__snapshots__/3.1.0/required-all-of-ref/index.ts @@ -0,0 +1,2 @@ +// This file is auto-generated by @hey-api/openapi-ts +export * from './types.gen'; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/3.1.0/required-all-of-ref/types.gen.ts b/packages/openapi-ts/test/__snapshots__/3.1.0/required-all-of-ref/types.gen.ts new file mode 100644 index 000000000..0eb701475 --- /dev/null +++ b/packages/openapi-ts/test/__snapshots__/3.1.0/required-all-of-ref/types.gen.ts @@ -0,0 +1,12 @@ +// This file is auto-generated by @hey-api/openapi-ts + +export type Foo = { + foo?: string; + baz?: string; +}; + +export type Bar = Foo & { + foo: string; + baz: string; + bar: number; +}; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/3.1.0/required-any-of-ref/index.ts b/packages/openapi-ts/test/__snapshots__/3.1.0/required-any-of-ref/index.ts new file mode 100644 index 000000000..56bade120 --- /dev/null +++ b/packages/openapi-ts/test/__snapshots__/3.1.0/required-any-of-ref/index.ts @@ -0,0 +1,2 @@ +// This file is auto-generated by @hey-api/openapi-ts +export * from './types.gen'; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/3.1.0/required-any-of-ref/types.gen.ts b/packages/openapi-ts/test/__snapshots__/3.1.0/required-any-of-ref/types.gen.ts new file mode 100644 index 000000000..8d6fe6f46 --- /dev/null +++ b/packages/openapi-ts/test/__snapshots__/3.1.0/required-any-of-ref/types.gen.ts @@ -0,0 +1,10 @@ +// This file is auto-generated by @hey-api/openapi-ts + +export type Foo = { + foo?: string; + baz?: string; +}; + +export type Bar = Foo | { + bar: number; +}; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/3.1.0/required-one-of-ref/index.ts b/packages/openapi-ts/test/__snapshots__/3.1.0/required-one-of-ref/index.ts new file mode 100644 index 000000000..56bade120 --- /dev/null +++ b/packages/openapi-ts/test/__snapshots__/3.1.0/required-one-of-ref/index.ts @@ -0,0 +1,2 @@ +// This file is auto-generated by @hey-api/openapi-ts +export * from './types.gen'; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/3.1.0/required-one-of-ref/types.gen.ts b/packages/openapi-ts/test/__snapshots__/3.1.0/required-one-of-ref/types.gen.ts new file mode 100644 index 000000000..e8cc52bb5 --- /dev/null +++ b/packages/openapi-ts/test/__snapshots__/3.1.0/required-one-of-ref/types.gen.ts @@ -0,0 +1,10 @@ +// This file is auto-generated by @hey-api/openapi-ts + +export type Foo = { + foo?: string; + baz?: string; +}; + +export type Bar = (Foo) & { + bar: number; +}; \ No newline at end of file diff --git a/packages/openapi-ts/test/plugins.spec.ts b/packages/openapi-ts/test/plugins.spec.ts index 20a95580a..73f6e61ac 100644 --- a/packages/openapi-ts/test/plugins.spec.ts +++ b/packages/openapi-ts/test/plugins.spec.ts @@ -11,9 +11,11 @@ import { getFilePaths } from './utils'; const __filename = fileURLToPath(import.meta.url); const __dirname = path.dirname(__filename); -const outputDir = path.join(__dirname, 'generated', 'plugins'); +const VERSION = 'plugins'; -describe('plugins', () => { +const outputDir = path.join(__dirname, 'generated', VERSION); + +describe(VERSION, () => { const createConfig = ( userConfig: Omit & Pick, 'plugins'>, @@ -152,7 +154,7 @@ describe('plugins', () => { path.join( __dirname, '__snapshots__', - 'plugins', + VERSION, filePath.slice(outputDir.length + 1), ), ); -- 2.51.2 From e0944f4225cb69c9d12e0784f739d10c61b1fc8e Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 3 Oct 2024 11:57:21 +0000 Subject: [PATCH 44/49] Version Packages --- .changeset/gorgeous-mayflies-joke.md | 5 ----- .changeset/metal-mayflies-rest.md | 5 ----- packages/openapi-ts/CHANGELOG.md | 8 ++++++++ packages/openapi-ts/package.json | 2 +- 4 files changed, 9 insertions(+), 11 deletions(-) delete mode 100644 .changeset/gorgeous-mayflies-joke.md delete mode 100644 .changeset/metal-mayflies-rest.md diff --git a/.changeset/gorgeous-mayflies-joke.md b/.changeset/gorgeous-mayflies-joke.md deleted file mode 100644 index 07d153ed6..000000000 --- a/.changeset/gorgeous-mayflies-joke.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@hey-api/openapi-ts': patch ---- - -fix: skip nested properties in oneOf and anyOf compositions diff --git a/.changeset/metal-mayflies-rest.md b/.changeset/metal-mayflies-rest.md deleted file mode 100644 index f41a6c33b..000000000 --- a/.changeset/metal-mayflies-rest.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@hey-api/openapi-ts': patch ---- - -fix: abstract page params logic in TanStack Query plugin diff --git a/packages/openapi-ts/CHANGELOG.md b/packages/openapi-ts/CHANGELOG.md index 58c7dbfae..bb9162e40 100644 --- a/packages/openapi-ts/CHANGELOG.md +++ b/packages/openapi-ts/CHANGELOG.md @@ -1,5 +1,13 @@ # @hey-api/openapi-ts +## 0.53.7 + +### Patch Changes + +- [#1113](https://github.com/hey-api/openapi-ts/pull/1113) [`dc696e0`](https://github.com/hey-api/openapi-ts/commit/dc696e0b4500dba5ceb4c772110b123bd2f71b40) Thanks [@mrlubos](https://github.com/mrlubos)! - fix: skip nested properties in oneOf and anyOf compositions + +- [#1115](https://github.com/hey-api/openapi-ts/pull/1115) [`5f077dd`](https://github.com/hey-api/openapi-ts/commit/5f077dd8d144bbfe71d8775bad5fe7ddda2315d6) Thanks [@mrlubos](https://github.com/mrlubos)! - fix: abstract page params logic in TanStack Query plugin + ## 0.53.6 ### Patch Changes diff --git a/packages/openapi-ts/package.json b/packages/openapi-ts/package.json index 80552d9a7..e298a0fbd 100644 --- a/packages/openapi-ts/package.json +++ b/packages/openapi-ts/package.json @@ -1,6 +1,6 @@ { "name": "@hey-api/openapi-ts", - "version": "0.53.6", + "version": "0.53.7", "description": "Turn your OpenAPI specification into a beautiful TypeScript client", "homepage": "https://heyapi.vercel.app/", "repository": { -- 2.51.2 From 032338c47506ccfd567bbbf915398942c8394bc2 Mon Sep 17 00:00:00 2001 From: Lubos Date: Sun, 6 Oct 2024 00:09:03 +0800 Subject: [PATCH 45/49] fix: use correct relative path to bundled client when imported from nested module --- .changeset/gentle-ladybugs-yawn.md | 5 ++++ packages/openapi-ts/src/generate/client.ts | 18 ++++++++++--- packages/openapi-ts/src/generate/plugins.ts | 1 - packages/openapi-ts/src/generate/services.ts | 12 +++++---- packages/openapi-ts/src/generate/utils.ts | 27 +++++++++++++++++++ .../plugins/@tanstack/query-core/plugin.ts | 16 ++++++----- packages/openapi-ts/src/plugins/types.ts | 1 - packages/openapi-ts/test/sample.cjs | 24 ++++++++--------- 8 files changed, 76 insertions(+), 28 deletions(-) create mode 100644 .changeset/gentle-ladybugs-yawn.md diff --git a/.changeset/gentle-ladybugs-yawn.md b/.changeset/gentle-ladybugs-yawn.md new file mode 100644 index 000000000..599bf2fa7 --- /dev/null +++ b/.changeset/gentle-ladybugs-yawn.md @@ -0,0 +1,5 @@ +--- +'@hey-api/openapi-ts': patch +--- + +fix: use correct relative path to bundled client when imported from nested module diff --git a/packages/openapi-ts/src/generate/client.ts b/packages/openapi-ts/src/generate/client.ts index 1a99b5086..d36735bdf 100644 --- a/packages/openapi-ts/src/generate/client.ts +++ b/packages/openapi-ts/src/generate/client.ts @@ -2,11 +2,23 @@ import { copyFileSync } from 'node:fs'; import path from 'node:path'; import { getConfig, isStandaloneClient } from '../utils/config'; -import { ensureDirSync } from './utils'; +import { ensureDirSync, relativeModulePath } from './utils'; -export const clientModulePath = () => { +export const clientModulePath = ({ + sourceOutput, +}: { + sourceOutput: string; +}) => { const config = getConfig(); - return config.client.bundle ? './client' : config.client.name; + + if (config.client.bundle) { + return relativeModulePath({ + moduleOutput: 'client', + sourceOutput, + }); + } + + return config.client.name; }; export const clientOptionsTypeName = () => 'Options'; diff --git a/packages/openapi-ts/src/generate/plugins.ts b/packages/openapi-ts/src/generate/plugins.ts index 3853401fd..d73847b4f 100644 --- a/packages/openapi-ts/src/generate/plugins.ts +++ b/packages/openapi-ts/src/generate/plugins.ts @@ -34,7 +34,6 @@ export const generatePlugins = async ({ plugin.handler({ client, files, - outputParts, plugin, }); } diff --git a/packages/openapi-ts/src/generate/services.ts b/packages/openapi-ts/src/generate/services.ts index 80bbac70d..542a5af00 100644 --- a/packages/openapi-ts/src/generate/services.ts +++ b/packages/openapi-ts/src/generate/services.ts @@ -761,24 +761,26 @@ export const generateServices = async ({ const isStandalone = isStandaloneClient(config); + const servicesOutput = 'services'; + files.services = new TypeScriptFile({ dir: config.output.path, - name: 'services.ts', + name: `${servicesOutput}.ts`, }); // Import required packages and core files. if (isStandalone) { files.services.import({ - module: clientModulePath(), + module: clientModulePath({ sourceOutput: servicesOutput }), name: 'createClient', }); files.services.import({ - module: clientModulePath(), + module: clientModulePath({ sourceOutput: servicesOutput }), name: 'createConfig', }); files.services.import({ asType: true, - module: clientModulePath(), + module: clientModulePath({ sourceOutput: servicesOutput }), name: clientOptionsTypeName(), }); } else { @@ -857,7 +859,7 @@ export const generateServices = async ({ client, onClientImport: (imported) => { files.services.import({ - module: clientModulePath(), + module: clientModulePath({ sourceOutput: servicesOutput }), name: imported, }); }, diff --git a/packages/openapi-ts/src/generate/utils.ts b/packages/openapi-ts/src/generate/utils.ts index 434221d84..9c6a66329 100644 --- a/packages/openapi-ts/src/generate/utils.ts +++ b/packages/openapi-ts/src/generate/utils.ts @@ -5,3 +5,30 @@ export const ensureDirSync = (path: PathLike) => { mkdirSync(path, { recursive: true }); } }; + +/** + * Construct a relative import path to modules. This is used for example + * in plugins to import types or services module. + */ +export const relativeModulePath = ({ + moduleOutput, + sourceOutput, +}: { + /** + * Output path to the imported module. + * @example + * 'types' + */ + moduleOutput: string; + /** + * Output path to the source module. + * @example + * '@tanstack/react-query' + */ + sourceOutput: string; +}): string => { + const outputParts = sourceOutput.split('/'); + const relativePath = + new Array(outputParts.length).fill('').join('../') || './'; + return `${relativePath}${moduleOutput}`; +}; diff --git a/packages/openapi-ts/src/plugins/@tanstack/query-core/plugin.ts b/packages/openapi-ts/src/plugins/@tanstack/query-core/plugin.ts index ff0c24e40..02d450df3 100644 --- a/packages/openapi-ts/src/plugins/@tanstack/query-core/plugin.ts +++ b/packages/openapi-ts/src/plugins/@tanstack/query-core/plugin.ts @@ -15,6 +15,7 @@ import { operationResponseTypeName, toOperationName, } from '../../../generate/services'; +import { relativeModulePath } from '../../../generate/utils'; import { isOperationParameterRequired } from '../../../openApi'; import { getOperationKey } from '../../../openApi/common/parser/operation'; import type { Client } from '../../../types/client'; @@ -643,7 +644,6 @@ const createQueryKeyLiteral = ({ export const handler: PluginDefinition['handler'] = ({ client, files, - outputParts, plugin, }) => { if ( @@ -662,13 +662,14 @@ export const handler: PluginDefinition['handler'] = ({ file.import({ asType: true, - module: clientModulePath(), + module: clientModulePath({ sourceOutput: plugin.output }), name: clientOptionsTypeName(), }); - const relativePath = - new Array(outputParts.length).fill('').join('../') || './'; - const typesModulePath = relativePath + files.types.getName(false); + const typesModulePath = relativeModulePath({ + moduleOutput: files.types.getName(false), + sourceOutput: plugin.output, + }); const mutationsType = plugin.name === '@tanstack/svelte-query' || @@ -1211,7 +1212,10 @@ export const handler: PluginDefinition['handler'] = ({ file.add(statement); } - const servicesModulePath = relativePath + files.services.getName(false); + const servicesModulePath = relativeModulePath({ + moduleOutput: files.services.getName(false), + sourceOutput: plugin.output, + }); if (hasQueries || hasInfiniteQueries) { file.import({ diff --git a/packages/openapi-ts/src/plugins/types.ts b/packages/openapi-ts/src/plugins/types.ts index 26c5af436..bfc9bc0d1 100644 --- a/packages/openapi-ts/src/plugins/types.ts +++ b/packages/openapi-ts/src/plugins/types.ts @@ -6,7 +6,6 @@ export interface PluginDefinition { handler: (args: { client: Client; files: Files; - outputParts: string[]; plugin: Config['plugins'][number]; }) => void; name: string; diff --git a/packages/openapi-ts/test/sample.cjs b/packages/openapi-ts/test/sample.cjs index 5766da6a2..5b50abbe4 100644 --- a/packages/openapi-ts/test/sample.cjs +++ b/packages/openapi-ts/test/sample.cjs @@ -4,30 +4,30 @@ const main = async () => { /** @type {import('../src').UserConfig} */ const config = { client: { - // bundle: true, + bundle: true, // name: '@hey-api/client-axios', name: '@hey-api/client-fetch', }, // debug: true, // experimental_parser: true, // input: './test/spec/v3-transforms.json', - // input: './test/spec/v3.json', - input: './test/spec/3.1.0/required-all-of-ref.json', + input: './test/spec/v3.json', + // input: './test/spec/3.1.0/required-all-of-ref.json', // input: './test/spec/v2.json', // input: 'https://mongodb-mms-prod-build-server.s3.amazonaws.com/openapi/2caffd88277a4e27c95dcefc7e3b6a63a3b03297-v2-2023-11-15.json', // name: 'foo', output: { path: './test/generated/sample/', }, - // plugins: [ - // { - // // infiniteQueryOptions: false, - // // mutationOptions: false, - // name: '@tanstack/react-query', - // // queryOptions: false, - // }, - // // '@hey-api/services', - // ], + plugins: [ + { + // infiniteQueryOptions: false, + // mutationOptions: false, + name: '@tanstack/react-query', + // queryOptions: false, + }, + // '@hey-api/services', + ], schemas: { export: false, }, -- 2.51.2 From 97c5411f11c146e24c419131ff80f6577a030cbf Mon Sep 17 00:00:00 2001 From: Lubos Date: Sun, 6 Oct 2024 00:37:35 +0800 Subject: [PATCH 46/49] chore: rename isStandaloneClient function to isLegacyClient --- packages/openapi-ts/src/generate/client.ts | 4 +-- packages/openapi-ts/src/generate/plugins.ts | 8 ++---- packages/openapi-ts/src/generate/services.ts | 28 +++++++++---------- packages/openapi-ts/src/generate/types.ts | 12 ++++---- packages/openapi-ts/src/index.ts | 5 ++-- .../common/parser/__tests__/type.spec.ts | 2 +- .../src/utils/__tests__/type.spec.ts | 14 +++++----- packages/openapi-ts/src/utils/config.ts | 4 +-- packages/openapi-ts/src/utils/parse.ts | 8 +++--- packages/openapi-ts/src/utils/type.ts | 10 +++---- 10 files changed, 46 insertions(+), 49 deletions(-) diff --git a/packages/openapi-ts/src/generate/client.ts b/packages/openapi-ts/src/generate/client.ts index d36735bdf..ff20df5a5 100644 --- a/packages/openapi-ts/src/generate/client.ts +++ b/packages/openapi-ts/src/generate/client.ts @@ -1,7 +1,7 @@ import { copyFileSync } from 'node:fs'; import path from 'node:path'; -import { getConfig, isStandaloneClient } from '../utils/config'; +import { getConfig, isLegacyClient } from '../utils/config'; import { ensureDirSync, relativeModulePath } from './utils'; export const clientModulePath = ({ @@ -35,7 +35,7 @@ export const generateClient = async ( ) => { const config = getConfig(); - if (!isStandaloneClient(config) || !config.client.bundle) { + if (isLegacyClient(config) || !config.client.bundle) { return; } diff --git a/packages/openapi-ts/src/generate/plugins.ts b/packages/openapi-ts/src/generate/plugins.ts index d73847b4f..7e9a999e6 100644 --- a/packages/openapi-ts/src/generate/plugins.ts +++ b/packages/openapi-ts/src/generate/plugins.ts @@ -3,7 +3,7 @@ import path from 'node:path'; import { TypeScriptFile } from '../compiler'; import type { Client } from '../types/client'; import type { Files } from '../types/utils'; -import { getConfig, isStandaloneClient } from '../utils/config'; +import { getConfig, isLegacyClient } from '../utils/config'; export const generatePlugins = async ({ client, @@ -14,10 +14,8 @@ export const generatePlugins = async ({ }) => { const config = getConfig(); - const isStandalone = isStandaloneClient(config); - - if (!isStandalone) { - // plugins work only with standalone clients + if (isLegacyClient(config)) { + // plugins do not work with legacy clients return; } diff --git a/packages/openapi-ts/src/generate/services.ts b/packages/openapi-ts/src/generate/services.ts index 542a5af00..07ce7cc58 100644 --- a/packages/openapi-ts/src/generate/services.ts +++ b/packages/openapi-ts/src/generate/services.ts @@ -16,7 +16,7 @@ import type { } from '../types/client'; import type { Files } from '../types/utils'; import { camelCase } from '../utils/camelCase'; -import { getConfig, isStandaloneClient } from '../utils/config'; +import { getConfig, isLegacyClient } from '../utils/config'; import { escapeComment, escapeName } from '../utils/escape'; import { reservedWordsRegExp } from '../utils/regexp'; import { transformServiceName } from '../utils/transform'; @@ -115,7 +115,7 @@ const toOperationParamType = ( const isRequired = isOperationParameterRequired(operation.parameters); - if (isStandaloneClient(config)) { + if (!isLegacyClient(config)) { return [ { isRequired, @@ -205,7 +205,7 @@ const toOperationReturnType = (client: Client, operation: Operation) => { const toOperationComment = (operation: Operation): Comments => { const config = getConfig(); - if (isStandaloneClient(config)) { + if (!isLegacyClient(config)) { const comment = [ operation.deprecated && '@deprecated', operation.summary && escapeComment(operation.summary), @@ -273,7 +273,7 @@ const toRequestOptions = ( onImport(responseTransformerName); } - if (isStandaloneClient(config)) { + if (!isLegacyClient(config)) { let obj: ObjectValue[] = [ { spread: 'options', @@ -490,7 +490,7 @@ const toOperationStatements = ( const options = toRequestOptions(client, operation, onImport, onClientImport); - if (isStandaloneClient(config)) { + if (!isLegacyClient(config)) { const errorType = setUniqueTypeName({ client, meta: { @@ -573,7 +573,7 @@ const processService = ({ }) => { const config = getConfig(); - const isStandalone = isStandaloneClient(config); + const isLegacy = isLegacyClient(config); for (const operation of service.operations) { if (operation.parameters.length) { @@ -590,7 +590,7 @@ const processService = ({ }); } - if (isStandalone) { + if (!isLegacy) { generateImport({ client, meta: { @@ -632,7 +632,7 @@ const processService = ({ for (const operation of service.operations) { const compileFunctionParams = { parameters: toOperationParamType(client, operation), - returnType: isStandalone + returnType: !isLegacy ? undefined : toOperationReturnType(client, operation), statements: toOperationStatements( @@ -641,7 +641,7 @@ const processService = ({ onImport, onClientImport, ), - types: isStandalone ? [throwOnErrorTypeGeneric] : undefined, + types: !isLegacy ? [throwOnErrorTypeGeneric] : undefined, }; const expression = config.client.name === 'legacy/angular' @@ -666,7 +666,7 @@ const processService = ({ config.name === undefined && config.client.name !== 'legacy/angular', name: toOperationName(operation, false), parameters: toOperationParamType(client, operation), - returnType: isStandalone + returnType: !isLegacy ? undefined : toOperationReturnType(client, operation), statements: toOperationStatements( @@ -675,7 +675,7 @@ const processService = ({ onImport, onClientImport, ), - types: isStandalone ? [throwOnErrorTypeGeneric] : undefined, + types: !isLegacy ? [throwOnErrorTypeGeneric] : undefined, }); return node; }); @@ -759,7 +759,7 @@ export const generateServices = async ({ checkPrerequisites({ files }); - const isStandalone = isStandaloneClient(config); + const isLegacy = isLegacyClient(config); const servicesOutput = 'services'; @@ -769,7 +769,7 @@ export const generateServices = async ({ }); // Import required packages and core files. - if (isStandalone) { + if (!isLegacy) { files.services.import({ module: clientModulePath({ sourceOutput: servicesOutput }), name: 'createClient', @@ -838,7 +838,7 @@ export const generateServices = async ({ } // define client first - if (isStandalone) { + if (!isLegacy) { const statement = compiler.constVariable({ exportConst: true, expression: compiler.callExpression({ diff --git a/packages/openapi-ts/src/generate/types.ts b/packages/openapi-ts/src/generate/types.ts index 4b0f84b4e..0be310b43 100644 --- a/packages/openapi-ts/src/generate/types.ts +++ b/packages/openapi-ts/src/generate/types.ts @@ -10,7 +10,7 @@ import { isOperationParameterRequired } from '../openApi'; import type { Method, Model, OperationParameter } from '../types/client'; import type { Client } from '../types/client'; import type { Files } from '../types/utils'; -import { getConfig, isStandaloneClient } from '../utils/config'; +import { getConfig, isLegacyClient } from '../utils/config'; import { enumEntry, enumUnionType } from '../utils/enum'; import { escapeComment } from '../utils/escape'; import { sortByName, sorterByName } from '../utils/sort'; @@ -301,7 +301,7 @@ const processServiceTypes = ({ return; } - const isStandalone = isStandaloneClient(config); + const isLegacy = isLegacyClient(config); for (const service of client.services) { for (const operation of service.operations) { @@ -382,8 +382,8 @@ const processServiceTypes = ({ ), ), mediaType: null, - name: isStandalone ? 'headers' : 'header', - prop: isStandalone ? 'headers' : 'header', + name: isLegacy ? 'header' : 'headers', + prop: isLegacy ? 'header' : 'headers', properties: operation.parameters .filter((parameter) => parameter.in === 'header') .sort(sorterByName), @@ -416,7 +416,7 @@ const processServiceTypes = ({ .filter((parameter) => parameter.in === 'query') .sort(sorterByName), }; - const operationProperties = isStandalone + const operationProperties = !isLegacy ? [ bodyParameters, headerParameters, @@ -479,7 +479,7 @@ const processServiceTypes = ({ response.responseTypes.includes('error'), ); - if (isStandalone) { + if (!isLegacy) { // create type export for operation error generateType({ client, diff --git a/packages/openapi-ts/src/index.ts b/packages/openapi-ts/src/index.ts index b074e6343..fe494f346 100644 --- a/packages/openapi-ts/src/index.ts +++ b/packages/openapi-ts/src/index.ts @@ -9,7 +9,7 @@ import { defaultPluginConfigs } from './plugins'; import type { Client } from './types/client'; import type { ClientConfig, Config, UserConfig } from './types/config'; import { CLIENTS } from './types/config'; -import { getConfig, isStandaloneClient, setConfig } from './utils/config'; +import { getConfig, isLegacyClient, setConfig } from './utils/config'; import { getOpenApiSpec } from './utils/getOpenApiSpec'; import { registerHandlebarTemplates } from './utils/handlebars'; import { @@ -293,8 +293,7 @@ const initConfigs = async (userConfig: UserConfig): Promise => { debug, dryRun, experimental_parser, - exportCore: - isStandaloneClient(client) || !client.name ? false : exportCore, + exportCore: isLegacyClient(client) ? exportCore : false, input, name, output, diff --git a/packages/openapi-ts/src/openApi/common/parser/__tests__/type.spec.ts b/packages/openapi-ts/src/openApi/common/parser/__tests__/type.spec.ts index f0bc7a526..f7dceff8c 100644 --- a/packages/openapi-ts/src/openApi/common/parser/__tests__/type.spec.ts +++ b/packages/openapi-ts/src/openApi/common/parser/__tests__/type.spec.ts @@ -9,7 +9,7 @@ vi.mock('../../../../utils/config', () => { }; return { getConfig: () => config, - isStandaloneClient: vi.fn().mockReturnValue(false), + isLegacyClient: vi.fn().mockReturnValue(true), }; }); diff --git a/packages/openapi-ts/src/utils/__tests__/type.spec.ts b/packages/openapi-ts/src/utils/__tests__/type.spec.ts index 62990d43e..bf5270424 100644 --- a/packages/openapi-ts/src/utils/__tests__/type.spec.ts +++ b/packages/openapi-ts/src/utils/__tests__/type.spec.ts @@ -1,7 +1,7 @@ import { describe, expect, it, type MockedFunction, vi } from 'vitest'; import type { Config } from '../../types/config'; -import { isStandaloneClient } from '../config'; +import { isLegacyClient } from '../config'; import { transformTypeKeyName } from '../type'; vi.mock('../config', () => { @@ -10,7 +10,7 @@ vi.mock('../config', () => { }; return { getConfig: () => config, - isStandaloneClient: vi.fn().mockReturnValue(false), + isLegacyClient: vi.fn().mockReturnValue(true), }; }); @@ -31,14 +31,14 @@ describe('transformTypeKeyName', () => { { expected: 'fooBar', input: 'foo[bar]' }, { expected: 'fooBarArray', input: 'foo.bar[]' }, ])('$input -> $expected', ({ input, expected }) => { - (isStandaloneClient as MockedFunction).mockImplementationOnce( - () => false, + (isLegacyClient as MockedFunction).mockImplementationOnce( + () => true, ); expect(transformTypeKeyName(input)).toBe(expected); }); }); - describe('standalone client', () => { + describe('client', () => { it.each([ { expected: '', input: '' }, { expected: 'foobar', input: 'foobar' }, @@ -54,8 +54,8 @@ describe('transformTypeKeyName', () => { { expected: 'fooBar', input: 'foo[bar]' }, { expected: 'fooBarArray', input: 'foo.bar[]' }, ])('$input -> $input', ({ input }) => { - (isStandaloneClient as MockedFunction).mockImplementationOnce( - () => true, + (isLegacyClient as MockedFunction).mockImplementationOnce( + () => false, ); expect(transformTypeKeyName(input)).toBe(input); }); diff --git a/packages/openapi-ts/src/utils/config.ts b/packages/openapi-ts/src/utils/config.ts index cd9cf4c9f..7f7486255 100644 --- a/packages/openapi-ts/src/utils/config.ts +++ b/packages/openapi-ts/src/utils/config.ts @@ -9,7 +9,7 @@ export const setConfig = (config: Config) => { return getConfig(); }; -export const isStandaloneClient = (config: Config | Config['client']) => { +export const isLegacyClient = (config: Config | Config['client']) => { const client = 'client' in config ? config.client.name : config.name; - return client.startsWith('@hey-api'); + return client.startsWith('legacy/'); }; diff --git a/packages/openapi-ts/src/utils/parse.ts b/packages/openapi-ts/src/utils/parse.ts index f0eb609d0..f288854fd 100644 --- a/packages/openapi-ts/src/utils/parse.ts +++ b/packages/openapi-ts/src/utils/parse.ts @@ -1,7 +1,7 @@ import type { Operation, OperationParameter } from '../openApi'; import { sanitizeNamespaceIdentifier } from '../openApi'; import { camelCase } from './camelCase'; -import { getConfig, isStandaloneClient } from './config'; +import { getConfig, isLegacyClient } from './config'; import { transformTypeKeyName } from './type'; export const operationFilterFn = (operationKey: string): boolean => { @@ -19,7 +19,7 @@ export const operationParameterFilterFn = ( // legacy clients ignore the "api-version" param since we do not want to // add it as the first/default parameter for each of the service calls - return isStandaloneClient(config) || parameter.prop !== 'api-version'; + return !isLegacyClient(config) || parameter.prop !== 'api-version'; }; /** @@ -40,7 +40,7 @@ export const operationNameFn = (operation: Omit): string => { // legacy clients ignore the "api-version" param since we do not want to // add it as the first/default parameter for each of the service calls - if (!isStandaloneClient(config)) { + if (isLegacyClient(config)) { urlWithoutPlaceholders = urlWithoutPlaceholders.replace( /[^/]*?{api-version}.*?\//g, '', @@ -62,7 +62,7 @@ export const operationParameterNameFn = ( ): string => { const config = getConfig(); - return isStandaloneClient(config) + return !isLegacyClient(config) ? parameter.prop : transformTypeKeyName(parameter.prop); }; diff --git a/packages/openapi-ts/src/utils/type.ts b/packages/openapi-ts/src/utils/type.ts index fb0c2cbb0..09676bb2c 100644 --- a/packages/openapi-ts/src/utils/type.ts +++ b/packages/openapi-ts/src/utils/type.ts @@ -3,7 +3,7 @@ import type { Model } from '../openApi'; import { sanitizeOperationParameterName } from '../openApi'; import type { Client } from '../types/client'; import { camelCase } from './camelCase'; -import { getConfig, isStandaloneClient } from './config'; +import { getConfig, isLegacyClient } from './config'; import { refSchemasPartial } from './const'; import { enumValue } from './enum'; import { escapeComment, escapeName, unescapeName } from './escape'; @@ -149,12 +149,12 @@ const typeInterface = (model: Model) => { const config = getConfig(); - const isStandalone = isStandaloneClient(config); + const isLegacy = isLegacyClient(config); const properties: Property[] = model.properties.map((property) => { let maybeRequired = property.isRequired ? '' : '?'; let value = toType(property); - let name = isStandalone + let name = !isLegacy ? escapeName(unescapeName(transformTypeKeyName(property.name))) : // special test for 1XX status codes. We need a more robust system // for escaping values depending on context in which they're printed, @@ -331,8 +331,8 @@ export const unsetUniqueTypeName = ({ export const transformTypeKeyName = (value: string): string => { const config = getConfig(); - // do not transform anything for standalone clients - if (isStandaloneClient(config)) { + // transform only for legacy clients + if (!isLegacyClient(config)) { return value; } -- 2.51.2 From 7615fd9fa41c69b3c039262e43137c891c96bf7c Mon Sep 17 00:00:00 2001 From: Lubos Date: Sun, 6 Oct 2024 01:09:01 +0800 Subject: [PATCH 47/49] chore: improve plugin handler types --- packages/openapi-ts/src/generate/plugins.ts | 2 +- packages/openapi-ts/src/index.ts | 2 +- .../src/plugins/@hey-api/schemas/types.ts | 10 ++++--- .../src/plugins/@hey-api/services/types.ts | 10 ++++--- .../src/plugins/@hey-api/types/types.ts | 10 ++++--- .../plugins/@tanstack/query-core/plugin.ts | 26 ++++++++----------- .../plugins/@tanstack/react-query/types.ts | 14 +++++----- .../plugins/@tanstack/solid-query/types.ts | 14 +++++----- .../plugins/@tanstack/svelte-query/types.ts | 14 +++++----- .../src/plugins/@tanstack/vue-query/types.ts | 14 +++++----- packages/openapi-ts/src/plugins/index.ts | 10 ++++++- packages/openapi-ts/src/plugins/types.ts | 21 +++++++-------- packages/openapi-ts/src/plugins/zod/config.ts | 8 ++++++ packages/openapi-ts/src/plugins/zod/index.ts | 13 ++++++++++ packages/openapi-ts/src/plugins/zod/plugin.ts | 6 +++++ packages/openapi-ts/src/plugins/zod/types.ts | 19 ++++++++++++++ packages/openapi-ts/test/sample.cjs | 10 +++---- 17 files changed, 130 insertions(+), 73 deletions(-) create mode 100644 packages/openapi-ts/src/plugins/zod/config.ts create mode 100644 packages/openapi-ts/src/plugins/zod/index.ts create mode 100644 packages/openapi-ts/src/plugins/zod/plugin.ts create mode 100644 packages/openapi-ts/src/plugins/zod/types.ts diff --git a/packages/openapi-ts/src/generate/plugins.ts b/packages/openapi-ts/src/generate/plugins.ts index 7e9a999e6..597f07737 100644 --- a/packages/openapi-ts/src/generate/plugins.ts +++ b/packages/openapi-ts/src/generate/plugins.ts @@ -32,7 +32,7 @@ export const generatePlugins = async ({ plugin.handler({ client, files, - plugin, + plugin: plugin as never, }); } }; diff --git a/packages/openapi-ts/src/index.ts b/packages/openapi-ts/src/index.ts index fe494f346..126687956 100644 --- a/packages/openapi-ts/src/index.ts +++ b/packages/openapi-ts/src/index.ts @@ -146,7 +146,7 @@ const getPlugins = (userConfig: ClientConfig): Config['plugins'] => { ...defaultPluginConfigs[plugin.name], ...(plugin as (typeof defaultPluginConfigs)[(typeof plugin)['name']]), }, - ); + ) as unknown as Config['plugins']; return plugins; }; diff --git a/packages/openapi-ts/src/plugins/@hey-api/schemas/types.ts b/packages/openapi-ts/src/plugins/@hey-api/schemas/types.ts index 1837a7f0f..766b5cf07 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/schemas/types.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/schemas/types.ts @@ -1,6 +1,6 @@ -import type { PluginDefinition } from '../../types'; +import type { PluginHandler } from '../../types'; -export interface PluginConfig extends PluginDefinition { +interface Config { /** * Generate Hey API schemas from the provided input. */ @@ -12,4 +12,8 @@ export interface PluginConfig extends PluginDefinition { output?: string; } -export interface UserConfig extends Pick {} +export interface PluginConfig extends Config { + handler: PluginHandler; +} + +export interface UserConfig extends Omit {} diff --git a/packages/openapi-ts/src/plugins/@hey-api/services/types.ts b/packages/openapi-ts/src/plugins/@hey-api/services/types.ts index 977414f66..6527815d4 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/services/types.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/services/types.ts @@ -1,6 +1,6 @@ -import type { PluginDefinition } from '../../types'; +import type { PluginHandler } from '../../types'; -export interface PluginConfig extends PluginDefinition { +interface Config { /** * Generate Hey API services from the provided input. */ @@ -12,4 +12,8 @@ export interface PluginConfig extends PluginDefinition { output?: string; } -export interface UserConfig extends Pick {} +export interface PluginConfig extends Config { + handler: PluginHandler; +} + +export interface UserConfig extends Omit {} diff --git a/packages/openapi-ts/src/plugins/@hey-api/types/types.ts b/packages/openapi-ts/src/plugins/@hey-api/types/types.ts index 1290e7ea8..b1ba128d0 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/types/types.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/types/types.ts @@ -1,6 +1,6 @@ -import type { PluginDefinition } from '../../types'; +import type { PluginHandler } from '../../types'; -export interface PluginConfig extends PluginDefinition { +interface Config { /** * Generate Hey API types from the provided input. */ @@ -12,4 +12,8 @@ export interface PluginConfig extends PluginDefinition { output?: string; } -export interface UserConfig extends Pick {} +export interface PluginConfig extends Config { + handler: PluginHandler; +} + +export interface UserConfig extends Omit {} diff --git a/packages/openapi-ts/src/plugins/@tanstack/query-core/plugin.ts b/packages/openapi-ts/src/plugins/@tanstack/query-core/plugin.ts index 02d450df3..3bf2dc3f4 100644 --- a/packages/openapi-ts/src/plugins/@tanstack/query-core/plugin.ts +++ b/packages/openapi-ts/src/plugins/@tanstack/query-core/plugin.ts @@ -28,7 +28,11 @@ import type { import type { Files } from '../../../types/utils'; import { getConfig } from '../../../utils/config'; import { transformServiceName } from '../../../utils/transform'; -import type { PluginDefinition } from '../../types'; +import type { PluginHandler } from '../../types'; +import type { PluginConfig as ReactQueryPluginConfig } from '../react-query'; +import type { PluginConfig as SolidQueryPluginConfig } from '../solid-query'; +import type { PluginConfig as SvelteQueryPluginConfig } from '../svelte-query'; +import type { PluginConfig as VueQueryPluginConfig } from '../vue-query'; const toInfiniteQueryOptionsName = (operation: Operation) => `${toOperationName(operation, false)}InfiniteOptions`; @@ -641,20 +645,12 @@ const createQueryKeyLiteral = ({ return queryKeyLiteral; }; -export const handler: PluginDefinition['handler'] = ({ - client, - files, - plugin, -}) => { - if ( - plugin.name !== '@tanstack/react-query' && - plugin.name !== '@tanstack/solid-query' && - plugin.name !== '@tanstack/svelte-query' && - plugin.name !== '@tanstack/vue-query' - ) { - return; - } - +export const handler: PluginHandler< + | ReactQueryPluginConfig + | SolidQueryPluginConfig + | SvelteQueryPluginConfig + | VueQueryPluginConfig +> = ({ client, files, plugin }) => { checkPrerequisites({ files }); const config = getConfig(); diff --git a/packages/openapi-ts/src/plugins/@tanstack/react-query/types.ts b/packages/openapi-ts/src/plugins/@tanstack/react-query/types.ts index 6482456d5..46138e3dc 100644 --- a/packages/openapi-ts/src/plugins/@tanstack/react-query/types.ts +++ b/packages/openapi-ts/src/plugins/@tanstack/react-query/types.ts @@ -1,6 +1,6 @@ -import type { PluginDefinition } from '../../types'; +import type { PluginHandler } from '../../types'; -export interface PluginConfig extends PluginDefinition { +interface Config { /** * Generate {@link https://tanstack.com/query/v5/docs/framework/react/reference/infiniteQueryOptions `infiniteQueryOptions()`} helpers? These will be generated from GET and POST requests where a pagination parameter is detected. * @default true @@ -28,8 +28,8 @@ export interface PluginConfig extends PluginDefinition { queryOptions?: boolean; } -export interface UserConfig - extends Pick< - PluginConfig, - 'infiniteQueryOptions' | 'mutationOptions' | 'name' | 'queryOptions' - > {} +export interface PluginConfig extends Config { + handler: PluginHandler; +} + +export interface UserConfig extends Omit {} diff --git a/packages/openapi-ts/src/plugins/@tanstack/solid-query/types.ts b/packages/openapi-ts/src/plugins/@tanstack/solid-query/types.ts index 111e95266..8826a6885 100644 --- a/packages/openapi-ts/src/plugins/@tanstack/solid-query/types.ts +++ b/packages/openapi-ts/src/plugins/@tanstack/solid-query/types.ts @@ -1,6 +1,6 @@ -import type { PluginDefinition } from '../../types'; +import type { PluginHandler } from '../../types'; -export interface PluginConfig extends PluginDefinition { +interface Config { /** * Generate `createInfiniteQuery()` helpers? These will be generated from GET and POST requests where a pagination parameter is detected. * @default true @@ -28,8 +28,8 @@ export interface PluginConfig extends PluginDefinition { queryOptions?: boolean; } -export interface UserConfig - extends Pick< - PluginConfig, - 'infiniteQueryOptions' | 'mutationOptions' | 'name' | 'queryOptions' - > {} +export interface PluginConfig extends Config { + handler: PluginHandler; +} + +export interface UserConfig extends Omit {} diff --git a/packages/openapi-ts/src/plugins/@tanstack/svelte-query/types.ts b/packages/openapi-ts/src/plugins/@tanstack/svelte-query/types.ts index 6792c663d..7549daf79 100644 --- a/packages/openapi-ts/src/plugins/@tanstack/svelte-query/types.ts +++ b/packages/openapi-ts/src/plugins/@tanstack/svelte-query/types.ts @@ -1,6 +1,6 @@ -import type { PluginDefinition } from '../../types'; +import type { PluginHandler } from '../../types'; -export interface PluginConfig extends PluginDefinition { +interface Config { /** * Generate `createInfiniteQuery()` helpers? These will be generated from GET and POST requests where a pagination parameter is detected. * @default true @@ -28,8 +28,8 @@ export interface PluginConfig extends PluginDefinition { queryOptions?: boolean; } -export interface UserConfig - extends Pick< - PluginConfig, - 'infiniteQueryOptions' | 'mutationOptions' | 'name' | 'queryOptions' - > {} +export interface PluginConfig extends Config { + handler: PluginHandler; +} + +export interface UserConfig extends Omit {} diff --git a/packages/openapi-ts/src/plugins/@tanstack/vue-query/types.ts b/packages/openapi-ts/src/plugins/@tanstack/vue-query/types.ts index 70441c31c..27b0530aa 100644 --- a/packages/openapi-ts/src/plugins/@tanstack/vue-query/types.ts +++ b/packages/openapi-ts/src/plugins/@tanstack/vue-query/types.ts @@ -1,6 +1,6 @@ -import type { PluginDefinition } from '../../types'; +import type { PluginHandler } from '../../types'; -export interface PluginConfig extends PluginDefinition { +interface Config { /** * Generate {@link https://tanstack.com/query/v5/docs/framework/vue/reference/infiniteQueryOptions `infiniteQueryOptions()`} helpers? These will be generated from GET and POST requests where a pagination parameter is detected. * @default true @@ -28,8 +28,8 @@ export interface PluginConfig extends PluginDefinition { queryOptions?: boolean; } -export interface UserConfig - extends Pick< - PluginConfig, - 'infiniteQueryOptions' | 'mutationOptions' | 'name' | 'queryOptions' - > {} +export interface PluginConfig extends Config { + handler: PluginHandler; +} + +export interface UserConfig extends Omit {} diff --git a/packages/openapi-ts/src/plugins/index.ts b/packages/openapi-ts/src/plugins/index.ts index 48c6834a7..2399765b1 100644 --- a/packages/openapi-ts/src/plugins/index.ts +++ b/packages/openapi-ts/src/plugins/index.ts @@ -31,6 +31,11 @@ import { type UserConfig as TanStackVueQuery, } from './@tanstack/vue-query'; import type { DefaultPluginConfigsMap } from './types'; +import { + defaultConfig as zodDefaultConfig, + type PluginConfig as PluginZod, + // type UserConfig as Zod, +} from './zod'; /** * User-facing plugin types. @@ -40,6 +45,7 @@ export type UserPlugins = | TanStackSolidQuery | TanStackSvelteQuery | TanStackVueQuery; +// | Zod export type ClientPlugins = | PluginHeyApiSchemas @@ -48,7 +54,8 @@ export type ClientPlugins = | PluginTanStackReactQuery | PluginTanStackSolidQuery | PluginTanStackSvelteQuery - | PluginTanStackVueQuery; + | PluginTanStackVueQuery + | PluginZod; export const defaultPluginConfigs: DefaultPluginConfigsMap = { '@hey-api/schemas': heyApiSchemasDefaultConfig, @@ -58,4 +65,5 @@ export const defaultPluginConfigs: DefaultPluginConfigsMap = { '@tanstack/solid-query': tanStackSolidQueryDefaultConfig, '@tanstack/svelte-query': tanStackSvelteQueryDefaultConfig, '@tanstack/vue-query': tanStackVueQueryDefaultConfig, + zod: zodDefaultConfig, }; diff --git a/packages/openapi-ts/src/plugins/types.ts b/packages/openapi-ts/src/plugins/types.ts index bfc9bc0d1..c9f3cfae3 100644 --- a/packages/openapi-ts/src/plugins/types.ts +++ b/packages/openapi-ts/src/plugins/types.ts @@ -1,16 +1,11 @@ import type { Client } from '../types/client'; -import type { Config } from '../types/config'; import type { Files } from '../types/utils'; -export interface PluginDefinition { - handler: (args: { - client: Client; - files: Files; - plugin: Config['plugins'][number]; - }) => void; - name: string; - output?: string; -} +export type PluginHandler = (args: { + client: Client; + files: Files; + plugin: Omit, 'handler'>; +}) => void; type KeyTypes = string | number | symbol; @@ -24,5 +19,9 @@ export type DefaultPluginConfigsMap< T, U extends KeyTypes = ExtractFromPluginConfig, > = { - [K in U]: Required> & PluginDefinition; + [K in U]: { + handler: PluginHandler>>; + name: string; + output?: string; + }; }; diff --git a/packages/openapi-ts/src/plugins/zod/config.ts b/packages/openapi-ts/src/plugins/zod/config.ts new file mode 100644 index 000000000..61ee8f763 --- /dev/null +++ b/packages/openapi-ts/src/plugins/zod/config.ts @@ -0,0 +1,8 @@ +import { handler } from './plugin'; +import type { PluginConfig } from './types'; + +export const defaultConfig: Required = { + handler, + name: 'zod', + output: 'zod', +}; diff --git a/packages/openapi-ts/src/plugins/zod/index.ts b/packages/openapi-ts/src/plugins/zod/index.ts new file mode 100644 index 000000000..1e7c3077f --- /dev/null +++ b/packages/openapi-ts/src/plugins/zod/index.ts @@ -0,0 +1,13 @@ +import { defaultConfig } from './config'; +import type { PluginConfig, UserConfig } from './types'; + +export { defaultConfig } from './config'; +export type { PluginConfig, UserConfig } from './types'; + +/** + * Type helper for Zod plugin, returns {@link PluginConfig} object + */ +export const defineConfig = (config?: UserConfig): PluginConfig => ({ + ...defaultConfig, + ...config, +}); diff --git a/packages/openapi-ts/src/plugins/zod/plugin.ts b/packages/openapi-ts/src/plugins/zod/plugin.ts new file mode 100644 index 000000000..1d98afbb5 --- /dev/null +++ b/packages/openapi-ts/src/plugins/zod/plugin.ts @@ -0,0 +1,6 @@ +import type { PluginHandler } from '../types'; +import type { PluginConfig } from './types'; + +export const handler: PluginHandler = ({ plugin }) => { + console.warn(plugin); +}; diff --git a/packages/openapi-ts/src/plugins/zod/types.ts b/packages/openapi-ts/src/plugins/zod/types.ts new file mode 100644 index 000000000..c20240657 --- /dev/null +++ b/packages/openapi-ts/src/plugins/zod/types.ts @@ -0,0 +1,19 @@ +import type { PluginHandler } from '../types'; + +interface Config { + /** + * Generate Zod output from the provided input. + */ + name: 'zod'; + /** + * Name of the generated file. + * @default 'zod' + */ + output?: string; +} + +export interface PluginConfig extends Config { + handler: PluginHandler; +} + +export interface UserConfig extends Omit {} diff --git a/packages/openapi-ts/test/sample.cjs b/packages/openapi-ts/test/sample.cjs index 5b50abbe4..d5c394e33 100644 --- a/packages/openapi-ts/test/sample.cjs +++ b/packages/openapi-ts/test/sample.cjs @@ -4,7 +4,7 @@ const main = async () => { /** @type {import('../src').UserConfig} */ const config = { client: { - bundle: true, + // bundle: true, // name: '@hey-api/client-axios', name: '@hey-api/client-fetch', }, @@ -20,13 +20,9 @@ const main = async () => { path: './test/generated/sample/', }, plugins: [ - { - // infiniteQueryOptions: false, - // mutationOptions: false, - name: '@tanstack/react-query', - // queryOptions: false, - }, + // '@tanstack/react-query', // '@hey-api/services', + 'zod', ], schemas: { export: false, -- 2.51.2 From f69d916307f7484264d0bc7467f585e154846a3d Mon Sep 17 00:00:00 2001 From: Stian Jensen Date: Sun, 6 Oct 2024 15:16:32 +0200 Subject: [PATCH 48/49] Upgrade to c12 2.x No breaking changes, but a lot of upgraded dependency versions. https://github.com/unjs/c12/blob/main/CHANGELOG.md --- packages/openapi-ts/package.json | 2 +- packages/openapi-ts/src/index.ts | 3 - pnpm-lock.yaml | 147 +++++++++++++++++-------------- 3 files changed, 81 insertions(+), 71 deletions(-) diff --git a/packages/openapi-ts/package.json b/packages/openapi-ts/package.json index e298a0fbd..a46809c29 100644 --- a/packages/openapi-ts/package.json +++ b/packages/openapi-ts/package.json @@ -72,7 +72,7 @@ }, "dependencies": { "@apidevtools/json-schema-ref-parser": "11.7.0", - "c12": "1.11.2", + "c12": "2.0.1", "commander": "12.1.0", "handlebars": "4.7.8" }, diff --git a/packages/openapi-ts/src/index.ts b/packages/openapi-ts/src/index.ts index 126687956..3519fb843 100644 --- a/packages/openapi-ts/src/index.ts +++ b/packages/openapi-ts/src/index.ts @@ -220,9 +220,6 @@ const initConfigs = async (userConfig: UserConfig): Promise => { const { config: configFromFile } = await loadConfig({ configFile: configurationFile, - jitiOptions: { - esmResolve: true, - }, name: 'openapi-ts', }); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b4baad027..9192a8fb8 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -58,7 +58,7 @@ importers: version: 3.3.2 tsup: specifier: 8.3.0 - version: 8.3.0(@microsoft/api-extractor@7.47.9(@types/node@20.14.10))(jiti@1.21.6)(postcss@8.4.47)(tsx@4.19.1)(typescript@5.5.3)(yaml@2.4.5) + version: 8.3.0(@microsoft/api-extractor@7.47.9(@types/node@20.14.10))(jiti@2.3.1)(postcss@8.4.47)(tsx@4.19.1)(typescript@5.5.3)(yaml@2.4.5) typescript: specifier: 5.5.3 version: 5.5.3 @@ -466,8 +466,8 @@ importers: specifier: 11.7.0 version: 11.7.0 c12: - specifier: 1.11.2 - version: 1.11.2(magicast@0.3.4) + specifier: 2.0.1 + version: 2.0.1 commander: specifier: 12.1.0 version: 12.1.0 @@ -4245,10 +4245,10 @@ packages: resolution: {integrity: sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==} engines: {node: '>= 0.8'} - c12@1.11.2: - resolution: {integrity: sha512-oBs8a4uvSDO9dm8b7OCFW7+dgtVrwmwnrVXYzLm43ta7ep2jCn/0MhoUFygIWtxhyy6+/MG7/agvpY0U1Iemew==} + c12@2.0.1: + resolution: {integrity: sha512-Z4JgsKXHG37C6PYUtIxCfLJZvo6FyhHJoClwwb9ftUkLpPSkuYqn6Tr+vnaN8hymm0kIbcg6Ey3kv/Q71k5w/A==} peerDependencies: - magicast: ^0.3.4 + magicast: ^0.3.5 peerDependenciesMeta: magicast: optional: true @@ -4325,6 +4325,10 @@ packages: resolution: {integrity: sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==} engines: {node: '>= 8.10.0'} + chokidar@4.0.1: + resolution: {integrity: sha512-n8enUVCED/KVRQlab1hr3MVpcVMvxtZjmEa956u+4YijlmQED223XMSYj2tLuKvr4jcCTzNNMpQDUer72MMmzA==} + engines: {node: '>= 14.16.0'} + chownr@2.0.0: resolution: {integrity: sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==} engines: {node: '>=10'} @@ -5711,6 +5715,10 @@ packages: resolution: {integrity: sha512-2yTgeWTWzMWkHu6Jp9NKgePDaYHbntiwvYuuJLbbN9vl7DC9DvXKOB2BC3ZZ92D3cvV/aflH0osDfwpHepQ53w==} hasBin: true + jiti@2.3.1: + resolution: {integrity: sha512-xPZ6pPzUifI8XDBBxIL4OB1w1ZKmBpmNEeKwNt2d0Spn8XisAIZhWrlOHq5seBrFGTxVx9PbrWvEMyrk4IO5bA==} + hasBin: true + jju@1.4.0: resolution: {integrity: sha512-8wb9Yw966OSxApiCt0K3yNJL8pnNeIv+OEq2YMidz4FKP6nonSRoOXc80iXY4JaN2FC11B9qsNmDsm+ZOfMROA==} @@ -6337,8 +6345,8 @@ packages: obuf@1.1.2: resolution: {integrity: sha512-PX1wu0AmAdPqOL1mWhqmlOd8kOIZQwGZw6rh7uby9fTc5lhaOWFLX3I6R1hrF9k3zUY40e6igsLGkDXK92LJNg==} - ohash@1.1.3: - resolution: {integrity: sha512-zuHHiGTYTA1sYJ/wZN+t5HKZaH23i4yI1HMwbuXm24Nid7Dv0KcuRlKoNKS9UNfAVSBlnGLcuQrnOKWOZoEGaw==} + ohash@1.1.4: + resolution: {integrity: sha512-FlDryZAahJmEF3VR3w1KogSEdWX3WhA5GPakFx4J81kEAiHyLMpdLLElS8n8dfNadMgAne/MywcvmogzscVt4g==} on-finished@2.4.1: resolution: {integrity: sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==} @@ -6593,9 +6601,6 @@ packages: resolution: {integrity: sha512-Ie9z/WINcxxLp27BKOCHGde4ITq9UklYKDzVo1nhk5sqGEXU3FpkwP5GM2voTGJkGd9B3Otl+Q4uwSOeSUtOBA==} engines: {node: '>=14.16'} - pkg-types@1.1.1: - resolution: {integrity: sha512-ko14TjmDuQJ14zsotODv7dBlwxKhUKQEhuhmbqo1uCi9BB0Z2alo/wAXg6q1dTR5TyuqYyWhjtfe/Tsh+X28jQ==} - pkg-types@1.2.0: resolution: {integrity: sha512-+ifYuSSqOQ8CqP4MbZA5hDpb97n3E8SVWdJe+Wms9kj745lmd3b7EZJiqvmLwAlmRfjrI7Hi5z3kdBJ93lFNPA==} @@ -6940,6 +6945,10 @@ packages: resolution: {integrity: sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==} engines: {node: '>=8.10.0'} + readdirp@4.0.2: + resolution: {integrity: sha512-yDMz9g+VaZkqBYS/ozoBJwaBhTbZo3UNYQHNRw1D3UFQB8oHB4uS/tAODO+ZLjGWmUbKnIlOWO+aaIiAxrUWHA==} + engines: {node: '>= 14.16.0'} + reflect-metadata@0.2.2: resolution: {integrity: sha512-urBwgfrvVP/eAyXx4hluJivBKzuEbSQs9rKWCrCkbSxNv8mxPcUZKeuoF3Uy4mJl3Lwprp6yy5/39VWigZ4K6Q==} @@ -8509,7 +8518,7 @@ snapshots: dependencies: '@ampproject/remapping': 2.3.0 '@angular-devkit/architect': 0.1703.7(chokidar@3.6.0) - '@angular-devkit/build-webpack': 0.1703.7(chokidar@3.6.0)(webpack-dev-server@4.15.1(webpack@5.90.3(esbuild@0.23.1)))(webpack@5.90.3(esbuild@0.20.1)) + '@angular-devkit/build-webpack': 0.1703.7(chokidar@3.6.0)(webpack-dev-server@4.15.1(webpack@5.90.3(esbuild@0.20.1)))(webpack@5.90.3(esbuild@0.20.1)) '@angular-devkit/core': 17.3.7(chokidar@3.6.0) '@angular/compiler-cli': 17.3.9(@angular/compiler@17.3.9(@angular/core@17.3.9(rxjs@7.8.1)(zone.js@0.14.7)))(typescript@5.5.3) '@babel/core': 7.24.0 @@ -8567,9 +8576,9 @@ snapshots: undici: 6.11.1 vite: 5.1.7(@types/node@20.14.10)(less@4.2.0)(sass@1.71.1)(terser@5.29.1) watchpack: 2.4.0 - webpack: 5.90.3(esbuild@0.20.1) + webpack: 5.90.3(esbuild@0.23.1) webpack-dev-middleware: 6.1.2(webpack@5.90.3(esbuild@0.20.1)) - webpack-dev-server: 4.15.1(webpack@5.90.3(esbuild@0.23.1)) + webpack-dev-server: 4.15.1(webpack@5.90.3(esbuild@0.20.1)) webpack-merge: 5.10.0 webpack-subresource-integrity: 5.1.0(webpack@5.90.3(esbuild@0.20.1)) optionalDependencies: @@ -8594,12 +8603,12 @@ snapshots: - utf-8-validate - webpack-cli - '@angular-devkit/build-webpack@0.1703.7(chokidar@3.6.0)(webpack-dev-server@4.15.1(webpack@5.90.3(esbuild@0.23.1)))(webpack@5.90.3(esbuild@0.20.1))': + '@angular-devkit/build-webpack@0.1703.7(chokidar@3.6.0)(webpack-dev-server@4.15.1(webpack@5.90.3(esbuild@0.20.1)))(webpack@5.90.3(esbuild@0.20.1))': dependencies: '@angular-devkit/architect': 0.1703.7(chokidar@3.6.0) rxjs: 7.8.1 - webpack: 5.90.3(esbuild@0.20.1) - webpack-dev-server: 4.15.1(webpack@5.90.3(esbuild@0.23.1)) + webpack: 5.90.3(esbuild@0.23.1) + webpack-dev-server: 4.15.1(webpack@5.90.3(esbuild@0.20.1)) transitivePeerDependencies: - chokidar @@ -10409,7 +10418,7 @@ snapshots: dependencies: '@angular/compiler-cli': 17.3.9(@angular/compiler@17.3.9(@angular/core@17.3.9(rxjs@7.8.1)(zone.js@0.14.7)))(typescript@5.5.3) typescript: 5.5.3 - webpack: 5.90.3(esbuild@0.20.1) + webpack: 5.90.3(esbuild@0.23.1) '@nodelib/fs.scandir@2.1.5': dependencies: @@ -12320,9 +12329,9 @@ snapshots: mime-types: 2.1.35 negotiator: 0.6.3 - acorn-import-assertions@1.9.0(acorn@8.12.0): + acorn-import-assertions@1.9.0(acorn@8.12.1): dependencies: - acorn: 8.12.0 + acorn: 8.12.1 acorn-jsx@5.3.2(acorn@7.4.1): dependencies: @@ -12332,6 +12341,10 @@ snapshots: dependencies: acorn: 8.12.0 + acorn-jsx@5.3.2(acorn@8.12.1): + dependencies: + acorn: 8.12.1 + acorn-walk@8.3.3: dependencies: acorn: 8.12.1 @@ -12548,7 +12561,7 @@ snapshots: '@babel/core': 7.24.0 find-cache-dir: 4.0.0 schema-utils: 4.2.0 - webpack: 5.90.3(esbuild@0.20.1) + webpack: 5.90.3(esbuild@0.23.1) babel-plugin-istanbul@6.1.1: dependencies: @@ -12706,22 +12719,20 @@ snapshots: bytes@3.1.2: {} - c12@1.11.2(magicast@0.3.4): + c12@2.0.1: dependencies: - chokidar: 3.6.0 + chokidar: 4.0.1 confbox: 0.1.7 defu: 6.1.4 dotenv: 16.4.5 giget: 1.2.3 - jiti: 1.21.6 + jiti: 2.3.1 mlly: 1.7.1 - ohash: 1.1.3 + ohash: 1.1.4 pathe: 1.1.2 perfect-debounce: 1.0.0 pkg-types: 1.2.0 rc9: 2.1.2 - optionalDependencies: - magicast: 0.3.4 cac@6.7.14: {} @@ -12813,6 +12824,10 @@ snapshots: optionalDependencies: fsevents: 2.3.3 + chokidar@4.0.1: + dependencies: + readdirp: 4.0.2 + chownr@2.0.0: {} chrome-trace-event@1.0.4: {} @@ -12892,7 +12907,7 @@ snapshots: dependencies: '@jridgewell/sourcemap-codec': 1.5.0 '@types/estree': 1.0.5 - acorn: 8.12.0 + acorn: 8.12.1 estree-walker: 3.0.3 periscopic: 3.1.0 @@ -12985,7 +13000,7 @@ snapshots: normalize-path: 3.0.0 schema-utils: 4.2.0 serialize-javascript: 6.0.2 - webpack: 5.90.3(esbuild@0.20.1) + webpack: 5.90.3(esbuild@0.23.1) core-js-compat@3.37.1: dependencies: @@ -13037,7 +13052,7 @@ snapshots: postcss-value-parser: 4.2.0 semver: 7.6.2 optionalDependencies: - webpack: 5.90.3(esbuild@0.20.1) + webpack: 5.90.3(esbuild@0.23.1) css-select@5.1.0: dependencies: @@ -13597,8 +13612,8 @@ snapshots: espree@10.1.0: dependencies: - acorn: 8.12.0 - acorn-jsx: 5.3.2(acorn@8.12.0) + acorn: 8.12.1 + acorn-jsx: 5.3.2(acorn@8.12.1) eslint-visitor-keys: 4.0.0 espree@6.2.1: @@ -13928,7 +13943,7 @@ snapshots: defu: 6.1.4 node-fetch-native: 1.6.4 nypm: 0.3.8 - ohash: 1.1.3 + ohash: 1.1.4 pathe: 1.1.2 tar: 6.2.1 @@ -14337,6 +14352,8 @@ snapshots: jiti@1.21.6: {} + jiti@2.3.1: {} + jju@1.4.0: optional: true @@ -14456,7 +14473,7 @@ snapshots: dependencies: klona: 2.0.6 less: 4.2.0 - webpack: 5.90.3(esbuild@0.20.1) + webpack: 5.90.3(esbuild@0.23.1) less@4.2.0: dependencies: @@ -14481,7 +14498,7 @@ snapshots: dependencies: webpack-sources: 3.2.3 optionalDependencies: - webpack: 5.90.3(esbuild@0.20.1) + webpack: 5.90.3(esbuild@0.23.1) lilconfig@2.1.0: {} @@ -14528,7 +14545,7 @@ snapshots: local-pkg@0.5.0: dependencies: mlly: 1.7.1 - pkg-types: 1.1.1 + pkg-types: 1.2.0 locate-character@3.0.0: {} @@ -14700,7 +14717,7 @@ snapshots: dependencies: schema-utils: 4.2.0 tapable: 2.2.1 - webpack: 5.90.3(esbuild@0.20.1) + webpack: 5.90.3(esbuild@0.23.1) minimalistic-assert@1.0.1: {} @@ -14777,7 +14794,7 @@ snapshots: mlly@1.7.1: dependencies: - acorn: 8.12.0 + acorn: 8.12.1 pathe: 1.1.2 pkg-types: 1.2.0 ufo: 1.5.3 @@ -14977,7 +14994,7 @@ snapshots: obuf@1.1.2: {} - ohash@1.1.3: {} + ohash@1.1.4: {} on-finished@2.4.1: dependencies: @@ -15236,12 +15253,6 @@ snapshots: dependencies: find-up: 6.3.0 - pkg-types@1.1.1: - dependencies: - confbox: 0.1.7 - mlly: 1.7.1 - pathe: 1.1.2 - pkg-types@1.2.0: dependencies: confbox: 0.1.7 @@ -15284,11 +15295,11 @@ snapshots: postcss: 8.4.39 ts-node: 10.9.2(@types/node@20.14.5)(typescript@5.5.3) - postcss-load-config@6.0.1(jiti@1.21.6)(postcss@8.4.47)(tsx@4.19.1)(yaml@2.4.5): + postcss-load-config@6.0.1(jiti@2.3.1)(postcss@8.4.47)(tsx@4.19.1)(yaml@2.4.5): dependencies: lilconfig: 3.1.2 optionalDependencies: - jiti: 1.21.6 + jiti: 2.3.1 postcss: 8.4.47 tsx: 4.19.1 yaml: 2.4.5 @@ -15300,7 +15311,7 @@ snapshots: postcss: 8.4.35 semver: 7.6.2 optionalDependencies: - webpack: 5.90.3(esbuild@0.20.1) + webpack: 5.90.3(esbuild@0.23.1) transitivePeerDependencies: - typescript @@ -15590,6 +15601,8 @@ snapshots: dependencies: picomatch: 2.3.1 + readdirp@4.0.2: {} + reflect-metadata@0.2.2: {} regenerate-unicode-properties@10.1.1: @@ -15758,7 +15771,7 @@ snapshots: neo-async: 2.6.2 optionalDependencies: sass: 1.71.1 - webpack: 5.90.3(esbuild@0.20.1) + webpack: 5.90.3(esbuild@0.23.1) sass@1.71.1: dependencies: @@ -15992,7 +16005,7 @@ snapshots: dependencies: iconv-lite: 0.6.3 source-map-js: 1.2.0 - webpack: 5.90.3(esbuild@0.20.1) + webpack: 5.90.3(esbuild@0.23.1) source-map-support@0.5.21: dependencies: @@ -16349,21 +16362,21 @@ snapshots: term-size@2.2.1: {} - terser-webpack-plugin@5.3.10(esbuild@0.20.1)(webpack@5.90.3(esbuild@0.23.1)): + terser-webpack-plugin@5.3.10(esbuild@0.23.1)(webpack@5.90.3(esbuild@0.20.1)): dependencies: '@jridgewell/trace-mapping': 0.3.25 jest-worker: 27.5.1 schema-utils: 3.3.0 serialize-javascript: 6.0.2 terser: 5.29.1 - webpack: 5.90.3(esbuild@0.20.1) + webpack: 5.90.3(esbuild@0.23.1) optionalDependencies: - esbuild: 0.20.1 + esbuild: 0.23.1 terser@5.29.1: dependencies: '@jridgewell/source-map': 0.3.6 - acorn: 8.12.0 + acorn: 8.12.1 commander: 2.20.3 source-map-support: 0.5.21 @@ -16501,7 +16514,7 @@ snapshots: tslib@2.6.3: {} - tsup@8.3.0(@microsoft/api-extractor@7.47.9(@types/node@20.14.10))(jiti@1.21.6)(postcss@8.4.47)(tsx@4.19.1)(typescript@5.5.3)(yaml@2.4.5): + tsup@8.3.0(@microsoft/api-extractor@7.47.9(@types/node@20.14.10))(jiti@2.3.1)(postcss@8.4.47)(tsx@4.19.1)(typescript@5.5.3)(yaml@2.4.5): dependencies: bundle-require: 5.0.0(esbuild@0.23.1) cac: 6.7.14 @@ -16512,7 +16525,7 @@ snapshots: execa: 5.1.1 joycon: 3.1.1 picocolors: 1.0.1 - postcss-load-config: 6.0.1(jiti@1.21.6)(postcss@8.4.47)(tsx@4.19.1)(yaml@2.4.5) + postcss-load-config: 6.0.1(jiti@2.3.1)(postcss@8.4.47)(tsx@4.19.1)(yaml@2.4.5) resolve-from: 5.0.0 rollup: 4.22.0 source-map: 0.8.0-beta.0 @@ -17072,14 +17085,14 @@ snapshots: webidl-conversions@7.0.0: {} - webpack-dev-middleware@5.3.4(webpack@5.90.3(esbuild@0.23.1)): + webpack-dev-middleware@5.3.4(webpack@5.90.3(esbuild@0.20.1)): dependencies: colorette: 2.0.20 memfs: 3.5.3 mime-types: 2.1.35 range-parser: 1.2.1 schema-utils: 4.2.0 - webpack: 5.90.3(esbuild@0.20.1) + webpack: 5.90.3(esbuild@0.23.1) webpack-dev-middleware@6.1.2(webpack@5.90.3(esbuild@0.20.1)): dependencies: @@ -17089,9 +17102,9 @@ snapshots: range-parser: 1.2.1 schema-utils: 4.2.0 optionalDependencies: - webpack: 5.90.3(esbuild@0.20.1) + webpack: 5.90.3(esbuild@0.23.1) - webpack-dev-server@4.15.1(webpack@5.90.3(esbuild@0.23.1)): + webpack-dev-server@4.15.1(webpack@5.90.3(esbuild@0.20.1)): dependencies: '@types/bonjour': 3.5.13 '@types/connect-history-api-fallback': 1.5.4 @@ -17121,10 +17134,10 @@ snapshots: serve-index: 1.9.1 sockjs: 0.3.24 spdy: 4.0.2 - webpack-dev-middleware: 5.3.4(webpack@5.90.3(esbuild@0.23.1)) + webpack-dev-middleware: 5.3.4(webpack@5.90.3(esbuild@0.20.1)) ws: 8.17.1 optionalDependencies: - webpack: 5.90.3(esbuild@0.20.1) + webpack: 5.90.3(esbuild@0.23.1) transitivePeerDependencies: - bufferutil - debug @@ -17142,17 +17155,17 @@ snapshots: webpack-subresource-integrity@5.1.0(webpack@5.90.3(esbuild@0.20.1)): dependencies: typed-assert: 1.0.9 - webpack: 5.90.3(esbuild@0.20.1) + webpack: 5.90.3(esbuild@0.23.1) - webpack@5.90.3(esbuild@0.20.1): + webpack@5.90.3(esbuild@0.23.1): dependencies: '@types/eslint-scope': 3.7.7 '@types/estree': 1.0.5 '@webassemblyjs/ast': 1.12.1 '@webassemblyjs/wasm-edit': 1.12.1 '@webassemblyjs/wasm-parser': 1.12.1 - acorn: 8.12.0 - acorn-import-assertions: 1.9.0(acorn@8.12.0) + acorn: 8.12.1 + acorn-import-assertions: 1.9.0(acorn@8.12.1) browserslist: 4.23.1 chrome-trace-event: 1.0.4 enhanced-resolve: 5.17.0 @@ -17167,7 +17180,7 @@ snapshots: neo-async: 2.6.2 schema-utils: 3.3.0 tapable: 2.2.1 - terser-webpack-plugin: 5.3.10(esbuild@0.20.1)(webpack@5.90.3(esbuild@0.23.1)) + terser-webpack-plugin: 5.3.10(esbuild@0.23.1)(webpack@5.90.3(esbuild@0.20.1)) watchpack: 2.4.0 webpack-sources: 3.2.3 transitivePeerDependencies: -- 2.51.2 From fa7de995aece8dd20a472e3a2e871a19c68dab03 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sun, 6 Oct 2024 17:25:35 +0000 Subject: [PATCH 49/49] Version Packages --- .changeset/gentle-ladybugs-yawn.md | 5 ----- packages/openapi-ts/CHANGELOG.md | 6 ++++++ packages/openapi-ts/package.json | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) delete mode 100644 .changeset/gentle-ladybugs-yawn.md diff --git a/.changeset/gentle-ladybugs-yawn.md b/.changeset/gentle-ladybugs-yawn.md deleted file mode 100644 index 599bf2fa7..000000000 --- a/.changeset/gentle-ladybugs-yawn.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@hey-api/openapi-ts': patch ---- - -fix: use correct relative path to bundled client when imported from nested module diff --git a/packages/openapi-ts/CHANGELOG.md b/packages/openapi-ts/CHANGELOG.md index bb9162e40..e9126252e 100644 --- a/packages/openapi-ts/CHANGELOG.md +++ b/packages/openapi-ts/CHANGELOG.md @@ -1,5 +1,11 @@ # @hey-api/openapi-ts +## 0.53.8 + +### Patch Changes + +- [#1123](https://github.com/hey-api/openapi-ts/pull/1123) [`032338c`](https://github.com/hey-api/openapi-ts/commit/032338c47506ccfd567bbbf915398942c8394bc2) Thanks [@mrlubos](https://github.com/mrlubos)! - fix: use correct relative path to bundled client when imported from nested module + ## 0.53.7 ### Patch Changes diff --git a/packages/openapi-ts/package.json b/packages/openapi-ts/package.json index a46809c29..fb79f1f7b 100644 --- a/packages/openapi-ts/package.json +++ b/packages/openapi-ts/package.json @@ -1,6 +1,6 @@ { "name": "@hey-api/openapi-ts", - "version": "0.53.7", + "version": "0.53.8", "description": "Turn your OpenAPI specification into a beautiful TypeScript client", "homepage": "https://heyapi.vercel.app/", "repository": {