Respond to PR feedback.

This commit is contained in:
Sam Rose 2024-02-26 17:28:37 +00:00
parent 04e5699c9c
commit c15554547b
No known key found for this signature in database
5 changed files with 38 additions and 35 deletions

View File

@ -6,7 +6,7 @@ import { Plugin } from "@budibase/types"
// URLS // URLS
export function enrichPluginURLs(plugins: Plugin[]): Plugin[] { export function enrichPluginURLs(plugins: Plugin[] | undefined): Plugin[] {
if (!plugins || !plugins.length) { if (!plugins || !plugins.length) {
return [] return []
} }

View File

@ -49,7 +49,7 @@ import {
UserCtx, UserCtx,
CreateAppRequest, CreateAppRequest,
FetchAppDefinitionResponse, FetchAppDefinitionResponse,
type FetchAppPackageResponse, FetchAppPackageResponse,
} from "@budibase/types" } from "@budibase/types"
import { BASE_LAYOUT_PROP_IDS } from "../../constants/layouts" import { BASE_LAYOUT_PROP_IDS } from "../../constants/layouts"
import sdk from "../../sdk" import sdk from "../../sdk"
@ -177,7 +177,7 @@ export const addSampleData = async (ctx: UserCtx) => {
ctx.status = 200 ctx.status = 200
} }
export async function fetch(ctx: UserCtx<null, App[]>) { export async function fetch(ctx: UserCtx<void, App[]>) {
ctx.body = await sdk.applications.fetch( ctx.body = await sdk.applications.fetch(
ctx.query.status as AppStatus, ctx.query.status as AppStatus,
ctx.user ctx.user
@ -185,7 +185,7 @@ export async function fetch(ctx: UserCtx<null, App[]>) {
} }
export async function fetchAppDefinition( export async function fetchAppDefinition(
ctx: UserCtx<null, FetchAppDefinitionResponse> ctx: UserCtx<void, FetchAppDefinitionResponse>
) { ) {
const layouts = await getLayouts() const layouts = await getLayouts()
const userRoleId = getUserRoleId(ctx) const userRoleId = getUserRoleId(ctx)
@ -202,7 +202,7 @@ export async function fetchAppDefinition(
} }
export async function fetchAppPackage( export async function fetchAppPackage(
ctx: UserCtx<null, FetchAppPackageResponse> ctx: UserCtx<void, FetchAppPackageResponse>
) { ) {
const db = context.getAppDB() const db = context.getAppDB()
const appId = context.getAppId() const appId = context.getAppId()
@ -213,7 +213,7 @@ export async function fetchAppPackage(
// Enrich plugin URLs // Enrich plugin URLs
application.usedPlugins = objectStore.enrichPluginURLs( application.usedPlugins = objectStore.enrichPluginURLs(
application.usedPlugins || [] application.usedPlugins
) )
// Only filter screens if the user is not a builder // Only filter screens if the user is not a builder

View File

@ -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
}

View File

@ -1,3 +1,4 @@
export * from "./application"
export * from "./analytics" export * from "./analytics"
export * from "./auth" export * from "./auth"
export * from "./user" export * from "./user"

View File

@ -1,5 +1,5 @@
import { User, Document, Layout, Screen, Plugin } from "../" import { User, Document, Plugin } from "../"
import { SocketSession, PlanType } from "../../sdk" import { SocketSession } from "../../sdk"
export type AppMetadataErrors = { [key: string]: string[] } export type AppMetadataErrors = { [key: string]: string[] }
@ -75,30 +75,3 @@ export interface AppFeatures {
export interface AutomationSettings { export interface AutomationSettings {
chainAutomations?: boolean 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
}