UNPKG

@directus/api

Version:

Directus is a real-time API and App dashboard for managing SQL database content

31 lines (29 loc) 1.15 kB
import { GraphQLBigInt } from "../services/graphql/types/bigint.js"; import { GraphQLDate } from "../services/graphql/types/date.js"; import { GraphQLGeoJSON } from "../services/graphql/types/geojson.js"; import { GraphQLHash } from "../services/graphql/types/hash.js"; import { GraphQLBoolean, GraphQLFloat, GraphQLID, GraphQLInt, GraphQLList, GraphQLScalarType, GraphQLString } from "graphql"; import { GraphQLJSON } from "graphql-compose"; //#region src/utils/get-graphql-type.ts function getGraphQLType(localType, special) { if (special.includes("conceal")) return GraphQLHash; switch (localType) { case "boolean": return GraphQLBoolean; case "bigInteger": return GraphQLBigInt; case "integer": return GraphQLInt; case "decimal": case "float": return GraphQLFloat; case "csv": return new GraphQLList(GraphQLString); case "json": return GraphQLJSON; case "geometry": return GraphQLGeoJSON; case "time": case "timestamp": case "dateTime": case "date": return GraphQLDate; case "hash": return GraphQLHash; case "uuid": return GraphQLID; default: return GraphQLString; } } //#endregion export { getGraphQLType };