@budibase/frontend-core 3.2.37 → 3.2.39

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/package.json +2 -2
  2. package/src/api/configs.ts +2 -2
  3. package/src/api/index.ts +4 -8
  4. package/src/api/types.ts +2 -3
  5. package/src/api/views.ts +12 -2
  6. package/src/api/viewsV2.ts +9 -4
  7. package/src/components/grid/lib/{renderers.js → renderers.ts} +14 -4
  8. package/src/components/grid/lib/{websocket.js → websocket.ts} +6 -4
  9. package/src/components/grid/stores/config.ts +1 -1
  10. package/src/components/grid/stores/datasource.ts +12 -10
  11. package/src/components/grid/stores/rows.ts +5 -4
  12. package/src/constants.ts +2 -2
  13. package/src/fetch/{CustomFetch.js → CustomFetch.ts} +24 -12
  14. package/src/fetch/{DataFetch.js → DataFetch.ts} +158 -94
  15. package/src/fetch/FieldFetch.ts +67 -0
  16. package/src/fetch/{GroupUserFetch.js → GroupUserFetch.ts} +21 -5
  17. package/src/fetch/{JSONArrayFetch.js → JSONArrayFetch.ts} +5 -3
  18. package/src/fetch/NestedProviderFetch.ts +40 -0
  19. package/src/fetch/{QueryArrayFetch.js → QueryArrayFetch.ts} +12 -6
  20. package/src/fetch/{QueryFetch.js → QueryFetch.ts} +27 -9
  21. package/src/fetch/RelationshipFetch.ts +49 -0
  22. package/src/fetch/{TableFetch.js → TableFetch.ts} +27 -5
  23. package/src/fetch/{UserFetch.js → UserFetch.ts} +31 -14
  24. package/src/fetch/ViewFetch.ts +51 -0
  25. package/src/fetch/{ViewV2Fetch.js → ViewV2Fetch.ts} +46 -24
  26. package/src/fetch/index.ts +93 -0
  27. package/src/index.ts +2 -1
  28. package/src/utils/json.d.ts +23 -0
  29. package/src/utils/utils.js +3 -0
  30. package/src/components/grid/lib/utils.js +0 -32
  31. package/src/fetch/FieldFetch.js +0 -44
  32. package/src/fetch/NestedProviderFetch.js +0 -21
  33. package/src/fetch/RelationshipFetch.js +0 -20
  34. package/src/fetch/ViewFetch.js +0 -23
  35. package/src/fetch/index.js +0 -57
  36. /package/src/components/grid/lib/{constants.js → constants.ts} +0 -0
@@ -1,57 +0,0 @@
1
- import TableFetch from "./TableFetch.js"
2
- import ViewFetch from "./ViewFetch.js"
3
- import ViewV2Fetch from "./ViewV2Fetch.js"
4
- import QueryFetch from "./QueryFetch.js"
5
- import RelationshipFetch from "./RelationshipFetch.js"
6
- import NestedProviderFetch from "./NestedProviderFetch.js"
7
- import FieldFetch from "./FieldFetch.js"
8
- import JSONArrayFetch from "./JSONArrayFetch.js"
9
- import UserFetch from "./UserFetch.js"
10
- import GroupUserFetch from "./GroupUserFetch.js"
11
- import CustomFetch from "./CustomFetch.js"
12
- import QueryArrayFetch from "./QueryArrayFetch.js"
13
-
14
- const DataFetchMap = {
15
- table: TableFetch,
16
- view: ViewFetch,
17
- viewV2: ViewV2Fetch,
18
- query: QueryFetch,
19
- link: RelationshipFetch,
20
- user: UserFetch,
21
- groupUser: GroupUserFetch,
22
- custom: CustomFetch,
23
-
24
- // Client specific datasource types
25
- provider: NestedProviderFetch,
26
- field: FieldFetch,
27
- jsonarray: JSONArrayFetch,
28
- queryarray: QueryArrayFetch,
29
- }
30
-
31
- // Constructs a new fetch model for a certain datasource
32
- export const fetchData = ({ API, datasource, options }) => {
33
- const Fetch = DataFetchMap[datasource?.type] || TableFetch
34
- return new Fetch({ API, datasource, ...options })
35
- }
36
-
37
- // Creates an empty fetch instance with no datasource configured, so no data
38
- // will initially be loaded
39
- const createEmptyFetchInstance = ({ API, datasource }) => {
40
- const handler = DataFetchMap[datasource?.type]
41
- if (!handler) {
42
- return null
43
- }
44
- return new handler({ API })
45
- }
46
-
47
- // Fetches the definition of any type of datasource
48
- export const getDatasourceDefinition = async ({ API, datasource }) => {
49
- const instance = createEmptyFetchInstance({ API, datasource })
50
- return await instance?.getDefinition(datasource)
51
- }
52
-
53
- // Fetches the schema of any type of datasource
54
- export const getDatasourceSchema = ({ API, datasource, definition }) => {
55
- const instance = createEmptyFetchInstance({ API, datasource })
56
- return instance?.getSchema(datasource, definition)
57
- }