From 739cab0c90bbe7e31b8c4bff7d5a4cc658db8a07 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Thu, 5 Dec 2024 12:19:57 +0000 Subject: [PATCH] Update typing of app and analytics endpoints --- packages/frontend-core/src/api/analytics.ts | 4 +- packages/frontend-core/src/api/app.ts | 44 ++++++++++++++------- 2 files changed, 31 insertions(+), 17 deletions(-) diff --git a/packages/frontend-core/src/api/analytics.ts b/packages/frontend-core/src/api/analytics.ts index efb70574e2..0920a65654 100644 --- a/packages/frontend-core/src/api/analytics.ts +++ b/packages/frontend-core/src/api/analytics.ts @@ -1,8 +1,8 @@ import { BaseAPIClient } from "./types" -import { AnalyticsPingRequest } from "@budibase/types" +import { AnalyticsEnabledResponse, AnalyticsPingRequest } from "@budibase/types" export interface AnalyticsEndpoints { - getAnalyticsStatus: () => Promise<{ enabled: boolean }> + getAnalyticsStatus: () => Promise analyticsPing: ( payload: Omit ) => Promise diff --git a/packages/frontend-core/src/api/app.ts b/packages/frontend-core/src/api/app.ts index 52847ae0d7..99d9053f38 100644 --- a/packages/frontend-core/src/api/app.ts +++ b/packages/frontend-core/src/api/app.ts @@ -2,11 +2,25 @@ import { sdk } from "@budibase/shared-core" import { BaseAPIClient } from "./types" import { App, + ClearDevLockResponse, CreateAppRequest, + CreateAppResponse, + DeleteAppResponse, DuplicateAppRequest, DuplicateAppResponse, + FetchAppDefinitionResponse, FetchAppPackageResponse, + FetchAppsResponse, + FetchDeploymentResponse, GetDiagnosticsResponse, + ImportToUpdateAppRequest, + ImportToUpdateAppResponse, + PublishAppResponse, + RevertAppClientResponse, + RevertAppResponse, + SetRevertableAppVersionRequest, + SyncAppResponse, + UpdateAppClientResponse, UpdateAppRequest, UpdateAppResponse, } from "@budibase/types" @@ -18,36 +32,36 @@ export interface AppEndpoints { metadata: UpdateAppRequest ) => Promise unpublishApp: (appId: string) => Promise - createApp: (app: CreateAppRequest) => Promise - deleteApp: (appId: string) => Promise + publishAppChanges: (appId: string) => Promise + revertAppChanges: (appId: string) => Promise + updateAppClientVersion: (appId: string) => Promise + revertAppClientVersion: (appId: string) => Promise + releaseAppLock: (appId: string) => Promise + getAppDeployments: () => Promise + createApp: (app: CreateAppRequest) => Promise + deleteApp: (appId: string) => Promise duplicateApp: ( appId: string, app: DuplicateAppRequest ) => Promise updateAppFromExport: ( appId: string, - body: any - ) => Promise<{ message: string }> + body: ImportToUpdateAppRequest + ) => Promise fetchSystemDebugInfo: () => Promise - syncApp: (appId: string) => Promise<{ message: string }> - getApps: () => Promise + syncApp: (appId: string) => Promise + getApps: () => Promise fetchComponentLibDefinitions: ( appId: string - ) => Promise<{ [key: string]: any }> + ) => Promise setRevertableVersion: ( appId: string, revertableVersion: string - ) => Promise + ) => Promise addSampleData: (appId: string) => Promise // Missing request or response types - publishAppChanges: (appId: string) => Promise - revertAppChanges: (appId: string) => Promise - updateAppClientVersion: (appId: string) => Promise - revertAppClientVersion: (appId: string) => Promise importApps: (apps: any) => Promise - releaseAppLock: (appId: string) => Promise - getAppDeployments: () => Promise } export const buildAppEndpoints = (API: BaseAPIClient): AppEndpoints => ({ @@ -259,7 +273,7 @@ export const buildAppEndpoints = (API: BaseAPIClient): AppEndpoints => ({ * @param revertableVersion the version number */ setRevertableVersion: async (appId, revertableVersion) => { - return await API.post({ + return await API.post({ url: `/api/applications/${appId}/setRevertableVersion`, body: { revertableVersion,