From 30c942c852e17ed03b51c758641e2aaeda239eac Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Tue, 14 Jan 2025 10:45:08 +0100 Subject: [PATCH 01/20] Type options --- packages/frontend-core/src/fetch/DataFetch.ts | 27 +++++++++++-------- packages/frontend-core/src/fetch/index.ts | 10 ++++++- 2 files changed, 25 insertions(+), 12 deletions(-) diff --git a/packages/frontend-core/src/fetch/DataFetch.ts b/packages/frontend-core/src/fetch/DataFetch.ts index b10a8b0a69..ad8a632480 100644 --- a/packages/frontend-core/src/fetch/DataFetch.ts +++ b/packages/frontend-core/src/fetch/DataFetch.ts @@ -51,7 +51,19 @@ export interface DataFetchParams< API: APIClient datasource: TDatasource query: TQuery - options?: {} + options?: Partial> +} + +export interface DataFetchOptions { + // Search config + filter: UISearchFilter | LegacyFilter[] | null + query: TQuery + // Sorting config + sortColumn: string | null + sortOrder: SortOrder + // Pagination config + limit: number + paginate: boolean } /** @@ -73,18 +85,11 @@ export default abstract class DataFetch< supportsSort: boolean supportsPagination: boolean } - options: { + options: DataFetchOptions & { datasource: TDatasource - limit: number - // Search config - filter: UISearchFilter | LegacyFilter[] | null - query: TQuery - // Sorting config - sortColumn: string | null - sortOrder: SortOrder + sortType: SortType | null - // Pagination config - paginate: boolean + // Client side feature customisation clientSideSearching: boolean clientSideSorting: boolean diff --git a/packages/frontend-core/src/fetch/index.ts b/packages/frontend-core/src/fetch/index.ts index d80aa10df6..4b9de01dae 100644 --- a/packages/frontend-core/src/fetch/index.ts +++ b/packages/frontend-core/src/fetch/index.ts @@ -32,7 +32,15 @@ export const DataFetchMap = { } // Constructs a new fetch model for a certain datasource -export const fetchData = ({ API, datasource, options }: any) => { +export const fetchData = ({ + API, + datasource, + options, +}: { + API: APIClient + datasource: TDatasource + options: any +}) => { const Fetch = DataFetchMap[datasource?.type as DataFetchType] || TableFetch const fetch = new Fetch({ API, datasource, ...options }) From c1981aaa29d537e55980837983a1dbfe2c5021f7 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Tue, 14 Jan 2025 10:48:50 +0100 Subject: [PATCH 02/20] Rename DataFetch to BaseDataFetch --- packages/frontend-core/src/fetch/CustomFetch.ts | 4 ++-- packages/frontend-core/src/fetch/DataFetch.ts | 2 +- packages/frontend-core/src/fetch/FieldFetch.ts | 4 ++-- packages/frontend-core/src/fetch/GroupUserFetch.ts | 4 ++-- packages/frontend-core/src/fetch/NestedProviderFetch.ts | 4 ++-- packages/frontend-core/src/fetch/QueryFetch.ts | 4 ++-- packages/frontend-core/src/fetch/RelationshipFetch.ts | 4 ++-- packages/frontend-core/src/fetch/TableFetch.ts | 4 ++-- packages/frontend-core/src/fetch/UserFetch.ts | 4 ++-- packages/frontend-core/src/fetch/ViewFetch.ts | 4 ++-- packages/frontend-core/src/fetch/ViewV2Fetch.ts | 4 ++-- 11 files changed, 21 insertions(+), 21 deletions(-) diff --git a/packages/frontend-core/src/fetch/CustomFetch.ts b/packages/frontend-core/src/fetch/CustomFetch.ts index dfd29c4a02..60ce1f50ec 100644 --- a/packages/frontend-core/src/fetch/CustomFetch.ts +++ b/packages/frontend-core/src/fetch/CustomFetch.ts @@ -1,4 +1,4 @@ -import DataFetch from "./DataFetch" +import BaseDataFetch from "./DataFetch" interface CustomDatasource { type: "custom" @@ -7,7 +7,7 @@ interface CustomDatasource { type CustomDefinition = Record -export default class CustomFetch extends DataFetch< +export default class CustomFetch extends BaseDataFetch< CustomDatasource, CustomDefinition > { diff --git a/packages/frontend-core/src/fetch/DataFetch.ts b/packages/frontend-core/src/fetch/DataFetch.ts index ad8a632480..75c454e2ac 100644 --- a/packages/frontend-core/src/fetch/DataFetch.ts +++ b/packages/frontend-core/src/fetch/DataFetch.ts @@ -71,7 +71,7 @@ export interface DataFetchOptions { * internal table or datasource plus. * 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 }, TDefinition extends { schema?: Record | null diff --git a/packages/frontend-core/src/fetch/FieldFetch.ts b/packages/frontend-core/src/fetch/FieldFetch.ts index 694443a5dc..5cc903d87e 100644 --- a/packages/frontend-core/src/fetch/FieldFetch.ts +++ b/packages/frontend-core/src/fetch/FieldFetch.ts @@ -1,5 +1,5 @@ import { Row } from "@budibase/types" -import DataFetch from "./DataFetch" +import BaseDataFetch from "./DataFetch" 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" } -export default class FieldFetch extends DataFetch< +export default class FieldFetch extends BaseDataFetch< FieldDatasource, FieldDefinition > { diff --git a/packages/frontend-core/src/fetch/GroupUserFetch.ts b/packages/frontend-core/src/fetch/GroupUserFetch.ts index e07e5331d4..f3fdcf5ebb 100644 --- a/packages/frontend-core/src/fetch/GroupUserFetch.ts +++ b/packages/frontend-core/src/fetch/GroupUserFetch.ts @@ -1,5 +1,5 @@ import { get } from "svelte/store" -import DataFetch, { DataFetchParams } from "./DataFetch" +import BaseDataFetch, { DataFetchParams } from "./DataFetch" import { TableNames } from "../constants" interface GroupUserQuery { @@ -12,7 +12,7 @@ interface GroupUserDatasource { tableId: TableNames.USERS } -export default class GroupUserFetch extends DataFetch< +export default class GroupUserFetch extends BaseDataFetch< GroupUserDatasource, {}, GroupUserQuery diff --git a/packages/frontend-core/src/fetch/NestedProviderFetch.ts b/packages/frontend-core/src/fetch/NestedProviderFetch.ts index af121fcef8..b4274e690f 100644 --- a/packages/frontend-core/src/fetch/NestedProviderFetch.ts +++ b/packages/frontend-core/src/fetch/NestedProviderFetch.ts @@ -1,5 +1,5 @@ import { Row, TableSchema } from "@budibase/types" -import DataFetch from "./DataFetch" +import BaseDataFetch from "./DataFetch" interface NestedProviderDatasource { type: "provider" @@ -14,7 +14,7 @@ interface NestedProviderDefinition { schema?: TableSchema primaryDisplay?: string } -export default class NestedProviderFetch extends DataFetch< +export default class NestedProviderFetch extends BaseDataFetch< NestedProviderDatasource, NestedProviderDefinition > { diff --git a/packages/frontend-core/src/fetch/QueryFetch.ts b/packages/frontend-core/src/fetch/QueryFetch.ts index 09dde86cbd..179deb1a66 100644 --- a/packages/frontend-core/src/fetch/QueryFetch.ts +++ b/packages/frontend-core/src/fetch/QueryFetch.ts @@ -1,4 +1,4 @@ -import DataFetch from "./DataFetch" +import BaseDataFetch from "./DataFetch" import { Helpers } from "@budibase/bbui" import { ExecuteQueryRequest, Query } from "@budibase/types" import { get } from "svelte/store" @@ -17,7 +17,7 @@ interface QueryDatasource { parameters: { name: string; default: string }[] } -export default class QueryFetch extends DataFetch { +export default class QueryFetch extends BaseDataFetch { async determineFeatureFlags() { const definition = await this.getDefinition() const supportsPagination = diff --git a/packages/frontend-core/src/fetch/RelationshipFetch.ts b/packages/frontend-core/src/fetch/RelationshipFetch.ts index 89a85ab0e4..c84c38e77c 100644 --- a/packages/frontend-core/src/fetch/RelationshipFetch.ts +++ b/packages/frontend-core/src/fetch/RelationshipFetch.ts @@ -1,5 +1,5 @@ import { Table } from "@budibase/types" -import DataFetch from "./DataFetch" +import BaseDataFetch from "./DataFetch" interface RelationshipDatasource { type: "link" @@ -9,7 +9,7 @@ interface RelationshipDatasource { fieldName: string } -export default class RelationshipFetch extends DataFetch< +export default class RelationshipFetch extends BaseDataFetch< RelationshipDatasource, Table > { diff --git a/packages/frontend-core/src/fetch/TableFetch.ts b/packages/frontend-core/src/fetch/TableFetch.ts index 67cac6b6a7..c39c9341fc 100644 --- a/packages/frontend-core/src/fetch/TableFetch.ts +++ b/packages/frontend-core/src/fetch/TableFetch.ts @@ -1,5 +1,5 @@ import { get } from "svelte/store" -import DataFetch from "./DataFetch" +import BaseDataFetch from "./DataFetch" import { SortOrder, Table } from "@budibase/types" interface TableDatasource { @@ -7,7 +7,7 @@ interface TableDatasource { tableId: string } -export default class TableFetch extends DataFetch { +export default class TableFetch extends BaseDataFetch { async determineFeatureFlags() { return { supportsSearch: true, diff --git a/packages/frontend-core/src/fetch/UserFetch.ts b/packages/frontend-core/src/fetch/UserFetch.ts index 36aebac506..2632337d64 100644 --- a/packages/frontend-core/src/fetch/UserFetch.ts +++ b/packages/frontend-core/src/fetch/UserFetch.ts @@ -1,5 +1,5 @@ import { get } from "svelte/store" -import DataFetch, { DataFetchParams } from "./DataFetch" +import BaseDataFetch, { DataFetchParams } from "./DataFetch" import { TableNames } from "../constants" import { utils } from "@budibase/shared-core" import { SearchFilters, SearchUsersRequest } from "@budibase/types" @@ -16,7 +16,7 @@ interface UserDatasource { interface UserDefinition {} -export default class UserFetch extends DataFetch< +export default class UserFetch extends BaseDataFetch< UserDatasource, UserDefinition, UserFetchQuery diff --git a/packages/frontend-core/src/fetch/ViewFetch.ts b/packages/frontend-core/src/fetch/ViewFetch.ts index df00b9bbfc..219f17ee2c 100644 --- a/packages/frontend-core/src/fetch/ViewFetch.ts +++ b/packages/frontend-core/src/fetch/ViewFetch.ts @@ -1,5 +1,5 @@ import { Table } from "@budibase/types" -import DataFetch from "./DataFetch" +import BaseDataFetch from "./DataFetch" type ViewV1Datasource = { type: "view" @@ -10,7 +10,7 @@ type ViewV1Datasource = { groupBy: string } -export default class ViewFetch extends DataFetch { +export default class ViewFetch extends BaseDataFetch { async getDefinition() { const { datasource } = this.options diff --git a/packages/frontend-core/src/fetch/ViewV2Fetch.ts b/packages/frontend-core/src/fetch/ViewV2Fetch.ts index aa5fbd60a2..029047c5fb 100644 --- a/packages/frontend-core/src/fetch/ViewV2Fetch.ts +++ b/packages/frontend-core/src/fetch/ViewV2Fetch.ts @@ -1,5 +1,5 @@ import { SortOrder, ViewV2Enriched, ViewV2Type } from "@budibase/types" -import DataFetch from "./DataFetch" +import BaseDataFetch from "./DataFetch" import { get } from "svelte/store" import { helpers } from "@budibase/shared-core" @@ -8,7 +8,7 @@ interface ViewDatasource { id: string } -export default class ViewV2Fetch extends DataFetch< +export default class ViewV2Fetch extends BaseDataFetch< ViewDatasource, ViewV2Enriched > { From 79039a1c30fe4a59a11fc8edaaf5f8aa1bfc5051 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Tue, 14 Jan 2025 10:52:08 +0100 Subject: [PATCH 03/20] Use union type --- .../src/components/grid/stores/rows.ts | 5 ++--- packages/frontend-core/src/fetch/index.ts | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/packages/frontend-core/src/components/grid/stores/rows.ts b/packages/frontend-core/src/components/grid/stores/rows.ts index 07fbf02134..159a01a86f 100644 --- a/packages/frontend-core/src/components/grid/stores/rows.ts +++ b/packages/frontend-core/src/components/grid/stores/rows.ts @@ -1,5 +1,5 @@ import { writable, derived, get, Writable, Readable } from "svelte/store" -import { fetchData } from "../../../fetch" +import { DataFetch, fetchData } from "../../../fetch" import { NewRowID, RowPageSize } from "../lib/constants" import { generateRowID, @@ -13,7 +13,6 @@ import { sleep } from "../../../utils/utils" import { FieldType, Row, UIRow } from "@budibase/types" import { getRelatedTableValues } from "../../../utils" import { Store as StoreContext } from "." -import DataFetch from "../../../fetch/DataFetch" interface IndexedUIRow extends UIRow { __idx: number @@ -21,7 +20,7 @@ interface IndexedUIRow extends UIRow { interface RowStore { rows: Writable - fetch: Writable | null> // TODO: type this properly, having a union of all the possible options + fetch: Writable loaded: Writable refreshing: Writable loading: Writable diff --git a/packages/frontend-core/src/fetch/index.ts b/packages/frontend-core/src/fetch/index.ts index 4b9de01dae..1c1d6671e6 100644 --- a/packages/frontend-core/src/fetch/index.ts +++ b/packages/frontend-core/src/fetch/index.ts @@ -31,6 +31,20 @@ export const DataFetchMap = { queryarray: QueryArrayFetch, } +export type DataFetch = + | TableFetch + | ViewFetch + | ViewV2Fetch + | QueryFetch + | RelationshipFetch + | UserFetch + | GroupUserFetch + | CustomFetch + | NestedProviderFetch + | FieldFetch<"field"> + | JSONArrayFetch + | QueryArrayFetch + // Constructs a new fetch model for a certain datasource export const fetchData = ({ API, From bd1a04ff1bcdb49c01b14b9ffa41353bd223f7d8 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Tue, 14 Jan 2025 11:01:41 +0100 Subject: [PATCH 04/20] Type UIDatasource --- packages/types/src/ui/stores/grid/datasource.ts | 2 +- packages/types/src/ui/stores/grid/table.ts | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/types/src/ui/stores/grid/datasource.ts b/packages/types/src/ui/stores/grid/datasource.ts index 9927518133..f4210f6725 100644 --- a/packages/types/src/ui/stores/grid/datasource.ts +++ b/packages/types/src/ui/stores/grid/datasource.ts @@ -1,6 +1,6 @@ import { UITable, UIView } from "@budibase/types" -export type UIDatasource = UITable | UIView +export type UIDatasource = UITable | (Omit & { type: "viewV2" }) export interface UIFieldMutation { visible?: boolean diff --git a/packages/types/src/ui/stores/grid/table.ts b/packages/types/src/ui/stores/grid/table.ts index e69f9fd38f..7b6d659e4c 100644 --- a/packages/types/src/ui/stores/grid/table.ts +++ b/packages/types/src/ui/stores/grid/table.ts @@ -8,10 +8,9 @@ import { UISearchFilter, } from "@budibase/types" -export interface UITable extends Omit { +export interface UITable extends Table { name: string id: string - type: string tableId: string primaryDisplay?: string sort?: { From bcbf16a69b6b91c415bb6a4b8e0119d9f06e35a7 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Tue, 14 Jan 2025 11:25:26 +0100 Subject: [PATCH 05/20] Typing defititions --- .../src/components/grid/stores/datasource.ts | 34 +++++++++++++------ packages/frontend-core/src/fetch/index.ts | 9 +++++ 2 files changed, 32 insertions(+), 11 deletions(-) diff --git a/packages/frontend-core/src/components/grid/stores/datasource.ts b/packages/frontend-core/src/components/grid/stores/datasource.ts index 805ace5a8f..588f373152 100644 --- a/packages/frontend-core/src/components/grid/stores/datasource.ts +++ b/packages/frontend-core/src/components/grid/stores/datasource.ts @@ -1,7 +1,11 @@ // TODO: datasource and defitions are unions of the different implementations. At this point, the datasource does not know what type is being used, and the assignations will cause TS exceptions. Casting it "as any" for now. This should be fixed improving the type usages. import { derived, get, Readable, Writable } from "svelte/store" -import { getDatasourceDefinition, getDatasourceSchema } from "../../../fetch" +import { + DataFetchDefinition, + getDatasourceDefinition, + getDatasourceSchema, +} from "../../../fetch" import { enrichSchemaWithRelColumns, memo } from "../../../utils" import { cloneDeep } from "lodash" import { @@ -18,7 +22,7 @@ import { Store as StoreContext, BaseStoreProps } from "." import { DatasourceActions } from "./datasources" interface DatasourceStore { - definition: Writable + definition: Writable schemaMutations: Writable> subSchemaMutations: Writable>> } @@ -131,11 +135,17 @@ export const deriveStores = (context: StoreContext): DerivedDatasourceStore => { [datasource, definition], ([$datasource, $definition]) => { let type = $datasource?.type + // @ts-expect-error if (type === "provider") { type = ($datasource as any).value?.datasource?.type // TODO: see line 1 } // Handle calculation views - if (type === "viewV2" && $definition?.type === ViewV2Type.CALCULATION) { + if ( + type === "viewV2" && + $definition && + "type" in $definition && + $definition.type === ViewV2Type.CALCULATION + ) { return false } return !!type && ["table", "viewV2", "link"].includes(type) @@ -197,7 +207,7 @@ export const createActions = (context: StoreContext): ActionDatasourceStore => { ) => { // Update local state const originalDefinition = get(definition) - definition.set(newDefinition as UIDatasource) + definition.set(newDefinition) // Update server if (get(config).canSaveSchema) { @@ -225,13 +235,15 @@ export const createActions = (context: StoreContext): ActionDatasourceStore => { // Update primary display newDefinition.primaryDisplay = column - // Sanitise schema to ensure field is required and has no default value - if (!newDefinition.schema[column].constraints) { - newDefinition.schema[column].constraints = {} - } - newDefinition.schema[column].constraints.presence = { allowEmpty: false } - if ("default" in newDefinition.schema[column]) { - delete newDefinition.schema[column].default + if (newDefinition.schema) { + // Sanitise schema to ensure field is required and has no default value + if (!newDefinition.schema[column].constraints) { + newDefinition.schema[column].constraints = {} + } + newDefinition.schema[column].constraints.presence = { allowEmpty: false } + if ("default" in newDefinition.schema[column]) { + delete newDefinition.schema[column].default + } } return await saveDefinition(newDefinition as any) // TODO: see line 1 } diff --git a/packages/frontend-core/src/fetch/index.ts b/packages/frontend-core/src/fetch/index.ts index 1c1d6671e6..dee0c9dbf2 100644 --- a/packages/frontend-core/src/fetch/index.ts +++ b/packages/frontend-core/src/fetch/index.ts @@ -11,6 +11,7 @@ import GroupUserFetch from "./GroupUserFetch" import CustomFetch from "./CustomFetch" import QueryArrayFetch from "./QueryArrayFetch" import { APIClient } from "../api/types" +import { Table, ViewV2Enriched } from "@budibase/types" export type DataFetchType = keyof typeof DataFetchMap @@ -45,6 +46,14 @@ export type DataFetch = | JSONArrayFetch | QueryArrayFetch +export type DataFetchDefinition = + | Table + | ViewV2Enriched + | { + schema?: Record | null + primaryDisplay?: string + } + // Constructs a new fetch model for a certain datasource export const fetchData = ({ API, From 9f5f0d468e7b3c5d2f1769975aca28e6c2dfc47e Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Tue, 14 Jan 2025 11:26:37 +0100 Subject: [PATCH 06/20] Remove TODO --- packages/frontend-core/src/components/grid/stores/rows.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/frontend-core/src/components/grid/stores/rows.ts b/packages/frontend-core/src/components/grid/stores/rows.ts index 159a01a86f..7e58808327 100644 --- a/packages/frontend-core/src/components/grid/stores/rows.ts +++ b/packages/frontend-core/src/components/grid/stores/rows.ts @@ -253,7 +253,7 @@ export const createActions = (context: StoreContext): RowActionStore => { // Reset state properties when dataset changes if (!$instanceLoaded || resetRows) { - definition.set($fetch.definition as any) // TODO: datasource and defitions are unions of the different implementations. At this point, the datasource does not know what type is being used, and the assignations will cause TS exceptions. Casting it "as any" for now. This should be fixed improving the type usages. + definition.set($fetch.definition ?? null) } // Reset scroll state when data changes From 4afaa85b846453636c537fa301061255fed49ce7 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Tue, 14 Jan 2025 11:46:58 +0100 Subject: [PATCH 07/20] Types --- packages/client/src/{constants.js => constants.ts} | 0 packages/client/src/sdk.ts | 9 +++++++++ 2 files changed, 9 insertions(+) rename packages/client/src/{constants.js => constants.ts} (100%) create mode 100644 packages/client/src/sdk.ts diff --git a/packages/client/src/constants.js b/packages/client/src/constants.ts similarity index 100% rename from packages/client/src/constants.js rename to packages/client/src/constants.ts diff --git a/packages/client/src/sdk.ts b/packages/client/src/sdk.ts new file mode 100644 index 0000000000..8c9413fb37 --- /dev/null +++ b/packages/client/src/sdk.ts @@ -0,0 +1,9 @@ +import { APIClient } from "@budibase/frontend-core" +import type { ActionTypes } from "./constants" + +export interface SDK { + API: APIClient + styleable: unknown + Provider: unknown + ActionTypes: typeof ActionTypes +} From f1680f494197105c5034f404869979a2af77ac96 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Tue, 14 Jan 2025 11:47:46 +0100 Subject: [PATCH 08/20] Fix imports --- packages/client/src/stores/components.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/client/src/stores/components.js b/packages/client/src/stores/components.js index d4afa6c7f1..48ade99321 100644 --- a/packages/client/src/stores/components.js +++ b/packages/client/src/stores/components.js @@ -6,7 +6,7 @@ import { screenStore } from "./screens" import { builderStore } from "./builder" import Router from "../components/Router.svelte" import * as AppComponents from "../components/app/index.js" -import { ScreenslotType } from "../constants.js" +import { ScreenslotType } from "../constants" export const BudibasePrefix = "@budibase/standard-components/" From 85ab9e3ce3335f609c89630e1bb13a777b806677 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Tue, 14 Jan 2025 11:51:19 +0100 Subject: [PATCH 09/20] Type and export --- packages/frontend-core/src/fetch/DataFetch.ts | 2 +- packages/frontend-core/src/fetch/index.ts | 1 + packages/frontend-core/src/index.ts | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/frontend-core/src/fetch/DataFetch.ts b/packages/frontend-core/src/fetch/DataFetch.ts index 75c454e2ac..b82cac2d5e 100644 --- a/packages/frontend-core/src/fetch/DataFetch.ts +++ b/packages/frontend-core/src/fetch/DataFetch.ts @@ -435,7 +435,7 @@ export default abstract class BaseDataFetch< * Resets the data set and updates options * @param newOptions any new options */ - async update(newOptions: any) { + async update(newOptions: DataFetchOptions) { // Check if any settings have actually changed let refresh = false for (const [key, value] of Object.entries(newOptions || {})) { diff --git a/packages/frontend-core/src/fetch/index.ts b/packages/frontend-core/src/fetch/index.ts index dee0c9dbf2..2bb6e09000 100644 --- a/packages/frontend-core/src/fetch/index.ts +++ b/packages/frontend-core/src/fetch/index.ts @@ -14,6 +14,7 @@ import { APIClient } from "../api/types" import { Table, ViewV2Enriched } from "@budibase/types" export type DataFetchType = keyof typeof DataFetchMap +export type { DataFetchOptions } from "./DataFetch" export const DataFetchMap = { table: TableFetch, diff --git a/packages/frontend-core/src/index.ts b/packages/frontend-core/src/index.ts index fd5595e04d..11354be49d 100644 --- a/packages/frontend-core/src/index.ts +++ b/packages/frontend-core/src/index.ts @@ -1,7 +1,7 @@ export { createAPIClient } from "./api" export type { APIClient } from "./api" export { fetchData, DataFetchMap } from "./fetch" -export type { DataFetchType } from "./fetch" +export type { DataFetchType, DataFetchOptions } from "./fetch" export * as Constants from "./constants" export * from "./stores" export * from "./utils" From 7d284ae50e062d943c141d2fcf8279b8909dfeaf Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Tue, 14 Jan 2025 11:57:20 +0100 Subject: [PATCH 10/20] Type DataProvider --- .../src/components/app/DataProvider.svelte | 40 +++++++++++++------ packages/client/src/{sdk.ts => index.ts} | 5 +++ packages/frontend-core/src/fetch/DataFetch.ts | 2 +- 3 files changed, 34 insertions(+), 13 deletions(-) rename packages/client/src/{sdk.ts => index.ts} (70%) diff --git a/packages/client/src/components/app/DataProvider.svelte b/packages/client/src/components/app/DataProvider.svelte index e6629aa3f3..8b06190727 100644 --- a/packages/client/src/components/app/DataProvider.svelte +++ b/packages/client/src/components/app/DataProvider.svelte @@ -1,8 +1,18 @@ -