Extract action interface
This commit is contained in:
parent
8265fc8ab5
commit
90b6639125
|
@ -0,0 +1,19 @@
|
|||
import {
|
||||
Row,
|
||||
SaveRowRequest,
|
||||
SaveTableRequest,
|
||||
UIDatasource,
|
||||
UpdateViewRequest,
|
||||
} from "@budibase/types"
|
||||
|
||||
export interface DatasourceActions<
|
||||
TSaveDefinitionRequest = UpdateViewRequest | SaveTableRequest
|
||||
> {
|
||||
saveDefinition: (newDefinition: TSaveDefinitionRequest) => Promise<void>
|
||||
addRow: (row: SaveRowRequest) => Promise<Row>
|
||||
updateRow: (row: SaveRowRequest) => Promise<Row>
|
||||
deleteRows: (rows: (string | Row)[]) => Promise<void>
|
||||
getRow: (id: string) => Promise<Row>
|
||||
isDatasourceValid: (datasource: UIDatasource) => boolean
|
||||
canUseColumn: (name: string) => boolean
|
||||
}
|
|
@ -1,18 +1,11 @@
|
|||
import { SortOrder, UIDatasource } from "@budibase/types"
|
||||
import { get } from "svelte/store"
|
||||
import { Store as StoreContext } from ".."
|
||||
import { DatasourceActions } from "."
|
||||
|
||||
interface NonPlusActions {
|
||||
nonPlus: {
|
||||
actions: {
|
||||
saveDefinition: () => Promise<void>
|
||||
addRow: () => Promise<void>
|
||||
updateRow: () => Promise<void>
|
||||
deleteRows: () => Promise<void>
|
||||
getRow: () => Promise<void>
|
||||
isDatasourceValid: (datasource: UIDatasource) => boolean
|
||||
canUseColumn: (name: string) => boolean
|
||||
}
|
||||
actions: DatasourceActions<never>
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,27 +1,19 @@
|
|||
import {
|
||||
Row,
|
||||
SaveRowRequest,
|
||||
SaveRowResponse,
|
||||
SaveTableRequest,
|
||||
SortOrder,
|
||||
UIDatasource,
|
||||
} from "@budibase/types"
|
||||
import { get } from "svelte/store"
|
||||
import { Store as StoreContext } from ".."
|
||||
import { DatasourceActions } from "."
|
||||
|
||||
const SuppressErrors = true
|
||||
|
||||
interface TableActions {
|
||||
table: {
|
||||
actions: {
|
||||
saveDefinition: (newDefinition: SaveTableRequest) => Promise<void>
|
||||
addRow: (row: SaveRowRequest) => Promise<SaveRowResponse>
|
||||
updateRow: (row: SaveRowRequest) => Promise<SaveRowResponse>
|
||||
deleteRows: (rows: (string | Row)[]) => Promise<void>
|
||||
getRow: (id: string) => Promise<Row>
|
||||
isDatasourceValid: (datasource: UIDatasource) => boolean
|
||||
canUseColumn: (name: string) => boolean
|
||||
}
|
||||
actions: DatasourceActions<SaveTableRequest>
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -7,20 +7,13 @@ import {
|
|||
UpdateViewRequest,
|
||||
} from "@budibase/types"
|
||||
import { Store as StoreContext } from ".."
|
||||
import { DatasourceActions } from "."
|
||||
|
||||
const SuppressErrors = true
|
||||
|
||||
interface ViewActions {
|
||||
viewV2: {
|
||||
actions: {
|
||||
saveDefinition: (newDefinition: UpdateViewRequest) => Promise<void>
|
||||
addRow: (row: SaveRowRequest) => Promise<Row>
|
||||
updateRow: (row: SaveRowRequest) => Promise<Row>
|
||||
deleteRows: (rows: (string | Row)[]) => Promise<void>
|
||||
getRow: (id: string) => Promise<Row>
|
||||
isDatasourceValid: (datasource: UIDatasource) => boolean
|
||||
canUseColumn: (name: string) => boolean
|
||||
}
|
||||
actions: DatasourceActions<UpdateViewRequest>
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue