chore: only include platform/v1 routes in api types (#33753)

This commit is contained in:
Kevin Grüneberg
2025-02-21 20:04:57 +08:00
committed by GitHub
parent 5f4e5e5626
commit a283da6ddb
10 changed files with 17773 additions and 28384 deletions

View File

@@ -4,16 +4,11 @@ import { toast } from 'sonner'
import { handleError, post } from 'data/fetchers'
import type { ResponseError } from 'types'
import { edgeFunctionsKeys } from './keys'
import { components } from 'api-types'
export type EdgeFunctionsDeployVariables = {
projectRef: string
metadata: {
entrypoint_path?: string
import_map_path?: string
name?: string
static_patterns?: string[]
verify_jwt?: boolean
}
metadata: components['schemas']['FunctionDeployMetadata']
files: { name: string; content: string }[]
}
@@ -28,7 +23,7 @@ export async function deployEdgeFunction({
params: { path: { ref: projectRef }, query: { slug: metadata.name } },
body: {
file: files as any,
metadata: metadata,
metadata,
},
bodySerializer(body) {
const formData = new FormData()

View File

@@ -17,7 +17,7 @@ export interface Project extends Omit<ProjectDetail, 'status'> {
* If not we will show ConnectingState and run a polling until it's back online
*/
postgrestStatus?: 'ONLINE' | 'OFFLINE'
status: components['schemas']['ResourceWithServicesStatusResponse']['status']
status: components['schemas']['project_status']
}
export async function getProjectDetail({ ref }: ProjectDetailVariables, signal?: AbortSignal) {

View File

@@ -10,7 +10,7 @@ export type ProjectRestartVariables = {
identifier?: string
}
type RestartProjectBody = components['schemas']['RestartProjectInfo']
type RestartProjectBody = components['schemas']['RestartProjectBodyDto']
export async function restartProject({ ref, identifier }: ProjectRestartVariables) {
const payload: RestartProjectBody = {}

View File

@@ -13,7 +13,7 @@ export type ProjectsVariables = {
}
export type ProjectInfo = components['schemas']['ProjectInfo'] & {
status: components['schemas']['ResourceWithServicesStatusResponse']['status']
status: components['schemas']['project_status']
}
export async function getProjects(signal?: AbortSignal) {

View File

@@ -42,7 +42,7 @@ export const PROVIDERS = {
} as const
export const PROJECT_STATUS: {
[key: string]: components['schemas']['ResourceWithServicesStatusResponse']['status']
[key: string]: components['schemas']['project_status']
} = {
INACTIVE: 'INACTIVE',
ACTIVE_HEALTHY: 'ACTIVE_HEALTHY',

View File

@@ -1 +1,22 @@
export type * from './types/api'
export type { webhooks, $defs } from './types/api'
import type {
paths as apiPaths,
components as apiComponents,
operations as apiOperations,
} from './types/api'
import type {
paths as platformPaths,
components as platformComponents,
operations as platformOperations,
} from './types/platform'
export interface paths extends apiPaths, platformPaths {}
export interface operations extends apiOperations, platformOperations {}
export interface components {
schemas: apiComponents['schemas'] & platformComponents['schemas']
responses: apiComponents['responses'] & platformComponents['responses']
parameters: apiComponents['parameters'] & platformComponents['parameters']
requestBodies: apiComponents['requestBodies'] & platformComponents['requestBodies']
headers: apiComponents['headers'] & platformComponents['headers']
pathItems: apiComponents['pathItems'] & platformComponents['pathItems']
}

View File

@@ -7,7 +7,7 @@
"scripts": {
"preinstall": "npx only-allow pnpm",
"clean": "rimraf node_modules",
"codegen": "openapi-typescript http://localhost:8080/api-json -o types/api.d.ts --alphabetize --default-non-nullable=false && prettier --write types/api.d.ts"
"codegen": "openapi-typescript --redocly ./redocly.yaml --alphabetize --default-non-nullable=false && prettier --write types/*.d.ts"
},
"author": "",
"license": "MIT",

View File

@@ -0,0 +1,9 @@
apis:
api:
root: http://localhost:8080/api/v1-json
x-openapi-ts:
output: ./types/api.d.ts
platform:
root: http://localhost:8080/api/platform-json
x-openapi-ts:
output: ./types/platform.d.ts

File diff suppressed because it is too large Load Diff

17621
packages/api-types/types/platform.d.ts vendored Normal file

File diff suppressed because it is too large Load Diff