Basic ts conversion

This commit is contained in:
Adria Navarro 2025-01-09 14:50:21 +01:00
parent 7d9debd319
commit 7df69f154a
2 changed files with 4 additions and 22 deletions

View File

@ -29,7 +29,7 @@ import { ActionTypes } from "./constants"
import { import {
fetchDatasourceSchema, fetchDatasourceSchema,
fetchDatasourceDefinition, fetchDatasourceDefinition,
} from "./utils/schema.js" } from "./utils/schema.ts"
import { getAPIKey } from "./utils/api.js" import { getAPIKey } from "./utils/api.js"
import { enrichButtonActions } from "./utils/buttonActions.js" import { enrichButtonActions } from "./utils/buttonActions.js"
import { processStringSync, makePropSafe } from "@budibase/string-templates" import { processStringSync, makePropSafe } from "@budibase/string-templates"

View File

@ -1,13 +1,5 @@
import { API } from "api" import { API } from "api"
import TableFetch from "@budibase/frontend-core/src/fetch/TableFetch" import { DataFetchMap } from "@budibase/frontend-core"
import ViewFetch from "@budibase/frontend-core/src/fetch/ViewFetch"
import QueryFetch from "@budibase/frontend-core/src/fetch/QueryFetch"
import RelationshipFetch from "@budibase/frontend-core/src/fetch/RelationshipFetch"
import NestedProviderFetch from "@budibase/frontend-core/src/fetch/NestedProviderFetch"
import FieldFetch from "@budibase/frontend-core/src/fetch/FieldFetch"
import JSONArrayFetch from "@budibase/frontend-core/src/fetch/JSONArrayFetch"
import ViewV2Fetch from "@budibase/frontend-core/src/fetch/ViewV2Fetch"
import QueryArrayFetch from "@budibase/frontend-core/src/fetch/QueryArrayFetch"
/** /**
* Constructs a fetch instance for a given datasource. * Constructs a fetch instance for a given datasource.
@ -16,18 +8,8 @@ import QueryArrayFetch from "@budibase/frontend-core/src/fetch/QueryArrayFetch"
* @param datasource the datasource * @param datasource the datasource
* @returns * @returns
*/ */
const getDatasourceFetchInstance = datasource => { const getDatasourceFetchInstance = (datasource: { type: string }) => {
const handler = { const handler = DataFetchMap[datasource?.type]
table: TableFetch,
view: ViewFetch,
viewV2: ViewV2Fetch,
query: QueryFetch,
link: RelationshipFetch,
provider: NestedProviderFetch,
field: FieldFetch,
jsonarray: JSONArrayFetch,
queryarray: QueryArrayFetch,
}[datasource?.type]
if (!handler) { if (!handler) {
return null return null
} }