graphile-postgis 0.1.0 → 0.1.1
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/LICENSE +3 -1
- package/PostgisExtensionDetectionPlugin.d.ts +3 -0
- package/PostgisExtensionDetectionPlugin.js +28 -0
- package/PostgisInflectionPlugin.d.ts +3 -0
- package/PostgisInflectionPlugin.js +36 -0
- package/PostgisRegisterTypesPlugin.d.ts +3 -0
- package/PostgisRegisterTypesPlugin.js +232 -0
- package/PostgisVersionPlugin.d.ts +3 -0
- package/PostgisVersionPlugin.js +23 -0
- package/Postgis_GeometryCollection_GeometriesPlugin.d.ts +3 -0
- package/Postgis_GeometryCollection_GeometriesPlugin.js +43 -0
- package/Postgis_LineString_PointsPlugin.d.ts +3 -0
- package/Postgis_LineString_PointsPlugin.js +40 -0
- package/Postgis_MultiLineString_LineStringsPlugin.d.ts +3 -0
- package/Postgis_MultiLineString_LineStringsPlugin.js +38 -0
- package/Postgis_MultiPoint_PointsPlugin.d.ts +3 -0
- package/Postgis_MultiPoint_PointsPlugin.js +38 -0
- package/Postgis_MultiPolygon_PolygonsPlugin.d.ts +3 -0
- package/Postgis_MultiPolygon_PolygonsPlugin.js +38 -0
- package/Postgis_Point_LatitudeLongitudePlugin.d.ts +3 -0
- package/Postgis_Point_LatitudeLongitudePlugin.js +43 -0
- package/Postgis_Polygon_RingsPlugin.d.ts +3 -0
- package/Postgis_Polygon_RingsPlugin.js +49 -0
- package/README.md +125 -5
- package/constants.d.ts +12 -0
- package/constants.js +34 -0
- package/esm/PostgisExtensionDetectionPlugin.js +26 -0
- package/esm/PostgisInflectionPlugin.js +34 -0
- package/esm/PostgisRegisterTypesPlugin.js +227 -0
- package/esm/PostgisVersionPlugin.js +21 -0
- package/esm/Postgis_GeometryCollection_GeometriesPlugin.js +41 -0
- package/esm/Postgis_LineString_PointsPlugin.js +38 -0
- package/esm/Postgis_MultiLineString_LineStringsPlugin.js +36 -0
- package/esm/Postgis_MultiPoint_PointsPlugin.js +36 -0
- package/esm/Postgis_MultiPolygon_PolygonsPlugin.js +36 -0
- package/esm/Postgis_Point_LatitudeLongitudePlugin.js +41 -0
- package/esm/Postgis_Polygon_RingsPlugin.js +47 -0
- package/esm/constants.js +31 -0
- package/esm/index.js +33 -0
- package/esm/makeGeoJSONType.js +39 -0
- package/esm/types.js +1 -0
- package/esm/utils.js +47 -0
- package/index.d.ts +15 -0
- package/index.js +49 -0
- package/makeGeoJSONType.d.ts +1 -0
- package/makeGeoJSONType.js +42 -0
- package/package.json +37 -52
- package/types.d.ts +59 -0
- package/types.js +2 -0
- package/utils.d.ts +5 -0
- package/utils.js +53 -0
- package/main/PostgisExtensionDetectionPlugin.js +0 -43
- package/main/PostgisInflectionPlugin.js +0 -51
- package/main/PostgisRegisterTypesPlugin.js +0 -347
- package/main/Postgis_GeometryCollection_GeometriesPlugin.js +0 -55
- package/main/Postgis_LineString_PointsPlugin.js +0 -51
- package/main/Postgis_MultiLineString_LineStringsPlugin.js +0 -51
- package/main/Postgis_MultiPoint_PointsPlugin.js +0 -51
- package/main/Postgis_MultiPolygon_PolygonsPlugin.js +0 -51
- package/main/Postgis_Point_LatitudeLongitudePlugin.js +0 -59
- package/main/Postgis_Polygon_RingsPlugin.js +0 -64
- package/main/constants.js +0 -39
- package/main/index.js +0 -93
- package/main/makeGeoJSONType.js +0 -89
- package/main/utils.js +0 -56
- package/module/PostgisExtensionDetectionPlugin.js +0 -31
- package/module/PostgisInflectionPlugin.js +0 -44
- package/module/PostgisRegisterTypesPlugin.js +0 -267
- package/module/Postgis_GeometryCollection_GeometriesPlugin.js +0 -57
- package/module/Postgis_LineString_PointsPlugin.js +0 -53
- package/module/Postgis_MultiLineString_LineStringsPlugin.js +0 -51
- package/module/Postgis_MultiPoint_PointsPlugin.js +0 -51
- package/module/Postgis_MultiPolygon_PolygonsPlugin.js +0 -51
- package/module/Postgis_Point_LatitudeLongitudePlugin.js +0 -64
- package/module/Postgis_Polygon_RingsPlugin.js +0 -66
- package/module/constants.js +0 -30
- package/module/index.js +0 -32
- package/module/makeGeoJSONType.js +0 -79
- package/module/utils.js +0 -40
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { GisSubtype } from './constants';
|
|
2
|
+
import { getGISTypeName } from './utils';
|
|
3
|
+
const PostgisMultiLineStringLineStringsPlugin = (builder) => {
|
|
4
|
+
builder.hook('GraphQLObjectType:fields', (fields, build, context) => {
|
|
5
|
+
const { scope: { isPgGISType, pgGISType, pgGISTypeDetails } } = context;
|
|
6
|
+
if (!isPgGISType ||
|
|
7
|
+
!pgGISType ||
|
|
8
|
+
!pgGISTypeDetails ||
|
|
9
|
+
pgGISTypeDetails.subtype !== GisSubtype.MultiLineString) {
|
|
10
|
+
return fields;
|
|
11
|
+
}
|
|
12
|
+
const { extend, getPostgisTypeByGeometryType, graphql: { GraphQLList } } = build;
|
|
13
|
+
const { hasZ, hasM, srid } = pgGISTypeDetails;
|
|
14
|
+
const LineString = getPostgisTypeByGeometryType(pgGISType, GisSubtype.LineString, hasZ, hasM, srid);
|
|
15
|
+
if (!LineString) {
|
|
16
|
+
return fields;
|
|
17
|
+
}
|
|
18
|
+
return extend(fields, {
|
|
19
|
+
lines: {
|
|
20
|
+
type: new GraphQLList(LineString),
|
|
21
|
+
resolve(data) {
|
|
22
|
+
const multiLineString = data.__geojson;
|
|
23
|
+
return multiLineString.coordinates.map((coord) => ({
|
|
24
|
+
__gisType: getGISTypeName(GisSubtype.LineString, hasZ, hasM),
|
|
25
|
+
__srid: data.__srid,
|
|
26
|
+
__geojson: {
|
|
27
|
+
type: 'LineString',
|
|
28
|
+
coordinates: coord
|
|
29
|
+
}
|
|
30
|
+
}));
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
export default PostgisMultiLineStringLineStringsPlugin;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { GisSubtype } from './constants';
|
|
2
|
+
import { getGISTypeName } from './utils';
|
|
3
|
+
const PostgisMultiPointPointsPlugin = (builder) => {
|
|
4
|
+
builder.hook('GraphQLObjectType:fields', (fields, build, context) => {
|
|
5
|
+
const { scope: { isPgGISType, pgGISType, pgGISTypeDetails } } = context;
|
|
6
|
+
if (!isPgGISType ||
|
|
7
|
+
!pgGISType ||
|
|
8
|
+
!pgGISTypeDetails ||
|
|
9
|
+
pgGISTypeDetails.subtype !== GisSubtype.MultiPoint) {
|
|
10
|
+
return fields;
|
|
11
|
+
}
|
|
12
|
+
const { extend, getPostgisTypeByGeometryType, graphql: { GraphQLList } } = build;
|
|
13
|
+
const { hasZ, hasM, srid } = pgGISTypeDetails;
|
|
14
|
+
const Point = getPostgisTypeByGeometryType(pgGISType, GisSubtype.Point, hasZ, hasM, srid);
|
|
15
|
+
if (!Point) {
|
|
16
|
+
return fields;
|
|
17
|
+
}
|
|
18
|
+
return extend(fields, {
|
|
19
|
+
points: {
|
|
20
|
+
type: new GraphQLList(Point),
|
|
21
|
+
resolve(data) {
|
|
22
|
+
const multiPoint = data.__geojson;
|
|
23
|
+
return multiPoint.coordinates.map((coord) => ({
|
|
24
|
+
__gisType: getGISTypeName(GisSubtype.Point, hasZ, hasM),
|
|
25
|
+
__srid: data.__srid,
|
|
26
|
+
__geojson: {
|
|
27
|
+
type: 'Point',
|
|
28
|
+
coordinates: coord
|
|
29
|
+
}
|
|
30
|
+
}));
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
export default PostgisMultiPointPointsPlugin;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { GisSubtype } from './constants';
|
|
2
|
+
import { getGISTypeName } from './utils';
|
|
3
|
+
const PostgisMultiPolygonPolygonsPlugin = (builder) => {
|
|
4
|
+
builder.hook('GraphQLObjectType:fields', (fields, build, context) => {
|
|
5
|
+
const { scope: { isPgGISType, pgGISType, pgGISTypeDetails } } = context;
|
|
6
|
+
if (!isPgGISType ||
|
|
7
|
+
!pgGISType ||
|
|
8
|
+
!pgGISTypeDetails ||
|
|
9
|
+
pgGISTypeDetails.subtype !== GisSubtype.MultiPolygon) {
|
|
10
|
+
return fields;
|
|
11
|
+
}
|
|
12
|
+
const { extend, getPostgisTypeByGeometryType, graphql: { GraphQLList } } = build;
|
|
13
|
+
const { hasZ, hasM, srid } = pgGISTypeDetails;
|
|
14
|
+
const PolygonType = getPostgisTypeByGeometryType(pgGISType, GisSubtype.Polygon, hasZ, hasM, srid);
|
|
15
|
+
if (!PolygonType) {
|
|
16
|
+
return fields;
|
|
17
|
+
}
|
|
18
|
+
return extend(fields, {
|
|
19
|
+
polygons: {
|
|
20
|
+
type: new GraphQLList(PolygonType),
|
|
21
|
+
resolve(data) {
|
|
22
|
+
const multiPolygon = data.__geojson;
|
|
23
|
+
return multiPolygon.coordinates.map((coord) => ({
|
|
24
|
+
__gisType: getGISTypeName(GisSubtype.Polygon, hasZ, hasM),
|
|
25
|
+
__srid: data.__srid,
|
|
26
|
+
__geojson: {
|
|
27
|
+
type: 'Polygon',
|
|
28
|
+
coordinates: coord
|
|
29
|
+
}
|
|
30
|
+
}));
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
export default PostgisMultiPolygonPolygonsPlugin;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { GisSubtype } from './constants';
|
|
2
|
+
const PostgisPointLatitudeLongitudePlugin = (builder) => {
|
|
3
|
+
builder.hook('GraphQLObjectType:fields', (fields, build, context) => {
|
|
4
|
+
const { scope: { isPgGISType, pgGISType, pgGISTypeDetails } } = context;
|
|
5
|
+
if (!isPgGISType || !pgGISType || !pgGISTypeDetails || pgGISTypeDetails.subtype !== GisSubtype.Point) {
|
|
6
|
+
return fields;
|
|
7
|
+
}
|
|
8
|
+
const { extend, graphql: { GraphQLNonNull, GraphQLFloat }, inflection } = build;
|
|
9
|
+
const xFieldName = inflection.gisXFieldName(pgGISType);
|
|
10
|
+
const yFieldName = inflection.gisYFieldName(pgGISType);
|
|
11
|
+
const zFieldName = inflection.gisZFieldName(pgGISType);
|
|
12
|
+
return extend(fields, {
|
|
13
|
+
[xFieldName]: {
|
|
14
|
+
type: new GraphQLNonNull(GraphQLFloat),
|
|
15
|
+
resolve(data) {
|
|
16
|
+
const point = data.__geojson;
|
|
17
|
+
return point.coordinates[0];
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
[yFieldName]: {
|
|
21
|
+
type: new GraphQLNonNull(GraphQLFloat),
|
|
22
|
+
resolve(data) {
|
|
23
|
+
const point = data.__geojson;
|
|
24
|
+
return point.coordinates[1];
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
...(pgGISTypeDetails.hasZ
|
|
28
|
+
? {
|
|
29
|
+
[zFieldName]: {
|
|
30
|
+
type: new GraphQLNonNull(GraphQLFloat),
|
|
31
|
+
resolve(data) {
|
|
32
|
+
const point = data.__geojson;
|
|
33
|
+
return point.coordinates[2];
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
: {})
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
};
|
|
41
|
+
export default PostgisPointLatitudeLongitudePlugin;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { GisSubtype } from './constants';
|
|
2
|
+
import { getGISTypeName } from './utils';
|
|
3
|
+
const PostgisPolygonRingsPlugin = (builder) => {
|
|
4
|
+
builder.hook('GraphQLObjectType:fields', (fields, build, context) => {
|
|
5
|
+
const { scope: { isPgGISType, pgGISType, pgGISTypeDetails } } = context;
|
|
6
|
+
if (!isPgGISType || !pgGISType || !pgGISTypeDetails || pgGISTypeDetails.subtype !== GisSubtype.Polygon) {
|
|
7
|
+
return fields;
|
|
8
|
+
}
|
|
9
|
+
const { extend, getPostgisTypeByGeometryType, graphql: { GraphQLList } } = build;
|
|
10
|
+
const { hasZ, hasM, srid } = pgGISTypeDetails;
|
|
11
|
+
const LineStringType = getPostgisTypeByGeometryType(pgGISType, GisSubtype.LineString, hasZ, hasM, srid);
|
|
12
|
+
if (!LineStringType) {
|
|
13
|
+
return fields;
|
|
14
|
+
}
|
|
15
|
+
return extend(fields, {
|
|
16
|
+
exterior: {
|
|
17
|
+
type: LineStringType,
|
|
18
|
+
resolve(data) {
|
|
19
|
+
const polygon = data.__geojson;
|
|
20
|
+
return {
|
|
21
|
+
__gisType: getGISTypeName(GisSubtype.LineString, hasZ, hasM),
|
|
22
|
+
__srid: data.__srid,
|
|
23
|
+
__geojson: {
|
|
24
|
+
type: 'LineString',
|
|
25
|
+
coordinates: polygon.coordinates[0]
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
interiors: {
|
|
31
|
+
type: new GraphQLList(LineStringType),
|
|
32
|
+
resolve(data) {
|
|
33
|
+
const polygon = data.__geojson;
|
|
34
|
+
return polygon.coordinates.slice(1).map((coord) => ({
|
|
35
|
+
__gisType: getGISTypeName(GisSubtype.LineString, hasZ, hasM),
|
|
36
|
+
__srid: data.__srid,
|
|
37
|
+
__geojson: {
|
|
38
|
+
type: 'LineString',
|
|
39
|
+
coordinates: coord
|
|
40
|
+
}
|
|
41
|
+
}));
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
export default PostgisPolygonRingsPlugin;
|
package/esm/constants.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export var GisSubtype;
|
|
2
|
+
(function (GisSubtype) {
|
|
3
|
+
GisSubtype[GisSubtype["Geometry"] = 0] = "Geometry";
|
|
4
|
+
GisSubtype[GisSubtype["Point"] = 1] = "Point";
|
|
5
|
+
GisSubtype[GisSubtype["LineString"] = 2] = "LineString";
|
|
6
|
+
GisSubtype[GisSubtype["Polygon"] = 3] = "Polygon";
|
|
7
|
+
GisSubtype[GisSubtype["MultiPoint"] = 4] = "MultiPoint";
|
|
8
|
+
GisSubtype[GisSubtype["MultiLineString"] = 5] = "MultiLineString";
|
|
9
|
+
GisSubtype[GisSubtype["MultiPolygon"] = 6] = "MultiPolygon";
|
|
10
|
+
GisSubtype[GisSubtype["GeometryCollection"] = 7] = "GeometryCollection";
|
|
11
|
+
})(GisSubtype || (GisSubtype = {}));
|
|
12
|
+
export const SUBTYPE_STRING_BY_SUBTYPE = {
|
|
13
|
+
[GisSubtype.Geometry]: 'geometry',
|
|
14
|
+
[GisSubtype.Point]: 'point',
|
|
15
|
+
[GisSubtype.LineString]: 'line-string',
|
|
16
|
+
[GisSubtype.Polygon]: 'polygon',
|
|
17
|
+
[GisSubtype.MultiPoint]: 'multi-point',
|
|
18
|
+
[GisSubtype.MultiLineString]: 'multi-line-string',
|
|
19
|
+
[GisSubtype.MultiPolygon]: 'multi-polygon',
|
|
20
|
+
[GisSubtype.GeometryCollection]: 'geometry-collection'
|
|
21
|
+
};
|
|
22
|
+
export const GIS_SUBTYPE_NAME = {
|
|
23
|
+
[GisSubtype.Geometry]: 'Geometry',
|
|
24
|
+
[GisSubtype.Point]: 'Point',
|
|
25
|
+
[GisSubtype.LineString]: 'LineString',
|
|
26
|
+
[GisSubtype.Polygon]: 'Polygon',
|
|
27
|
+
[GisSubtype.MultiPoint]: 'MultiPoint',
|
|
28
|
+
[GisSubtype.MultiLineString]: 'MultiLineString',
|
|
29
|
+
[GisSubtype.MultiPolygon]: 'MultiPolygon',
|
|
30
|
+
[GisSubtype.GeometryCollection]: 'GeometryCollection'
|
|
31
|
+
};
|
package/esm/index.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import PostgisExtensionDetectionPlugin from './PostgisExtensionDetectionPlugin';
|
|
2
|
+
import PostgisInflectionPlugin from './PostgisInflectionPlugin';
|
|
3
|
+
import PostgisRegisterTypesPlugin from './PostgisRegisterTypesPlugin';
|
|
4
|
+
import PostgisVersionPlugin from './PostgisVersionPlugin';
|
|
5
|
+
import Postgis_GeometryCollection_GeometriesPlugin from './Postgis_GeometryCollection_GeometriesPlugin';
|
|
6
|
+
import Postgis_LineString_PointsPlugin from './Postgis_LineString_PointsPlugin';
|
|
7
|
+
import Postgis_MultiLineString_LineStringsPlugin from './Postgis_MultiLineString_LineStringsPlugin';
|
|
8
|
+
import Postgis_MultiPoint_PointsPlugin from './Postgis_MultiPoint_PointsPlugin';
|
|
9
|
+
import Postgis_MultiPolygon_PolygonsPlugin from './Postgis_MultiPolygon_PolygonsPlugin';
|
|
10
|
+
import Postgis_Point_LatitudeLongitudePlugin from './Postgis_Point_LatitudeLongitudePlugin';
|
|
11
|
+
import Postgis_Polygon_RingsPlugin from './Postgis_Polygon_RingsPlugin';
|
|
12
|
+
const PostgisPlugin = async (builder, options) => {
|
|
13
|
+
await PostgisVersionPlugin(builder, options);
|
|
14
|
+
await PostgisInflectionPlugin(builder, options);
|
|
15
|
+
await PostgisExtensionDetectionPlugin(builder, options);
|
|
16
|
+
await PostgisRegisterTypesPlugin(builder, options);
|
|
17
|
+
// Enhancing the `Point` type:
|
|
18
|
+
await Postgis_Point_LatitudeLongitudePlugin(builder, options);
|
|
19
|
+
// Enhancing the `LineString` type:
|
|
20
|
+
await Postgis_LineString_PointsPlugin(builder, options);
|
|
21
|
+
// Enhancing the `Polygon` type:
|
|
22
|
+
await Postgis_Polygon_RingsPlugin(builder, options);
|
|
23
|
+
// Enhancing the `MultiPoint` type:
|
|
24
|
+
await Postgis_MultiPoint_PointsPlugin(builder, options);
|
|
25
|
+
// Enhancing the `MultiLineString` type:
|
|
26
|
+
await Postgis_MultiLineString_LineStringsPlugin(builder, options);
|
|
27
|
+
// Enhancing the `MultiPolygon` type:
|
|
28
|
+
await Postgis_MultiPolygon_PolygonsPlugin(builder, options);
|
|
29
|
+
// Enhancing the `GeometryCollection` type:
|
|
30
|
+
await Postgis_GeometryCollection_GeometriesPlugin(builder, options);
|
|
31
|
+
};
|
|
32
|
+
export { PostgisExtensionDetectionPlugin, PostgisInflectionPlugin, PostgisRegisterTypesPlugin, PostgisVersionPlugin, Postgis_GeometryCollection_GeometriesPlugin, Postgis_LineString_PointsPlugin, Postgis_MultiLineString_LineStringsPlugin, Postgis_MultiPoint_PointsPlugin, Postgis_MultiPolygon_PolygonsPlugin, Postgis_Point_LatitudeLongitudePlugin, Postgis_Polygon_RingsPlugin };
|
|
33
|
+
export default PostgisPlugin;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export default function makeGeoJSONType(graphql, name = 'GeoJSON') {
|
|
2
|
+
const { Kind, GraphQLScalarType } = graphql;
|
|
3
|
+
const identity = (value) => value;
|
|
4
|
+
const parseLiteral = (ast, variables) => {
|
|
5
|
+
switch (ast.kind) {
|
|
6
|
+
case Kind.STRING:
|
|
7
|
+
case Kind.BOOLEAN:
|
|
8
|
+
return ast.value;
|
|
9
|
+
case Kind.INT:
|
|
10
|
+
case Kind.FLOAT:
|
|
11
|
+
return parseFloat(ast.value);
|
|
12
|
+
case Kind.OBJECT: {
|
|
13
|
+
const value = Object.create(null);
|
|
14
|
+
ast.fields.forEach((field) => {
|
|
15
|
+
value[field.name.value] = parseLiteral(field.value, variables);
|
|
16
|
+
});
|
|
17
|
+
return value;
|
|
18
|
+
}
|
|
19
|
+
case Kind.LIST:
|
|
20
|
+
return ast.values.map((n) => parseLiteral(n, variables));
|
|
21
|
+
case Kind.NULL:
|
|
22
|
+
return null;
|
|
23
|
+
case Kind.VARIABLE: {
|
|
24
|
+
const variableName = ast.name.value;
|
|
25
|
+
return variables ? variables[variableName] : undefined;
|
|
26
|
+
}
|
|
27
|
+
default:
|
|
28
|
+
return undefined;
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
return new GraphQLScalarType({
|
|
32
|
+
name,
|
|
33
|
+
description: `The \`${name}\` scalar type represents GeoJSON values as specified by` +
|
|
34
|
+
'[RFC 7946](https://tools.ietf.org/html/rfc7946).',
|
|
35
|
+
serialize: identity,
|
|
36
|
+
parseValue: identity,
|
|
37
|
+
parseLiteral
|
|
38
|
+
});
|
|
39
|
+
}
|
package/esm/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/esm/utils.js
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { GIS_SUBTYPE_NAME, GisSubtype } from './constants';
|
|
2
|
+
export const getGISTypeDetails = (modifier) => {
|
|
3
|
+
const allZeroesHopefully = modifier >> 24;
|
|
4
|
+
if (allZeroesHopefully !== 0) {
|
|
5
|
+
throw new Error('Unsupported PostGIS modifier');
|
|
6
|
+
}
|
|
7
|
+
// Ref: https://github.com/postgis/postgis/blob/2.5.2/liblwgeom/liblwgeom.h.in#L156-L173
|
|
8
|
+
// #define TYPMOD_GET_SRID(typmod) ((((typmod) & 0x0FFFFF00) - ((typmod) & 0x10000000)) >> 8)
|
|
9
|
+
// #define TYPMOD_GET_TYPE(typmod) ((typmod & 0x000000FC)>>2)
|
|
10
|
+
// #define TYPMOD_GET_Z(typmod) ((typmod & 0x00000002)>>1)
|
|
11
|
+
// #define TYPMOD_GET_M(typmod) (typmod & 0x00000001)
|
|
12
|
+
const srid = ((modifier & 0x0fffff00) - (modifier & 0x10000000)) >> 8;
|
|
13
|
+
const subtypeNumeric = (modifier & 0x000000fc) >> 2;
|
|
14
|
+
const hasZ = (modifier & 0x00000002) >> 1 === 1;
|
|
15
|
+
const hasM = (modifier & 0x00000001) === 1;
|
|
16
|
+
if (subtypeNumeric !== GisSubtype.Geometry &&
|
|
17
|
+
subtypeNumeric !== GisSubtype.Point &&
|
|
18
|
+
subtypeNumeric !== GisSubtype.LineString &&
|
|
19
|
+
subtypeNumeric !== GisSubtype.Polygon &&
|
|
20
|
+
subtypeNumeric !== GisSubtype.MultiPoint &&
|
|
21
|
+
subtypeNumeric !== GisSubtype.MultiLineString &&
|
|
22
|
+
subtypeNumeric !== GisSubtype.MultiPolygon &&
|
|
23
|
+
subtypeNumeric !== GisSubtype.GeometryCollection) {
|
|
24
|
+
throw new Error(`Unsupported PostGIS modifier, expected 0-7, received ${subtypeNumeric} (${modifier})`);
|
|
25
|
+
}
|
|
26
|
+
const subtype = subtypeNumeric;
|
|
27
|
+
return {
|
|
28
|
+
subtype,
|
|
29
|
+
hasZ,
|
|
30
|
+
hasM,
|
|
31
|
+
srid
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
export const getGISTypeModifier = (subtype, hasZ, hasM, srid) => {
|
|
35
|
+
// Ref: https://github.com/postgis/postgis/blob/2.5.2/liblwgeom/liblwgeom.h.in#L156-L173
|
|
36
|
+
// #define TYPMOD_SET_SRID(typmod, srid) ((typmod) = (((typmod) & 0xE00000FF) | ((srid & 0x001FFFFF)<<8)))
|
|
37
|
+
// #define TYPMOD_SET_TYPE(typmod, type) ((typmod) = (typmod & 0xFFFFFF03) | ((type & 0x0000003F)<<2))
|
|
38
|
+
// #define TYPMOD_SET_Z(typmod) ((typmod) = typmod | 0x00000002)
|
|
39
|
+
// #define TYPMOD_SET_M(typmod) ((typmod) = typmod | 0x00000001)
|
|
40
|
+
return (((srid & 0x001fffff) << 8) +
|
|
41
|
+
((subtype & 0x0000003f) << 2) +
|
|
42
|
+
(hasZ ? 0x00000002 : 0) +
|
|
43
|
+
(hasM ? 0x00000001 : 0));
|
|
44
|
+
};
|
|
45
|
+
export const getGISTypeName = (subtype, hasZ, hasM) => {
|
|
46
|
+
return `${GIS_SUBTYPE_NAME[subtype]}${hasZ ? 'Z' : ''}${hasM ? 'M' : ''}`;
|
|
47
|
+
};
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Plugin } from 'graphile-build';
|
|
2
|
+
import PostgisExtensionDetectionPlugin from './PostgisExtensionDetectionPlugin';
|
|
3
|
+
import PostgisInflectionPlugin from './PostgisInflectionPlugin';
|
|
4
|
+
import PostgisRegisterTypesPlugin from './PostgisRegisterTypesPlugin';
|
|
5
|
+
import PostgisVersionPlugin from './PostgisVersionPlugin';
|
|
6
|
+
import Postgis_GeometryCollection_GeometriesPlugin from './Postgis_GeometryCollection_GeometriesPlugin';
|
|
7
|
+
import Postgis_LineString_PointsPlugin from './Postgis_LineString_PointsPlugin';
|
|
8
|
+
import Postgis_MultiLineString_LineStringsPlugin from './Postgis_MultiLineString_LineStringsPlugin';
|
|
9
|
+
import Postgis_MultiPoint_PointsPlugin from './Postgis_MultiPoint_PointsPlugin';
|
|
10
|
+
import Postgis_MultiPolygon_PolygonsPlugin from './Postgis_MultiPolygon_PolygonsPlugin';
|
|
11
|
+
import Postgis_Point_LatitudeLongitudePlugin from './Postgis_Point_LatitudeLongitudePlugin';
|
|
12
|
+
import Postgis_Polygon_RingsPlugin from './Postgis_Polygon_RingsPlugin';
|
|
13
|
+
declare const PostgisPlugin: Plugin;
|
|
14
|
+
export { PostgisExtensionDetectionPlugin, PostgisInflectionPlugin, PostgisRegisterTypesPlugin, PostgisVersionPlugin, Postgis_GeometryCollection_GeometriesPlugin, Postgis_LineString_PointsPlugin, Postgis_MultiLineString_LineStringsPlugin, Postgis_MultiPoint_PointsPlugin, Postgis_MultiPolygon_PolygonsPlugin, Postgis_Point_LatitudeLongitudePlugin, Postgis_Polygon_RingsPlugin };
|
|
15
|
+
export default PostgisPlugin;
|
package/index.js
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Postgis_Polygon_RingsPlugin = exports.Postgis_Point_LatitudeLongitudePlugin = exports.Postgis_MultiPolygon_PolygonsPlugin = exports.Postgis_MultiPoint_PointsPlugin = exports.Postgis_MultiLineString_LineStringsPlugin = exports.Postgis_LineString_PointsPlugin = exports.Postgis_GeometryCollection_GeometriesPlugin = exports.PostgisVersionPlugin = exports.PostgisRegisterTypesPlugin = exports.PostgisInflectionPlugin = exports.PostgisExtensionDetectionPlugin = void 0;
|
|
7
|
+
const PostgisExtensionDetectionPlugin_1 = __importDefault(require("./PostgisExtensionDetectionPlugin"));
|
|
8
|
+
exports.PostgisExtensionDetectionPlugin = PostgisExtensionDetectionPlugin_1.default;
|
|
9
|
+
const PostgisInflectionPlugin_1 = __importDefault(require("./PostgisInflectionPlugin"));
|
|
10
|
+
exports.PostgisInflectionPlugin = PostgisInflectionPlugin_1.default;
|
|
11
|
+
const PostgisRegisterTypesPlugin_1 = __importDefault(require("./PostgisRegisterTypesPlugin"));
|
|
12
|
+
exports.PostgisRegisterTypesPlugin = PostgisRegisterTypesPlugin_1.default;
|
|
13
|
+
const PostgisVersionPlugin_1 = __importDefault(require("./PostgisVersionPlugin"));
|
|
14
|
+
exports.PostgisVersionPlugin = PostgisVersionPlugin_1.default;
|
|
15
|
+
const Postgis_GeometryCollection_GeometriesPlugin_1 = __importDefault(require("./Postgis_GeometryCollection_GeometriesPlugin"));
|
|
16
|
+
exports.Postgis_GeometryCollection_GeometriesPlugin = Postgis_GeometryCollection_GeometriesPlugin_1.default;
|
|
17
|
+
const Postgis_LineString_PointsPlugin_1 = __importDefault(require("./Postgis_LineString_PointsPlugin"));
|
|
18
|
+
exports.Postgis_LineString_PointsPlugin = Postgis_LineString_PointsPlugin_1.default;
|
|
19
|
+
const Postgis_MultiLineString_LineStringsPlugin_1 = __importDefault(require("./Postgis_MultiLineString_LineStringsPlugin"));
|
|
20
|
+
exports.Postgis_MultiLineString_LineStringsPlugin = Postgis_MultiLineString_LineStringsPlugin_1.default;
|
|
21
|
+
const Postgis_MultiPoint_PointsPlugin_1 = __importDefault(require("./Postgis_MultiPoint_PointsPlugin"));
|
|
22
|
+
exports.Postgis_MultiPoint_PointsPlugin = Postgis_MultiPoint_PointsPlugin_1.default;
|
|
23
|
+
const Postgis_MultiPolygon_PolygonsPlugin_1 = __importDefault(require("./Postgis_MultiPolygon_PolygonsPlugin"));
|
|
24
|
+
exports.Postgis_MultiPolygon_PolygonsPlugin = Postgis_MultiPolygon_PolygonsPlugin_1.default;
|
|
25
|
+
const Postgis_Point_LatitudeLongitudePlugin_1 = __importDefault(require("./Postgis_Point_LatitudeLongitudePlugin"));
|
|
26
|
+
exports.Postgis_Point_LatitudeLongitudePlugin = Postgis_Point_LatitudeLongitudePlugin_1.default;
|
|
27
|
+
const Postgis_Polygon_RingsPlugin_1 = __importDefault(require("./Postgis_Polygon_RingsPlugin"));
|
|
28
|
+
exports.Postgis_Polygon_RingsPlugin = Postgis_Polygon_RingsPlugin_1.default;
|
|
29
|
+
const PostgisPlugin = async (builder, options) => {
|
|
30
|
+
await (0, PostgisVersionPlugin_1.default)(builder, options);
|
|
31
|
+
await (0, PostgisInflectionPlugin_1.default)(builder, options);
|
|
32
|
+
await (0, PostgisExtensionDetectionPlugin_1.default)(builder, options);
|
|
33
|
+
await (0, PostgisRegisterTypesPlugin_1.default)(builder, options);
|
|
34
|
+
// Enhancing the `Point` type:
|
|
35
|
+
await (0, Postgis_Point_LatitudeLongitudePlugin_1.default)(builder, options);
|
|
36
|
+
// Enhancing the `LineString` type:
|
|
37
|
+
await (0, Postgis_LineString_PointsPlugin_1.default)(builder, options);
|
|
38
|
+
// Enhancing the `Polygon` type:
|
|
39
|
+
await (0, Postgis_Polygon_RingsPlugin_1.default)(builder, options);
|
|
40
|
+
// Enhancing the `MultiPoint` type:
|
|
41
|
+
await (0, Postgis_MultiPoint_PointsPlugin_1.default)(builder, options);
|
|
42
|
+
// Enhancing the `MultiLineString` type:
|
|
43
|
+
await (0, Postgis_MultiLineString_LineStringsPlugin_1.default)(builder, options);
|
|
44
|
+
// Enhancing the `MultiPolygon` type:
|
|
45
|
+
await (0, Postgis_MultiPolygon_PolygonsPlugin_1.default)(builder, options);
|
|
46
|
+
// Enhancing the `GeometryCollection` type:
|
|
47
|
+
await (0, Postgis_GeometryCollection_GeometriesPlugin_1.default)(builder, options);
|
|
48
|
+
};
|
|
49
|
+
exports.default = PostgisPlugin;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function makeGeoJSONType(graphql: typeof import('graphql'), name?: string): import('graphql').GraphQLScalarType;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = makeGeoJSONType;
|
|
4
|
+
function makeGeoJSONType(graphql, name = 'GeoJSON') {
|
|
5
|
+
const { Kind, GraphQLScalarType } = graphql;
|
|
6
|
+
const identity = (value) => value;
|
|
7
|
+
const parseLiteral = (ast, variables) => {
|
|
8
|
+
switch (ast.kind) {
|
|
9
|
+
case Kind.STRING:
|
|
10
|
+
case Kind.BOOLEAN:
|
|
11
|
+
return ast.value;
|
|
12
|
+
case Kind.INT:
|
|
13
|
+
case Kind.FLOAT:
|
|
14
|
+
return parseFloat(ast.value);
|
|
15
|
+
case Kind.OBJECT: {
|
|
16
|
+
const value = Object.create(null);
|
|
17
|
+
ast.fields.forEach((field) => {
|
|
18
|
+
value[field.name.value] = parseLiteral(field.value, variables);
|
|
19
|
+
});
|
|
20
|
+
return value;
|
|
21
|
+
}
|
|
22
|
+
case Kind.LIST:
|
|
23
|
+
return ast.values.map((n) => parseLiteral(n, variables));
|
|
24
|
+
case Kind.NULL:
|
|
25
|
+
return null;
|
|
26
|
+
case Kind.VARIABLE: {
|
|
27
|
+
const variableName = ast.name.value;
|
|
28
|
+
return variables ? variables[variableName] : undefined;
|
|
29
|
+
}
|
|
30
|
+
default:
|
|
31
|
+
return undefined;
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
return new GraphQLScalarType({
|
|
35
|
+
name,
|
|
36
|
+
description: `The \`${name}\` scalar type represents GeoJSON values as specified by` +
|
|
37
|
+
'[RFC 7946](https://tools.ietf.org/html/rfc7946).',
|
|
38
|
+
serialize: identity,
|
|
39
|
+
parseValue: identity,
|
|
40
|
+
parseLiteral
|
|
41
|
+
});
|
|
42
|
+
}
|
package/package.json
CHANGED
|
@@ -1,69 +1,54 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "graphile-postgis",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "Graphile/PostGraphile PostGIS integration plugin",
|
|
5
5
|
"author": "Dan Lynch <pyramation@gmail.com>",
|
|
6
|
-
"homepage": "https://github.com/
|
|
7
|
-
"license": "
|
|
8
|
-
"main": "
|
|
9
|
-
"module": "
|
|
10
|
-
"
|
|
11
|
-
"lib": "src",
|
|
12
|
-
"test": "__tests__"
|
|
13
|
-
},
|
|
14
|
-
"files": [
|
|
15
|
-
"main",
|
|
16
|
-
"module"
|
|
17
|
-
],
|
|
6
|
+
"homepage": "https://github.com/launchql/launchql",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"main": "index.js",
|
|
9
|
+
"module": "esm/index.js",
|
|
10
|
+
"types": "index.d.ts",
|
|
18
11
|
"scripts": {
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"dev": "
|
|
24
|
-
"
|
|
25
|
-
"lint": "eslint src --fix",
|
|
12
|
+
"clean": "makage clean",
|
|
13
|
+
"copy": "makage assets",
|
|
14
|
+
"prepack": "pnpm run build",
|
|
15
|
+
"build": "makage build",
|
|
16
|
+
"build:dev": "makage build --dev",
|
|
17
|
+
"lint": "eslint . --fix",
|
|
26
18
|
"test": "jest",
|
|
27
|
-
"test:watch": "jest --watch"
|
|
28
|
-
"test:debug": "node --inspect node_modules/.bin/jest --runInBand"
|
|
19
|
+
"test:watch": "jest --watch"
|
|
29
20
|
},
|
|
30
21
|
"publishConfig": {
|
|
31
|
-
"access": "public"
|
|
22
|
+
"access": "public",
|
|
23
|
+
"directory": "dist"
|
|
32
24
|
},
|
|
33
25
|
"repository": {
|
|
34
26
|
"type": "git",
|
|
35
|
-
"url": "https://github.com/
|
|
27
|
+
"url": "https://github.com/launchql/launchql"
|
|
36
28
|
},
|
|
37
|
-
"keywords": [
|
|
29
|
+
"keywords": [
|
|
30
|
+
"graphile",
|
|
31
|
+
"postgraphile",
|
|
32
|
+
"postgis",
|
|
33
|
+
"postgres",
|
|
34
|
+
"graphql",
|
|
35
|
+
"launchql"
|
|
36
|
+
],
|
|
38
37
|
"bugs": {
|
|
39
|
-
"url": "https://github.com/
|
|
38
|
+
"url": "https://github.com/launchql/launchql/issues"
|
|
40
39
|
},
|
|
41
40
|
"devDependencies": {
|
|
42
|
-
"@
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"@babel/plugin-proposal-export-default-from": "7.10.4",
|
|
47
|
-
"@babel/plugin-proposal-object-rest-spread": "7.11.0",
|
|
48
|
-
"@babel/plugin-transform-runtime": "7.11.5",
|
|
49
|
-
"@babel/preset-env": "7.11.5",
|
|
50
|
-
"babel-core": "7.0.0-bridge.0",
|
|
51
|
-
"babel-eslint": "10.1.0",
|
|
52
|
-
"babel-jest": "25.1.0",
|
|
53
|
-
"babel-watch": "^7.0.0",
|
|
54
|
-
"cross-env": "^7.0.2",
|
|
55
|
-
"eslint": "6.8.0",
|
|
56
|
-
"eslint-config-prettier": "^6.10.0",
|
|
57
|
-
"eslint-plugin-prettier": "^3.1.2",
|
|
58
|
-
"graphql": "14.0.2",
|
|
59
|
-
"jest": "^24.5.0",
|
|
60
|
-
"jest-in-case": "^1.0.2",
|
|
61
|
-
"pg": "^8.4.1",
|
|
62
|
-
"postgraphile-core": "^4.9.0",
|
|
63
|
-
"prettier": "^2.1.2",
|
|
64
|
-
"regenerator-runtime": "^0.13.7"
|
|
41
|
+
"@types/geojson": "^7946.0.14",
|
|
42
|
+
"graphile-test": "^2.8.9",
|
|
43
|
+
"makage": "^0.1.6",
|
|
44
|
+
"pgsql-test": "^2.14.12"
|
|
65
45
|
},
|
|
66
46
|
"dependencies": {
|
|
67
|
-
"
|
|
68
|
-
|
|
47
|
+
"graphile-build": "^4.14.1",
|
|
48
|
+
"graphile-build-pg": "^4.14.1",
|
|
49
|
+
"graphile-utils": "^4.14.1",
|
|
50
|
+
"graphql": "15.10.1",
|
|
51
|
+
"pg": "^8.16.0"
|
|
52
|
+
},
|
|
53
|
+
"gitHead": "3812f24a480b2035b3413ec7fecfe492f294e590"
|
|
69
54
|
}
|
package/types.d.ts
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { Build, Inflection } from 'graphile-build';
|
|
2
|
+
import type { PgExtension, PgIntrospectionResultsByKind, PgType } from 'graphile-build-pg';
|
|
3
|
+
import type { SQL } from 'graphile-build-pg/node8plus/QueryBuilder';
|
|
4
|
+
import type { GraphQLInputType, GraphQLInterfaceType, GraphQLObjectType, GraphQLOutputType, GraphQLType } from 'graphql';
|
|
5
|
+
import type { Geometry } from 'geojson';
|
|
6
|
+
import type { GisSubtype } from './constants';
|
|
7
|
+
export interface GisTypeDetails {
|
|
8
|
+
subtype: GisSubtype;
|
|
9
|
+
hasZ: boolean;
|
|
10
|
+
hasM: boolean;
|
|
11
|
+
srid: number;
|
|
12
|
+
}
|
|
13
|
+
export type GisGraphQLType = GraphQLInterfaceType | GraphQLObjectType;
|
|
14
|
+
export interface GisFieldValue {
|
|
15
|
+
__gisType: string;
|
|
16
|
+
__srid: number;
|
|
17
|
+
__geojson: Geometry;
|
|
18
|
+
}
|
|
19
|
+
export interface PostgisInflection extends Inflection {
|
|
20
|
+
gisType(type: PgType, subtype: GisSubtype, hasZ: boolean, hasM: boolean, srid?: number): string;
|
|
21
|
+
gisInterfaceName(type: PgType): string;
|
|
22
|
+
gisDimensionInterfaceName(type: PgType, hasZ: boolean, hasM: boolean): string;
|
|
23
|
+
geojsonFieldName(): string;
|
|
24
|
+
gisXFieldName(type: PgType): string;
|
|
25
|
+
gisYFieldName(type: PgType): string;
|
|
26
|
+
gisZFieldName(type: PgType): string;
|
|
27
|
+
}
|
|
28
|
+
export type PgTweaksByTypeIdAndModifier = Record<string | number, Record<string | number, (fragment: SQL, resolveData: unknown) => SQL>>;
|
|
29
|
+
export interface PgMapper {
|
|
30
|
+
map: (value: unknown) => unknown;
|
|
31
|
+
unmap: (value: unknown) => SQL;
|
|
32
|
+
}
|
|
33
|
+
export interface PostgisBuild extends Build {
|
|
34
|
+
extend<TBase extends object, TExtension extends object>(base: TBase, extension: TExtension): TBase & TExtension;
|
|
35
|
+
newWithHooks: <TType extends GraphQLOutputType, TConfig extends object>(constructor: new (config: TConfig) => TType, spec: TConfig, scope?: Record<string, unknown>) => TType;
|
|
36
|
+
getTypeByName: (name: string) => GraphQLType | undefined;
|
|
37
|
+
pgIntrospectionResultsByKind: PgIntrospectionResultsByKind;
|
|
38
|
+
pgRegisterGqlTypeByTypeId: (typeId: string | number, generator: (set: Record<string, unknown>, typeModifier: number | null) => GraphQLOutputType) => void;
|
|
39
|
+
pgRegisterGqlInputTypeByTypeId: (typeId: string | number, generator: () => GraphQLInputType) => void;
|
|
40
|
+
pgGetGqlTypeByTypeIdAndModifier: (typeId: string | number, typeModifier: number | null) => GraphQLOutputType | GraphQLInterfaceType | null | undefined;
|
|
41
|
+
pgTweaksByTypeIdAndModifer: PgTweaksByTypeIdAndModifier;
|
|
42
|
+
pgSql: typeof import('graphile-build-pg/node8plus/QueryBuilder').sql;
|
|
43
|
+
pg2gql: (value: unknown, type: PgType) => unknown;
|
|
44
|
+
pg2GqlMapper: Record<string | number, PgMapper>;
|
|
45
|
+
pgGISGraphQLTypesByTypeAndSubtype: Record<string | number, Record<string | number, GisGraphQLType>>;
|
|
46
|
+
pgGISGraphQLInterfaceTypesByType: Record<string | number, Record<number, GraphQLInterfaceType>>;
|
|
47
|
+
pgGISGeometryType?: PgType;
|
|
48
|
+
pgGISGeographyType?: PgType;
|
|
49
|
+
pgGISExtension?: PgExtension;
|
|
50
|
+
pgGISIncludedTypes: GisGraphQLType[];
|
|
51
|
+
pgGISIncludeType: (type: GisGraphQLType) => void;
|
|
52
|
+
getPostgisTypeByGeometryType: (pgGISType: PgType, subtype: GisSubtype, hasZ?: boolean, hasM?: boolean, srid?: number) => GraphQLOutputType | GraphQLInterfaceType | null | undefined;
|
|
53
|
+
inflection: PostgisInflection;
|
|
54
|
+
}
|
|
55
|
+
export interface GisScope {
|
|
56
|
+
isPgGISType?: boolean;
|
|
57
|
+
pgGISType?: PgType;
|
|
58
|
+
pgGISTypeDetails?: GisTypeDetails;
|
|
59
|
+
}
|
package/types.js
ADDED
package/utils.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { GisSubtype } from './constants';
|
|
2
|
+
import type { GisTypeDetails } from './types';
|
|
3
|
+
export declare const getGISTypeDetails: (modifier: number) => GisTypeDetails;
|
|
4
|
+
export declare const getGISTypeModifier: (subtype: GisSubtype, hasZ: boolean, hasM: boolean, srid: number) => number;
|
|
5
|
+
export declare const getGISTypeName: (subtype: GisSubtype, hasZ: boolean, hasM: boolean) => string;
|