UNPKG

@graphile/postgis

Version:

PostGIS support for PostGraphile

42 lines 1.62 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const constants_1 = require("./constants"); const plugin = builder => { builder.hook("inflection", inflection => { return Object.assign(Object.assign({}, inflection), { gisType(type, subtype, hasZ, hasM) { return this.upperCamelCase([ type.name, constants_1.SUBTYPE_STRING_BY_SUBTYPE[subtype], hasZ ? "z" : null, hasM ? "m" : null, ] .filter(_ => _) .join("-")); }, gisInterfaceName(type) { return this.upperCamelCase(`${type.name}-interface`); }, gisDimensionInterfaceName(type, hasZ, hasM) { return this.upperCamelCase([ type.name, constants_1.SUBTYPE_STRING_BY_SUBTYPE[0], hasZ ? "z" : null, hasM ? "m" : null, ] .filter(_ => _) .join("-")); }, geojsonFieldName() { return `geojson`; }, gisXFieldName(type) { return type.name === "geography" ? "longitude" : "x"; }, gisYFieldName(type) { return type.name === "geography" ? "latitude" : "y"; }, gisZFieldName(type) { return type.name === "geography" ? "height" : "z"; } }); }); }; exports.default = plugin; //# sourceMappingURL=PostgisInflectionPlugin.js.map