@budibase/frontend-core 3.21.0 → 3.21.2
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.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@budibase/frontend-core",
|
|
3
|
-
"version": "3.21.
|
|
3
|
+
"version": "3.21.2",
|
|
4
4
|
"description": "Budibase frontend core libraries used in builder and client",
|
|
5
5
|
"author": "Budibase",
|
|
6
6
|
"license": "MPL-2.0",
|
|
@@ -17,5 +17,5 @@
|
|
|
17
17
|
"shortid": "2.2.15",
|
|
18
18
|
"socket.io-client": "^4.7.5"
|
|
19
19
|
},
|
|
20
|
-
"gitHead": "
|
|
20
|
+
"gitHead": "c040bbfadf1faab16b7e07a56037204de3e0a311"
|
|
21
21
|
}
|
package/src/api/datasources.ts
CHANGED
|
@@ -7,6 +7,8 @@ import {
|
|
|
7
7
|
DeleteDatasourceResponse,
|
|
8
8
|
FetchDatasourceInfoRequest,
|
|
9
9
|
FetchDatasourceInfoResponse,
|
|
10
|
+
FetchDatasourceViewInfoRequest,
|
|
11
|
+
FetchDatasourceViewInfoResponse,
|
|
10
12
|
FetchExternalSchemaResponse,
|
|
11
13
|
UpdateDatasourceRequest,
|
|
12
14
|
UpdateDatasourceResponse,
|
|
@@ -37,6 +39,9 @@ export interface DatasourceEndpoints {
|
|
|
37
39
|
fetchInfoForDatasource: (
|
|
38
40
|
datasource: Datasource
|
|
39
41
|
) => Promise<FetchDatasourceInfoResponse>
|
|
42
|
+
fetchViewInfoForDatasource: (
|
|
43
|
+
datasource: Datasource
|
|
44
|
+
) => Promise<FetchDatasourceViewInfoResponse>
|
|
40
45
|
fetchExternalSchema: (
|
|
41
46
|
datasourceId: string
|
|
42
47
|
) => Promise<FetchExternalSchemaResponse>
|
|
@@ -121,6 +126,19 @@ export const buildDatasourceEndpoints = (
|
|
|
121
126
|
})
|
|
122
127
|
},
|
|
123
128
|
|
|
129
|
+
/**
|
|
130
|
+
* Fetch view names and definitions available within the datasource
|
|
131
|
+
*/
|
|
132
|
+
fetchViewInfoForDatasource: async (datasource: Datasource) => {
|
|
133
|
+
return await API.post<
|
|
134
|
+
FetchDatasourceViewInfoRequest,
|
|
135
|
+
FetchDatasourceViewInfoResponse
|
|
136
|
+
>({
|
|
137
|
+
url: `/api/datasources/views`,
|
|
138
|
+
body: { datasource },
|
|
139
|
+
})
|
|
140
|
+
},
|
|
141
|
+
|
|
124
142
|
/**
|
|
125
143
|
* Fetches the external schema of a datasource
|
|
126
144
|
*/
|
|
@@ -9,8 +9,11 @@ export default class JSONArrayFetch extends FieldFetch<JSONArrayFieldDatasource>
|
|
|
9
9
|
// JSON arrays need their table definitions fetched.
|
|
10
10
|
// We can then extract their schema as a subset of the table schema.
|
|
11
11
|
try {
|
|
12
|
+
const { fieldName } = datasource
|
|
12
13
|
const table = await this.API.fetchTableDefinition(datasource.tableId)
|
|
13
|
-
const schema =
|
|
14
|
+
const schema =
|
|
15
|
+
table.schema[fieldName].schema ??
|
|
16
|
+
getJSONArrayDatasourceSchema(table.schema, datasource)
|
|
14
17
|
return { schema }
|
|
15
18
|
} catch (error) {
|
|
16
19
|
return null
|