Unify enums
This commit is contained in:
parent
daff1a46d8
commit
0202db3efe
|
@ -9,7 +9,10 @@ import { Constants } from "@budibase/frontend-core"
|
||||||
|
|
||||||
const { TypeIconMap } = Constants
|
const { TypeIconMap } = Constants
|
||||||
|
|
||||||
export { RelationshipType } from "@budibase/types"
|
export {
|
||||||
|
RelationshipType,
|
||||||
|
RowExportFormat as ROW_EXPORT_FORMATS,
|
||||||
|
} from "@budibase/types"
|
||||||
|
|
||||||
export const AUTO_COLUMN_SUB_TYPES = AutoFieldSubType
|
export const AUTO_COLUMN_SUB_TYPES = AutoFieldSubType
|
||||||
|
|
||||||
|
@ -307,9 +310,3 @@ export const DatasourceTypes = {
|
||||||
GRAPH: "Graph",
|
GRAPH: "Graph",
|
||||||
API: "API",
|
API: "API",
|
||||||
}
|
}
|
||||||
|
|
||||||
export const ROW_EXPORT_FORMATS = {
|
|
||||||
CSV: "csv",
|
|
||||||
JSON: "json",
|
|
||||||
JSON_WITH_SCHEMA: "jsonWithSchema",
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
import { Row, TableSchema } from "@budibase/types"
|
import { Row, RowExportFormat, TableSchema } from "@budibase/types"
|
||||||
|
|
||||||
|
export { RowExportFormat as Format } from "@budibase/types"
|
||||||
|
|
||||||
function getHeaders(
|
function getHeaders(
|
||||||
headers: string[],
|
headers: string[],
|
||||||
|
@ -46,14 +48,8 @@ export function jsonWithSchema(schema: TableSchema, rows: Row[]) {
|
||||||
return JSON.stringify({ schema: newSchema, rows }, undefined, 2)
|
return JSON.stringify({ schema: newSchema, rows }, undefined, 2)
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum Format {
|
export function isFormat(format: any): format is RowExportFormat {
|
||||||
CSV = "csv",
|
return Object.values(RowExportFormat).includes(format as RowExportFormat)
|
||||||
JSON = "json",
|
|
||||||
JSON_WITH_SCHEMA = "jsonWithSchema",
|
|
||||||
}
|
|
||||||
|
|
||||||
export function isFormat(format: any): format is Format {
|
|
||||||
return Object.values(Format).includes(format as Format)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function parseCsvExport<T>(value: string) {
|
export function parseCsvExport<T>(value: string) {
|
||||||
|
|
|
@ -30,3 +30,9 @@ export interface SearchResponse<T> {
|
||||||
bookmark?: string | number
|
bookmark?: string | number
|
||||||
totalRows?: number
|
totalRows?: number
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export enum RowExportFormat {
|
||||||
|
CSV = "csv",
|
||||||
|
JSON = "json",
|
||||||
|
JSON_WITH_SCHEMA = "jsonWithSchema",
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue