Type datasource table
This commit is contained in:
parent
546f193af7
commit
23478cc8f3
|
@ -1,9 +1,10 @@
|
||||||
import { SortOrder } from "@budibase/types"
|
import { SortOrder } from "@budibase/types"
|
||||||
import { get } from "svelte/store"
|
import { get } from "svelte/store"
|
||||||
|
import { Store as StoreContext } from ".."
|
||||||
|
|
||||||
const SuppressErrors = true
|
const SuppressErrors = true
|
||||||
|
|
||||||
export const createActions = context => {
|
export const createActions = (context: StoreContext) => {
|
||||||
const { API, datasource, columns } = context
|
const { API, datasource, columns } = context
|
||||||
|
|
||||||
const saveDefinition = async newDefinition => {
|
const saveDefinition = async newDefinition => {
|
||||||
|
@ -58,7 +59,7 @@ export const createActions = context => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const initialise = context => {
|
export const initialise = (context: StoreContext) => {
|
||||||
const {
|
const {
|
||||||
datasource,
|
datasource,
|
||||||
fetch,
|
fetch,
|
|
@ -50,14 +50,25 @@ const DependencyOrderedStores = [
|
||||||
Cache,
|
Cache,
|
||||||
]
|
]
|
||||||
|
|
||||||
export interface BaseStore {}
|
export interface BaseStore {
|
||||||
|
API: any
|
||||||
|
}
|
||||||
|
|
||||||
export type Store = BaseStore &
|
export type Store = BaseStore &
|
||||||
Columns.Store & {
|
Columns.Store & {
|
||||||
// TODO while typing the rest of stores
|
// TODO while typing the rest of stores
|
||||||
datasource: any
|
datasource: Writable<any>
|
||||||
definition: Writable<any>
|
definition: Writable<any>
|
||||||
enrichedSchema: any
|
enrichedSchema: Writable<any>
|
||||||
|
fetch: Writable<any>
|
||||||
|
filter: Writable<any>
|
||||||
|
inlineFilters: Writable<any>
|
||||||
|
allFilters: Writable<any>
|
||||||
|
sort: Writable<any>
|
||||||
|
table: Writable<any> & { actions: any }
|
||||||
|
initialFilter: Writable<any>
|
||||||
|
initialSortColumn: Writable<any>
|
||||||
|
initialSortOrder: Writable<any>
|
||||||
}
|
}
|
||||||
|
|
||||||
export const attachStores = (context: Store): Store => {
|
export const attachStores = (context: Store): Store => {
|
||||||
|
|
Loading…
Reference in New Issue