Rename DataFetch to BaseDataFetch
This commit is contained in:
parent
30c942c852
commit
c1981aaa29
|
@ -1,4 +1,4 @@
|
||||||
import DataFetch from "./DataFetch"
|
import BaseDataFetch from "./DataFetch"
|
||||||
|
|
||||||
interface CustomDatasource {
|
interface CustomDatasource {
|
||||||
type: "custom"
|
type: "custom"
|
||||||
|
@ -7,7 +7,7 @@ interface CustomDatasource {
|
||||||
|
|
||||||
type CustomDefinition = Record<string, any>
|
type CustomDefinition = Record<string, any>
|
||||||
|
|
||||||
export default class CustomFetch extends DataFetch<
|
export default class CustomFetch extends BaseDataFetch<
|
||||||
CustomDatasource,
|
CustomDatasource,
|
||||||
CustomDefinition
|
CustomDefinition
|
||||||
> {
|
> {
|
||||||
|
|
|
@ -71,7 +71,7 @@ export interface DataFetchOptions<TQuery = SearchFilters | undefined> {
|
||||||
* internal table or datasource plus.
|
* internal table or datasource plus.
|
||||||
* For other types of datasource, this class is overridden and extended.
|
* For other types of datasource, this class is overridden and extended.
|
||||||
*/
|
*/
|
||||||
export default abstract class DataFetch<
|
export default abstract class BaseDataFetch<
|
||||||
TDatasource extends { type: DataFetchType },
|
TDatasource extends { type: DataFetchType },
|
||||||
TDefinition extends {
|
TDefinition extends {
|
||||||
schema?: Record<string, any> | null
|
schema?: Record<string, any> | null
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { Row } from "@budibase/types"
|
import { Row } from "@budibase/types"
|
||||||
import DataFetch from "./DataFetch"
|
import BaseDataFetch from "./DataFetch"
|
||||||
|
|
||||||
type Types = "field" | "queryarray" | "jsonarray"
|
type Types = "field" | "queryarray" | "jsonarray"
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ function isArrayOfStrings(value: string[] | Row[]): value is string[] {
|
||||||
return Array.isArray(value) && !!value[0] && typeof value[0] !== "object"
|
return Array.isArray(value) && !!value[0] && typeof value[0] !== "object"
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class FieldFetch<TType extends Types> extends DataFetch<
|
export default class FieldFetch<TType extends Types> extends BaseDataFetch<
|
||||||
FieldDatasource<TType>,
|
FieldDatasource<TType>,
|
||||||
FieldDefinition
|
FieldDefinition
|
||||||
> {
|
> {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { get } from "svelte/store"
|
import { get } from "svelte/store"
|
||||||
import DataFetch, { DataFetchParams } from "./DataFetch"
|
import BaseDataFetch, { DataFetchParams } from "./DataFetch"
|
||||||
import { TableNames } from "../constants"
|
import { TableNames } from "../constants"
|
||||||
|
|
||||||
interface GroupUserQuery {
|
interface GroupUserQuery {
|
||||||
|
@ -12,7 +12,7 @@ interface GroupUserDatasource {
|
||||||
tableId: TableNames.USERS
|
tableId: TableNames.USERS
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class GroupUserFetch extends DataFetch<
|
export default class GroupUserFetch extends BaseDataFetch<
|
||||||
GroupUserDatasource,
|
GroupUserDatasource,
|
||||||
{},
|
{},
|
||||||
GroupUserQuery
|
GroupUserQuery
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { Row, TableSchema } from "@budibase/types"
|
import { Row, TableSchema } from "@budibase/types"
|
||||||
import DataFetch from "./DataFetch"
|
import BaseDataFetch from "./DataFetch"
|
||||||
|
|
||||||
interface NestedProviderDatasource {
|
interface NestedProviderDatasource {
|
||||||
type: "provider"
|
type: "provider"
|
||||||
|
@ -14,7 +14,7 @@ interface NestedProviderDefinition {
|
||||||
schema?: TableSchema
|
schema?: TableSchema
|
||||||
primaryDisplay?: string
|
primaryDisplay?: string
|
||||||
}
|
}
|
||||||
export default class NestedProviderFetch extends DataFetch<
|
export default class NestedProviderFetch extends BaseDataFetch<
|
||||||
NestedProviderDatasource,
|
NestedProviderDatasource,
|
||||||
NestedProviderDefinition
|
NestedProviderDefinition
|
||||||
> {
|
> {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import DataFetch from "./DataFetch"
|
import BaseDataFetch from "./DataFetch"
|
||||||
import { Helpers } from "@budibase/bbui"
|
import { Helpers } from "@budibase/bbui"
|
||||||
import { ExecuteQueryRequest, Query } from "@budibase/types"
|
import { ExecuteQueryRequest, Query } from "@budibase/types"
|
||||||
import { get } from "svelte/store"
|
import { get } from "svelte/store"
|
||||||
|
@ -17,7 +17,7 @@ interface QueryDatasource {
|
||||||
parameters: { name: string; default: string }[]
|
parameters: { name: string; default: string }[]
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class QueryFetch extends DataFetch<QueryDatasource, Query> {
|
export default class QueryFetch extends BaseDataFetch<QueryDatasource, Query> {
|
||||||
async determineFeatureFlags() {
|
async determineFeatureFlags() {
|
||||||
const definition = await this.getDefinition()
|
const definition = await this.getDefinition()
|
||||||
const supportsPagination =
|
const supportsPagination =
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { Table } from "@budibase/types"
|
import { Table } from "@budibase/types"
|
||||||
import DataFetch from "./DataFetch"
|
import BaseDataFetch from "./DataFetch"
|
||||||
|
|
||||||
interface RelationshipDatasource {
|
interface RelationshipDatasource {
|
||||||
type: "link"
|
type: "link"
|
||||||
|
@ -9,7 +9,7 @@ interface RelationshipDatasource {
|
||||||
fieldName: string
|
fieldName: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class RelationshipFetch extends DataFetch<
|
export default class RelationshipFetch extends BaseDataFetch<
|
||||||
RelationshipDatasource,
|
RelationshipDatasource,
|
||||||
Table
|
Table
|
||||||
> {
|
> {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { get } from "svelte/store"
|
import { get } from "svelte/store"
|
||||||
import DataFetch from "./DataFetch"
|
import BaseDataFetch from "./DataFetch"
|
||||||
import { SortOrder, Table } from "@budibase/types"
|
import { SortOrder, Table } from "@budibase/types"
|
||||||
|
|
||||||
interface TableDatasource {
|
interface TableDatasource {
|
||||||
|
@ -7,7 +7,7 @@ interface TableDatasource {
|
||||||
tableId: string
|
tableId: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class TableFetch extends DataFetch<TableDatasource, Table> {
|
export default class TableFetch extends BaseDataFetch<TableDatasource, Table> {
|
||||||
async determineFeatureFlags() {
|
async determineFeatureFlags() {
|
||||||
return {
|
return {
|
||||||
supportsSearch: true,
|
supportsSearch: true,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { get } from "svelte/store"
|
import { get } from "svelte/store"
|
||||||
import DataFetch, { DataFetchParams } from "./DataFetch"
|
import BaseDataFetch, { DataFetchParams } from "./DataFetch"
|
||||||
import { TableNames } from "../constants"
|
import { TableNames } from "../constants"
|
||||||
import { utils } from "@budibase/shared-core"
|
import { utils } from "@budibase/shared-core"
|
||||||
import { SearchFilters, SearchUsersRequest } from "@budibase/types"
|
import { SearchFilters, SearchUsersRequest } from "@budibase/types"
|
||||||
|
@ -16,7 +16,7 @@ interface UserDatasource {
|
||||||
|
|
||||||
interface UserDefinition {}
|
interface UserDefinition {}
|
||||||
|
|
||||||
export default class UserFetch extends DataFetch<
|
export default class UserFetch extends BaseDataFetch<
|
||||||
UserDatasource,
|
UserDatasource,
|
||||||
UserDefinition,
|
UserDefinition,
|
||||||
UserFetchQuery
|
UserFetchQuery
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { Table } from "@budibase/types"
|
import { Table } from "@budibase/types"
|
||||||
import DataFetch from "./DataFetch"
|
import BaseDataFetch from "./DataFetch"
|
||||||
|
|
||||||
type ViewV1Datasource = {
|
type ViewV1Datasource = {
|
||||||
type: "view"
|
type: "view"
|
||||||
|
@ -10,7 +10,7 @@ type ViewV1Datasource = {
|
||||||
groupBy: string
|
groupBy: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class ViewFetch extends DataFetch<ViewV1Datasource, Table> {
|
export default class ViewFetch extends BaseDataFetch<ViewV1Datasource, Table> {
|
||||||
async getDefinition() {
|
async getDefinition() {
|
||||||
const { datasource } = this.options
|
const { datasource } = this.options
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { SortOrder, ViewV2Enriched, ViewV2Type } from "@budibase/types"
|
import { SortOrder, ViewV2Enriched, ViewV2Type } from "@budibase/types"
|
||||||
import DataFetch from "./DataFetch"
|
import BaseDataFetch from "./DataFetch"
|
||||||
import { get } from "svelte/store"
|
import { get } from "svelte/store"
|
||||||
import { helpers } from "@budibase/shared-core"
|
import { helpers } from "@budibase/shared-core"
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ interface ViewDatasource {
|
||||||
id: string
|
id: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class ViewV2Fetch extends DataFetch<
|
export default class ViewV2Fetch extends BaseDataFetch<
|
||||||
ViewDatasource,
|
ViewDatasource,
|
||||||
ViewV2Enriched
|
ViewV2Enriched
|
||||||
> {
|
> {
|
||||||
|
|
Loading…
Reference in New Issue