Type logs, migrations and other endpoints

This commit is contained in:
Andrew Kingston 2024-12-03 07:36:40 +00:00
parent 20384673f2
commit 99c3955e6d
No known key found for this signature in database
5 changed files with 47 additions and 24 deletions

View File

@ -1,4 +1,10 @@
export const buildLogsEndpoints = API => ({
import { BaseAPIClient } from "./types"
export interface LogEndpoints {
getSystemLogs: () => Promise<any>
}
export const buildLogsEndpoints = (API: BaseAPIClient): LogEndpoints => ({
/**
* Gets a stream for the system logs.
*/

View File

@ -1,10 +0,0 @@
export const buildMigrationEndpoints = API => ({
/**
* Gets the info about the current app migration
*/
getMigrationStatus: async () => {
return await API.get({
url: "/api/migrations/status",
})
},
})

View File

@ -0,0 +1,18 @@
import { BaseAPIClient } from "./types"
export interface MigrationEndpoints {
getMigrationStatus: () => Promise<{ migrated: boolean }>
}
export const buildMigrationEndpoints = (
API: BaseAPIClient
): MigrationEndpoints => ({
/**
* Gets the info about the current app migration
*/
getMigrationStatus: async () => {
return await API.get({
url: "/api/migrations/status",
})
},
})

View File

@ -1,4 +1,17 @@
export const buildOtherEndpoints = API => ({
import { SystemStatusResponse } from "@budibase/types"
import { BaseAPIClient } from "./types"
export interface OtherEndpoints {
getSystemStatus: () => Promise<SystemStatusResponse>
getBudibaseVersion: () => Promise<string>
// Missing request or response types
getEnvironment: () => Promise<Record<string, any>>
getIntegrations: () => Promise<Record<string, any>>
getBasePermissions: () => Promise<any[]>
}
export const buildOtherEndpoints = (API: BaseAPIClient): OtherEndpoints => ({
/**
* Gets the current environment details.
*/
@ -31,7 +44,7 @@ export const buildOtherEndpoints = API => ({
*/
getBudibaseVersion: async () => {
return (
await API.get({
await API.get<{ version: string }>({
url: "/api/dev/version",
})
).version
@ -45,14 +58,4 @@ export const buildOtherEndpoints = API => ({
url: "/api/permission/builtin",
})
},
/**
* Check if they are part of the budibase beta program.
*/
checkBetaAccess: async email => {
return await API.get({
url: `/api/beta/access?email=${email}`,
external: true,
})
},
})

View File

@ -14,6 +14,9 @@ import { FlagEndpoints } from "./flags"
import { GroupEndpoints } from "./groups"
import { LayoutEndpoints } from "./layouts"
import { LicensingEndpoints } from "./licensing"
import { LogEndpoints } from "./logs"
import { MigrationEndpoints } from "./migrations"
import { OtherEndpoints } from "./other"
export enum HTTPMethod {
POST = "POST",
@ -99,4 +102,7 @@ export type APIClient = BaseAPIClient &
FlagEndpoints &
GroupEndpoints &
LayoutEndpoints &
LicensingEndpoints & { [key: string]: any }
LicensingEndpoints &
LogEndpoints &
MigrationEndpoints &
OtherEndpoints & { [key: string]: any }