Fix some unwanted anys
This commit is contained in:
parent
e6cccaee6d
commit
f1f2b90cfb
|
@ -131,7 +131,7 @@ export const deriveStores = (context: StoreContext): DerivedDatasourceStore => {
|
||||||
([$datasource, $definition]) => {
|
([$datasource, $definition]) => {
|
||||||
let type = $datasource?.type
|
let type = $datasource?.type
|
||||||
if (type === "provider") {
|
if (type === "provider") {
|
||||||
type = $datasource.value?.datasource?.type
|
type = ($datasource as any).value?.datasource?.type
|
||||||
}
|
}
|
||||||
// Handle calculation views
|
// Handle calculation views
|
||||||
if (type === "viewV2" && $definition?.type === ViewV2Type.CALCULATION) {
|
if (type === "viewV2" && $definition?.type === ViewV2Type.CALCULATION) {
|
||||||
|
@ -196,7 +196,7 @@ export const createActions = (context: StoreContext): ActionDatasourceStore => {
|
||||||
) => {
|
) => {
|
||||||
// Update local state
|
// Update local state
|
||||||
const originalDefinition = get(definition)
|
const originalDefinition = get(definition)
|
||||||
definition.set(newDefinition)
|
definition.set(newDefinition as any)
|
||||||
|
|
||||||
// Update server
|
// Update server
|
||||||
if (get(config).canSaveSchema) {
|
if (get(config).canSaveSchema) {
|
||||||
|
@ -229,8 +229,10 @@ export const createActions = (context: StoreContext): ActionDatasourceStore => {
|
||||||
newDefinition.schema[column].constraints = {}
|
newDefinition.schema[column].constraints = {}
|
||||||
}
|
}
|
||||||
newDefinition.schema[column].constraints.presence = { allowEmpty: false }
|
newDefinition.schema[column].constraints.presence = { allowEmpty: false }
|
||||||
delete newDefinition.schema[column].default
|
if ("default" in newDefinition.schema[column]) {
|
||||||
return await saveDefinition(newDefinition)
|
delete newDefinition.schema[column].default
|
||||||
|
}
|
||||||
|
return await saveDefinition(newDefinition as any)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Adds a schema mutation for a single field
|
// Adds a schema mutation for a single field
|
||||||
|
@ -306,7 +308,7 @@ export const createActions = (context: StoreContext): ActionDatasourceStore => {
|
||||||
await saveDefinition({
|
await saveDefinition({
|
||||||
...$definition,
|
...$definition,
|
||||||
schema: newSchema,
|
schema: newSchema,
|
||||||
})
|
} as any)
|
||||||
resetSchemaMutations()
|
resetSchemaMutations()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -62,9 +62,6 @@ export type Store = BaseStore &
|
||||||
NonPlus.Store &
|
NonPlus.Store &
|
||||||
Datasource.Store & {
|
Datasource.Store & {
|
||||||
// TODO while typing the rest of stores
|
// TODO while typing the rest of stores
|
||||||
datasource: Writable<any> & { actions: any }
|
|
||||||
definition: Writable<any>
|
|
||||||
enrichedSchema: any
|
|
||||||
fetch: Writable<any>
|
fetch: Writable<any>
|
||||||
filter: Writable<any>
|
filter: Writable<any>
|
||||||
inlineFilters: Writable<any>
|
inlineFilters: Writable<any>
|
||||||
|
|
|
@ -1,14 +1,16 @@
|
||||||
import { SortOrder } from "@budibase/types"
|
import { SortOrder, UIFieldSchema } from "@budibase/types"
|
||||||
|
|
||||||
export interface UIDatasource {
|
export interface UIDatasource {
|
||||||
type: string
|
type: string
|
||||||
id: string
|
id: string
|
||||||
tableId: string
|
tableId: string
|
||||||
|
primaryDisplay?: string
|
||||||
sort?: {
|
sort?: {
|
||||||
field: string
|
field: string
|
||||||
order?: SortOrder
|
order?: SortOrder
|
||||||
}
|
}
|
||||||
queryUI: any // TODO
|
queryUI: any // TODO
|
||||||
|
schema: Record<string, UIFieldSchema>
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface UIFieldMutation {
|
export interface UIFieldMutation {
|
||||||
|
|
Loading…
Reference in New Issue