Skip to content

Commit

Permalink
fix: build of @kubb/core with correct types
Browse files Browse the repository at this point in the history
  • Loading branch information
stijnvanhulle committed Jan 15, 2025
1 parent f25bc02 commit 967efeb
Show file tree
Hide file tree
Showing 68 changed files with 860 additions and 561 deletions.
5 changes: 5 additions & 0 deletions .changeset/clever-plants-approve.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@kubb/core": patch
---

build of `@kubb/core` with correct types
3 changes: 3 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ title: Changelog

# Changelog

## 3.5.1
- [`core`](/plugins/core): build of `@kubb/core` with correct types

## 3.5.0
- [`core`](/plugins/core): support banner with context for Oas
```typescript
Expand Down
6 changes: 3 additions & 3 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@
"serve": "vitepress serve"
},
"dependencies": {
"@shikijs/vitepress-twoslash": "^1.26.1",
"@shikijs/vitepress-twoslash": "^1.27.2",
"mermaid": "^11.4.1",
"sitemap": "^8.0.0",
"vitepress": "^1.5.0",
"vitepress-plugin-group-icons": "^1.3.3",
"vitepress-plugin-group-icons": "^1.3.4",
"vue": "^3.5.13"
},
"devDependencies": {
Expand All @@ -44,7 +44,7 @@
"@kubb/plugin-zod": "workspace:*",
"@kubb/react": "workspace:*",
"@mermaid-js/mermaid-cli": "^11.4.2",
"@types/node": "^20.17.12",
"@types/node": "^20.17.13",
"@types/react": "catalog:",
"cross-env": "^7.0.3",
"react": "catalog:",
Expand Down
8 changes: 4 additions & 4 deletions e2e/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@
"@kubb/plugin-ts": "workspace:*",
"@kubb/plugin-zod": "workspace:*",
"@kubb/react": "workspace:*",
"@tanstack/react-query": "^5.63.0",
"@tanstack/solid-query": "^5.62.16",
"@tanstack/svelte-query": "^5.62.16",
"@tanstack/vue-query": "^5.62.16",
"@tanstack/react-query": "^5.64.1",
"@tanstack/solid-query": "^5.64.1",
"@tanstack/svelte-query": "^5.64.1",
"@tanstack/vue-query": "^5.64.1",
"axios": "^1.7.9",
"msw": "^2.7.0",
"react": "catalog:",
Expand Down
12 changes: 6 additions & 6 deletions examples/advanced/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@
"@kubb/plugin-ts": "workspace:*",
"@kubb/plugin-zod": "workspace:*",
"@kubb/react": "workspace:*",
"@tanstack/query-core": "^5.62.16",
"@tanstack/react-query": "^5.63.0",
"@tanstack/solid-query": "^5.62.16",
"@tanstack/svelte-query": "^5.62.16",
"@tanstack/vue-query": "^5.62.16",
"@types/react": "^19.0.4",
"@tanstack/query-core": "^5.64.1",
"@tanstack/react-query": "^5.64.1",
"@tanstack/solid-query": "^5.64.1",
"@tanstack/svelte-query": "^5.64.1",
"@tanstack/vue-query": "^5.64.1",
"@types/react": "^19.0.7",
"axios": "^1.7.9",
"msw": "^2.7.0",
"react": "^19.0.0",
Expand Down
27 changes: 27 additions & 0 deletions examples/client/build.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { build, getSource } from '@kubb/core'
import { write } from '@kubb/fs'
import { pluginClient } from '@kubb/plugin-client'
import { pluginOas } from '@kubb/plugin-oas'

async function run() {
const { files } = await build({
config: {
root: '.',
input: {
data: '',
},
output: {
path: './gen',
},
plugins: [pluginOas(), pluginClient()],
},
})

for (const file of files) {
const source = await getSource(file)

await write(source, file.path)
}
}

run()
3 changes: 2 additions & 1 deletion examples/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
},
"devDependencies": {
"@kubb/config-ts": "workspace:*",
"@types/react": "^19.0.4",
"@kubb/fs": "^3.5.0",
"@types/react": "^19.0.7",
"react": "^19.0.0",
"tsup": "^8.3.5",
"typescript": "^5.7.3"
Expand Down
2 changes: 1 addition & 1 deletion examples/generators/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
},
"devDependencies": {
"@kubb/config-ts": "workspace:*",
"@types/react": "^19.0.4",
"@types/react": "^19.0.7",
"react": "^19.0.0",
"tsup": "^8.3.5",
"typescript": "^5.7.3"
Expand Down
6 changes: 3 additions & 3 deletions examples/react-query/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,16 @@
"@kubb/plugin-react-query": "workspace:*",
"@kubb/plugin-ts": "workspace:*",
"@kubb/react": "workspace:*",
"@tanstack/react-query": "^5.63.0",
"@tanstack/react-query-devtools": "^5.63.0",
"@tanstack/react-query": "^5.64.1",
"@tanstack/react-query-devtools": "^5.64.1",
"axios": "^1.7.9",
"react": "^18.3.1",
"react-dom": "^19.0.0",
"unplugin-kubb": "workspace:*"
},
"devDependencies": {
"@types/react": "^18.3.18",
"@types/react-dom": "^19.0.2",
"@types/react-dom": "^19.0.3",
"@vitejs/plugin-react": "^4.3.4",
"msw": "^1.3.5",
"tsup": "^8.3.5",
Expand Down
2 changes: 1 addition & 1 deletion examples/simple-single/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"@kubb/plugin-redoc": "workspace:*",
"@kubb/plugin-ts": "workspace:*",
"@kubb/plugin-zod": "workspace:*",
"@tanstack/react-query": "^5.63.0",
"@tanstack/react-query": "^5.64.1",
"axios": "^1.7.9",
"react": "^18.3.1",
"tsup": "^8.3.5",
Expand Down
77 changes: 77 additions & 0 deletions examples/simple-single/src/gen2/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,15 @@ export const flyContainerConfigSchema = z.object({
.array(z.lazy(() => flyFileSchema))
.describe('Files are files that will be written to the container file system.')
.optional(),
healthchecks: z
.array(z.lazy(() => flyContainerHealthcheckSchema))
.describe('Healthchecks determine the health of your containers. Healthchecks can use HTTP, TCP or an Exec command.')
.optional(),
image: z.string().describe('Image is the docker image to run.').optional(),
mounts: z
.array(z.lazy(() => flyContainerMountSchema))
.describe('Set of mounts added to the container. These must reference a volume in the machine config via its name.')
.optional(),
name: z.string().describe('Name is used to identify the container in the machine.').optional(),
restart: z
.lazy(() => flyMachineRestartSchema)
Expand All @@ -290,6 +298,35 @@ export const flyContainerDependencySchema = z.object({

export const flyContainerDependencyConditionSchema = z.enum(['exited_successfully', 'healthy', 'started'])

export const flyContainerHealthcheckSchema = z.object({
exec: z.lazy(() => flyExecHealthcheckSchema).optional(),
failure_threshold: z.number().int().describe('The number of times the check must fail before considering the container unhealthy.').optional(),
grace_period: z.number().int().describe('The time in seconds to wait after a container starts before checking its health.').optional(),
http: z.lazy(() => flyHTTPHealthcheckSchema).optional(),
interval: z.number().int().describe('The time in seconds between executing the defined check.').optional(),
kind: z
.lazy(() => flyContainerHealthcheckKindSchema)
.describe('Kind of healthcheck (readiness, liveness)')
.optional(),
name: z.string().describe('The name of the check. Must be unique within the container.').optional(),
success_threshold: z.number().int().describe('The number of times the check must succeeed before considering the container healthy.').optional(),
tcp: z.lazy(() => flyTCPHealthcheckSchema).optional(),
timeout: z.number().int().describe('The time in seconds to wait for the check to complete.').optional(),
unhealthy: z
.lazy(() => flyUnhealthyPolicySchema)
.describe('Unhealthy policy that determines what action to take if a container is deemed unhealthy')
.optional(),
})

export const flyContainerHealthcheckKindSchema = z.enum(['readiness', 'liveness'])

export const flyContainerHealthcheckSchemeSchema = z.enum(['http', 'https'])

export const flyContainerMountSchema = z.object({
name: z.string().describe('The name of the volume. Must exist in the volumes field in the machine configuration').optional(),
path: z.string().describe('The path to mount the volume within the container').optional(),
})

export const flyDNSConfigSchema = z.object({
dns_forward_rules: z.array(z.lazy(() => flyDnsForwardRuleSchema)).optional(),
hostname: z.string().optional(),
Expand Down Expand Up @@ -322,6 +359,10 @@ export const flyEnvFromSchema = z
})
.describe('EnvVar defines an environment variable to be populated from a machine field, env_var')

export const flyExecHealthcheckSchema = z.object({
command: z.array(z.string()).describe('The command to run to check the health of the container (e.g. ["cat", "/tmp/healthy"])').optional(),
})

/**
* @description A file that will be written to the Machine. One of RawValue or SecretName must be set.
*/
Expand All @@ -337,6 +378,22 @@ export const flyFileSchema = z
})
.describe('A file that will be written to the Machine. One of RawValue or SecretName must be set.')

export const flyHTTPHealthcheckSchema = z.object({
headers: z
.array(z.lazy(() => flyMachineHTTPHeaderSchema))
.describe('Additional headers to send with the request')
.optional(),
method: z.string().describe('The HTTP method to use to when making the request').optional(),
path: z.string().describe('The path to send the request to').optional(),
port: z.number().int().describe('The port to connect to, often the same as internal_port').optional(),
scheme: z
.lazy(() => flyContainerHealthcheckSchemeSchema)
.describe('Whether to use http or https')
.optional(),
tls_server_name: z.string().describe('If the protocol is https, the hostname to use for TLS certificate validation').optional(),
tls_skip_verify: z.boolean().describe('If the protocol is https, whether or not to verify the TLS certificate').optional(),
})

export const flyHTTPOptionsSchema = z.object({
compress: z.boolean().optional(),
h2_backend: z.boolean().optional(),
Expand Down Expand Up @@ -410,6 +467,10 @@ export const flyMachineConfigSchema = z.object({
.optional(),
statics: z.array(z.lazy(() => flyStaticSchema)).optional(),
stop_config: z.lazy(() => flyStopConfigSchema).optional(),
volumes: z
.array(z.lazy(() => flyVolumeConfigSchema))
.describe('Volumes describe the set of volumes that can be attached to the machine. Used in conjuction\nwith containers')
.optional(),
})

export const flyMachineGuestSchema = z.object({
Expand Down Expand Up @@ -575,12 +636,28 @@ export const flyStopConfigSchema = z.object({
timeout: z.lazy(() => flyDurationSchema).optional(),
})

export const flyTCPHealthcheckSchema = z.object({
port: z.number().int().describe('The port to connect to, often the same as internal_port').optional(),
})

export const flyTLSOptionsSchema = z.object({
alpn: z.array(z.string()).optional(),
default_self_signed: z.boolean().optional(),
versions: z.array(z.string()).optional(),
})

export const flyTempDirVolumeSchema = z.object({
size_mb: z.number().int().describe('The size limit of the temp dir, only applicable when using disk backed storage.').optional(),
storage_type: z.string().describe('The type of storage used to back the temp dir. Either disk or memory.').optional(),
})

export const flyUnhealthyPolicySchema = z.enum(['stop'])

export const flyVolumeConfigSchema = z.object({
name: z.string().describe('The name of the volume. A volume must have a unique name within an app').optional(),
temp_dir: z.lazy(() => flyTempDirVolumeSchema).optional(),
})

export const flyDnsForwardRuleSchema = z.object({
addr: z.string().optional(),
basename: z.string().optional(),
Expand Down
2 changes: 1 addition & 1 deletion examples/vue-query/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"@kubb/plugin-ts": "workspace:*",
"@kubb/plugin-vue-query": "workspace:*",
"@kubb/plugin-zod": "workspace:*",
"@tanstack/vue-query": "^5.62.16",
"@tanstack/vue-query": "^5.64.1",
"axios": "^1.7.9",
"unplugin-kubb": "workspace:*",
"vue": "^3.5.13"
Expand Down
76 changes: 38 additions & 38 deletions examples/vue-query/src/gen/hooks/index.ts
Original file line number Diff line number Diff line change
@@ -1,38 +1,38 @@
export type { AddPetMutationKey } from './useAddPet'
export type { CreateUserMutationKey } from './useCreateUser'
export type { CreateUsersWithListInputMutationKey } from './useCreateUsersWithListInput'
export type { DeleteOrderMutationKey } from './useDeleteOrder'
export type { DeletePetMutationKey } from './useDeletePet'
export type { DeleteUserMutationKey } from './useDeleteUser'
export type { FindPetsByStatusQueryKey } from './useFindPetsByStatus'
export type { FindPetsByTagsQueryKey } from './useFindPetsByTags'
export type { GetInventoryQueryKey } from './useGetInventory'
export type { GetOrderByIdQueryKey } from './useGetOrderById'
export type { GetPetByIdQueryKey } from './useGetPetById'
export type { GetUserByNameQueryKey } from './useGetUserByName'
export type { LoginUserQueryKey } from './useLoginUser'
export type { LogoutUserQueryKey } from './useLogoutUser'
export type { PlaceOrderMutationKey } from './usePlaceOrder'
export type { UpdatePetMutationKey } from './useUpdatePet'
export type { UpdatePetWithFormMutationKey } from './useUpdatePetWithForm'
export type { UpdateUserMutationKey } from './useUpdateUser'
export type { UploadFileMutationKey } from './useUploadFile'
export { addPetMutationKey, useAddPet } from './useAddPet'
export { createUserMutationKey, useCreateUser } from './useCreateUser'
export { createUsersWithListInputMutationKey, useCreateUsersWithListInput } from './useCreateUsersWithListInput'
export { deleteOrderMutationKey, useDeleteOrder } from './useDeleteOrder'
export { deletePetMutationKey, useDeletePet } from './useDeletePet'
export { deleteUserMutationKey, useDeleteUser } from './useDeleteUser'
export { findPetsByStatusQueryKey, findPetsByStatusQueryOptions, useFindPetsByStatus } from './useFindPetsByStatus'
export { findPetsByTagsQueryKey, findPetsByTagsQueryOptions, useFindPetsByTags } from './useFindPetsByTags'
export { getInventoryQueryKey, getInventoryQueryOptions, useGetInventory } from './useGetInventory'
export { getOrderByIdQueryKey, getOrderByIdQueryOptions, useGetOrderById } from './useGetOrderById'
export { getPetByIdQueryKey, getPetByIdQueryOptions, useGetPetById } from './useGetPetById'
export { getUserByNameQueryKey, getUserByNameQueryOptions, useGetUserByName } from './useGetUserByName'
export { loginUserQueryKey, loginUserQueryOptions, useLoginUser } from './useLoginUser'
export { logoutUserQueryKey, logoutUserQueryOptions, useLogoutUser } from './useLogoutUser'
export { placeOrderMutationKey, usePlaceOrder } from './usePlaceOrder'
export { updatePetMutationKey, useUpdatePet } from './useUpdatePet'
export { updatePetWithFormMutationKey, useUpdatePetWithForm } from './useUpdatePetWithForm'
export { updateUserMutationKey, useUpdateUser } from './useUpdateUser'
export { uploadFileMutationKey, useUploadFile } from './useUploadFile'
export type { AddPetMutationKey } from './useAddPet.ts'
export type { CreateUserMutationKey } from './useCreateUser.ts'
export type { CreateUsersWithListInputMutationKey } from './useCreateUsersWithListInput.ts'
export type { DeleteOrderMutationKey } from './useDeleteOrder.ts'
export type { DeletePetMutationKey } from './useDeletePet.ts'
export type { DeleteUserMutationKey } from './useDeleteUser.ts'
export type { FindPetsByStatusQueryKey } from './useFindPetsByStatus.ts'
export type { FindPetsByTagsQueryKey } from './useFindPetsByTags.ts'
export type { GetInventoryQueryKey } from './useGetInventory.ts'
export type { GetOrderByIdQueryKey } from './useGetOrderById.ts'
export type { GetPetByIdQueryKey } from './useGetPetById.ts'
export type { GetUserByNameQueryKey } from './useGetUserByName.ts'
export type { LoginUserQueryKey } from './useLoginUser.ts'
export type { LogoutUserQueryKey } from './useLogoutUser.ts'
export type { PlaceOrderMutationKey } from './usePlaceOrder.ts'
export type { UpdatePetMutationKey } from './useUpdatePet.ts'
export type { UpdatePetWithFormMutationKey } from './useUpdatePetWithForm.ts'
export type { UpdateUserMutationKey } from './useUpdateUser.ts'
export type { UploadFileMutationKey } from './useUploadFile.ts'
export { addPetMutationKey, useAddPet } from './useAddPet.ts'
export { createUserMutationKey, useCreateUser } from './useCreateUser.ts'
export { createUsersWithListInputMutationKey, useCreateUsersWithListInput } from './useCreateUsersWithListInput.ts'
export { deleteOrderMutationKey, useDeleteOrder } from './useDeleteOrder.ts'
export { deletePetMutationKey, useDeletePet } from './useDeletePet.ts'
export { deleteUserMutationKey, useDeleteUser } from './useDeleteUser.ts'
export { findPetsByStatusQueryKey, findPetsByStatusQueryOptions, useFindPetsByStatus } from './useFindPetsByStatus.ts'
export { findPetsByTagsQueryKey, findPetsByTagsQueryOptions, useFindPetsByTags } from './useFindPetsByTags.ts'
export { getInventoryQueryKey, getInventoryQueryOptions, useGetInventory } from './useGetInventory.ts'
export { getOrderByIdQueryKey, getOrderByIdQueryOptions, useGetOrderById } from './useGetOrderById.ts'
export { getPetByIdQueryKey, getPetByIdQueryOptions, useGetPetById } from './useGetPetById.ts'
export { getUserByNameQueryKey, getUserByNameQueryOptions, useGetUserByName } from './useGetUserByName.ts'
export { loginUserQueryKey, loginUserQueryOptions, useLoginUser } from './useLoginUser.ts'
export { logoutUserQueryKey, logoutUserQueryOptions, useLogoutUser } from './useLogoutUser.ts'
export { placeOrderMutationKey, usePlaceOrder } from './usePlaceOrder.ts'
export { updatePetMutationKey, useUpdatePet } from './useUpdatePet.ts'
export { updatePetWithFormMutationKey, useUpdatePetWithForm } from './useUpdatePetWithForm.ts'
export { updateUserMutationKey, useUpdateUser } from './useUpdateUser.ts'
export { uploadFileMutationKey, useUploadFile } from './useUploadFile.ts'
2 changes: 1 addition & 1 deletion examples/vue-query/src/gen/hooks/useAddPet.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import client from '@kubb/plugin-client/clients/axios'
import type { AddPetMutationRequest, AddPetMutationResponse, AddPet405 } from '../models/AddPet'
import type { AddPetMutationRequest, AddPetMutationResponse, AddPet405 } from '../models/AddPet.ts'
import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios'
import type { MutationObserverOptions } from '@tanstack/vue-query'
import type { MaybeRef } from 'vue'
Expand Down
2 changes: 1 addition & 1 deletion examples/vue-query/src/gen/hooks/useCreateUser.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import client from '@kubb/plugin-client/clients/axios'
import type { CreateUserMutationRequest, CreateUserMutationResponse } from '../models/CreateUser'
import type { CreateUserMutationRequest, CreateUserMutationResponse } from '../models/CreateUser.ts'
import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios'
import type { MutationObserverOptions } from '@tanstack/vue-query'
import type { MaybeRef } from 'vue'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import client from '@kubb/plugin-client/clients/axios'
import type { CreateUsersWithListInputMutationRequest, CreateUsersWithListInputMutationResponse } from '../models/CreateUsersWithListInput'
import type { CreateUsersWithListInputMutationRequest, CreateUsersWithListInputMutationResponse } from '../models/CreateUsersWithListInput.ts'
import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios'
import type { MutationObserverOptions } from '@tanstack/vue-query'
import type { MaybeRef } from 'vue'
Expand Down
2 changes: 1 addition & 1 deletion examples/vue-query/src/gen/hooks/useDeleteOrder.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import client from '@kubb/plugin-client/clients/axios'
import type { DeleteOrderMutationResponse, DeleteOrderPathParams, DeleteOrder400, DeleteOrder404 } from '../models/DeleteOrder'
import type { DeleteOrderMutationResponse, DeleteOrderPathParams, DeleteOrder400, DeleteOrder404 } from '../models/DeleteOrder.ts'
import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios'
import type { MutationObserverOptions } from '@tanstack/vue-query'
import type { MaybeRef } from 'vue'
Expand Down
2 changes: 1 addition & 1 deletion examples/vue-query/src/gen/hooks/useDeletePet.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import client from '@kubb/plugin-client/clients/axios'
import type { DeletePetMutationResponse, DeletePetPathParams, DeletePetHeaderParams, DeletePet400 } from '../models/DeletePet'
import type { DeletePetMutationResponse, DeletePetPathParams, DeletePetHeaderParams, DeletePet400 } from '../models/DeletePet.ts'
import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios'
import type { MutationObserverOptions } from '@tanstack/vue-query'
import type { MaybeRef } from 'vue'
Expand Down
Loading

0 comments on commit 967efeb

Please sign in to comment.