Fix typings

This commit is contained in:
Adria Navarro 2025-01-07 15:33:05 +01:00
parent 090429fc56
commit dcf52b5dc9
4 changed files with 7 additions and 8 deletions

View File

@ -69,7 +69,7 @@ export const deriveStores = (context: StoreContext): ConfigDerivedStore => {
} }
// Disable features for non DS+ // Disable features for non DS+
if (!["table", "viewV2"].includes(type)) { if (type && !["table", "viewV2"].includes(type)) {
config.canAddRows = false config.canAddRows = false
config.canEditRows = false config.canEditRows = false
config.canDeleteRows = false config.canDeleteRows = false

View File

@ -74,7 +74,7 @@ export const deriveStores = (context: StoreContext): DerivedDatasourceStore => {
let schema: Record<string, UIFieldSchema> = getDatasourceSchema({ let schema: Record<string, UIFieldSchema> = getDatasourceSchema({
API, API,
datasource: get(datasource), datasource: get(datasource),
definition: $definition, definition: $definition ?? undefined,
}) })
if (!schema) { if (!schema) {
return null return null
@ -136,7 +136,7 @@ export const deriveStores = (context: StoreContext): DerivedDatasourceStore => {
if (type === "viewV2" && $definition?.type === ViewV2Type.CALCULATION) { if (type === "viewV2" && $definition?.type === ViewV2Type.CALCULATION) {
return false return false
} }
return ["table", "viewV2", "link"].includes(type) return !!type && ["table", "viewV2", "link"].includes(type)
} }
) )
@ -186,7 +186,7 @@ export const createActions = (context: StoreContext): ActionDatasourceStore => {
API, API,
datasource: get(datasource), datasource: get(datasource),
}) })
definition.set(def) definition.set((def as any) ?? null)
} }
// Saves the datasource definition // Saves the datasource definition

View File

@ -10,7 +10,7 @@ import UserFetch from "./UserFetch.js"
import GroupUserFetch from "./GroupUserFetch" import GroupUserFetch from "./GroupUserFetch"
import CustomFetch from "./CustomFetch" import CustomFetch from "./CustomFetch"
import QueryArrayFetch from "./QueryArrayFetch.js" import QueryArrayFetch from "./QueryArrayFetch.js"
import { Table, UIDatasource } from "@budibase/types" import { TableSchema, UIDatasource } from "@budibase/types"
import { APIClient } from "../api/types.js" import { APIClient } from "../api/types.js"
const DataFetchMap = { const DataFetchMap = {
@ -73,7 +73,7 @@ export const getDatasourceSchema = ({
}: { }: {
API: APIClient API: APIClient
datasource: UIDatasource datasource: UIDatasource
definition: Table definition?: { schema?: TableSchema }
}) => { }) => {
const instance = createEmptyFetchInstance({ API, datasource }) const instance = createEmptyFetchInstance({ API, datasource })
return instance?.getSchema(datasource, definition) return instance?.getSchema(datasource, definition)

View File

@ -1,7 +1,6 @@
import { ViewV2 } from "@budibase/types" import { ViewV2 } from "@budibase/types"
import { UIFieldSchema } from "./table" import { UIFieldSchema } from "./table"
export interface UIView extends Omit<ViewV2, "type"> { export interface UIView extends ViewV2 {
type: string
schema: Record<string, UIFieldSchema> schema: Record<string, UIFieldSchema>
} }