Proper type QueryArrayFetch
This commit is contained in:
parent
0112087af1
commit
af0312e5fe
|
@ -14,12 +14,12 @@ export default class QueryArrayFetch extends FieldFetch {
|
||||||
try {
|
try {
|
||||||
const table = await this.API.fetchQueryDefinition(datasource.tableId)
|
const table = await this.API.fetchQueryDefinition(datasource.tableId)
|
||||||
const schema = generateQueryArraySchemas(
|
const schema = generateQueryArraySchemas(
|
||||||
table?.schema,
|
table.schema,
|
||||||
table?.nestedSchemaFields
|
table.nestedSchemaFields
|
||||||
)
|
)
|
||||||
const result: {
|
const result = {
|
||||||
schema: Record<string, any> | null
|
schema: getJSONArrayDatasourceSchema(schema, datasource),
|
||||||
} = { schema: getJSONArrayDatasourceSchema(schema, datasource) }
|
}
|
||||||
|
|
||||||
return result
|
return result
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
import { QuerySchema } from "@budibase/types"
|
||||||
|
|
||||||
|
type Schema = Record<string, QuerySchema | string>
|
||||||
|
|
||||||
|
export const getJSONArrayDatasourceSchema: (
|
||||||
|
tableSchema: Schema,
|
||||||
|
datasource: any
|
||||||
|
) => Record<string, { type: string; name: string; prefixKeys: string }>
|
||||||
|
|
||||||
|
export const generateQueryArraySchemas: (
|
||||||
|
schema: Schema,
|
||||||
|
nestedSchemaFields?: Record<string, Schema>
|
||||||
|
) => Schema
|
Loading…
Reference in New Issue