diff --git a/packages/backend-core/src/objectStore/buckets/plugins.ts b/packages/backend-core/src/objectStore/buckets/plugins.ts index 2d17a0562c..cade60aa09 100644 --- a/packages/backend-core/src/objectStore/buckets/plugins.ts +++ b/packages/backend-core/src/objectStore/buckets/plugins.ts @@ -6,7 +6,7 @@ import { Plugin } from "@budibase/types" // URLS -export function enrichPluginURLs(plugins: Plugin[]): Plugin[] { +export function enrichPluginURLs(plugins: Plugin[] | undefined): Plugin[] { if (!plugins || !plugins.length) { return [] } diff --git a/packages/server/src/api/controllers/application.ts b/packages/server/src/api/controllers/application.ts index f5a121fea2..0bc93888ae 100644 --- a/packages/server/src/api/controllers/application.ts +++ b/packages/server/src/api/controllers/application.ts @@ -49,7 +49,7 @@ import { UserCtx, CreateAppRequest, FetchAppDefinitionResponse, - type FetchAppPackageResponse, + FetchAppPackageResponse, } from "@budibase/types" import { BASE_LAYOUT_PROP_IDS } from "../../constants/layouts" import sdk from "../../sdk" @@ -177,7 +177,7 @@ export const addSampleData = async (ctx: UserCtx) => { ctx.status = 200 } -export async function fetch(ctx: UserCtx) { +export async function fetch(ctx: UserCtx) { ctx.body = await sdk.applications.fetch( ctx.query.status as AppStatus, ctx.user @@ -185,7 +185,7 @@ export async function fetch(ctx: UserCtx) { } export async function fetchAppDefinition( - ctx: UserCtx + ctx: UserCtx ) { const layouts = await getLayouts() const userRoleId = getUserRoleId(ctx) @@ -202,7 +202,7 @@ export async function fetchAppDefinition( } export async function fetchAppPackage( - ctx: UserCtx + ctx: UserCtx ) { const db = context.getAppDB() const appId = context.getAppId() @@ -213,7 +213,7 @@ export async function fetchAppPackage( // Enrich plugin URLs application.usedPlugins = objectStore.enrichPluginURLs( - application.usedPlugins || [] + application.usedPlugins ) // Only filter screens if the user is not a builder diff --git a/packages/types/src/api/web/application.ts b/packages/types/src/api/web/application.ts new file mode 100644 index 0000000000..8b1db534bb --- /dev/null +++ b/packages/types/src/api/web/application.ts @@ -0,0 +1,29 @@ +import type { PlanType } from "../../sdk" +import type { Layout, App } from "../../documents" + +export interface CreateAppRequest { + name: string + url?: string + useTemplate?: string + templateName?: string + templateKey?: string + templateFile?: string + includeSampleData?: boolean + encryptionPassword?: string + templateString?: string +} + +export interface FetchAppDefinitionResponse { + layouts: Layout[] + screens: Screen[] + libraries: string[] +} + +export interface FetchAppPackageResponse { + application: App + licenseType: PlanType + screens: Screen[] + layouts: Layout[] + clientLibPath: string + hasLock: boolean +} diff --git a/packages/types/src/api/web/index.ts b/packages/types/src/api/web/index.ts index 75c246ab9b..ab18add208 100644 --- a/packages/types/src/api/web/index.ts +++ b/packages/types/src/api/web/index.ts @@ -1,3 +1,4 @@ +export * from "./application" export * from "./analytics" export * from "./auth" export * from "./user" diff --git a/packages/types/src/documents/app/app.ts b/packages/types/src/documents/app/app.ts index cdd825b777..ae4f3fa6da 100644 --- a/packages/types/src/documents/app/app.ts +++ b/packages/types/src/documents/app/app.ts @@ -1,5 +1,5 @@ -import { User, Document, Layout, Screen, Plugin } from "../" -import { SocketSession, PlanType } from "../../sdk" +import { User, Document, Plugin } from "../" +import { SocketSession } from "../../sdk" export type AppMetadataErrors = { [key: string]: string[] } @@ -75,30 +75,3 @@ export interface AppFeatures { export interface AutomationSettings { chainAutomations?: boolean } - -export interface CreateAppRequest { - name: string - url?: string - useTemplate?: string - templateName?: string - templateKey?: string - templateFile?: string - includeSampleData?: boolean - encryptionPassword?: string - templateString?: string -} - -export interface FetchAppDefinitionResponse { - layouts: Layout[] - screens: Screen[] - libraries: string[] -} - -export interface FetchAppPackageResponse { - application: App - licenseType: PlanType - screens: Screen[] - layouts: Layout[] - clientLibPath: string - hasLock: boolean -}