graphile-postgis 2.9.3 → 2.9.5

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.
@@ -1,4 +1,5 @@
1
1
  import 'graphile-build';
2
+ import 'graphile-build-pg';
2
3
  import 'graphile-connection-filter';
3
4
  import type { ConnectionFilterOperatorFactory } from 'graphile-connection-filter';
4
5
  /**
@@ -1,4 +1,5 @@
1
1
  import 'graphile-build';
2
+ import 'graphile-build-pg';
2
3
  import 'graphile-connection-filter';
3
4
  import sql from 'pg-sql2';
4
5
  import { CONCRETE_SUBTYPES } from '../constants';
@@ -211,7 +212,10 @@ export function createPostgisOperatorFactory() {
211
212
  geometry: [],
212
213
  geography: []
213
214
  };
214
- const codecPairs = [['geometry', geometryCodec]];
215
+ const codecPairs = [];
216
+ if (geometryCodec) {
217
+ codecPairs.push(['geometry', geometryCodec]);
218
+ }
215
219
  if (geographyCodec) {
216
220
  codecPairs.push(['geography', geographyCodec]);
217
221
  }
@@ -34,12 +34,16 @@ export const PostgisExtensionDetectionPlugin = {
34
34
  }
35
35
  else if (pg.name === 'geography') {
36
36
  geographyCodec = codec;
37
+ if (!geometryCodec) {
38
+ schemaName = pg.schemaName || 'public';
39
+ }
37
40
  }
38
41
  }
39
- // PostGIS requires at least the geometry codec to be present.
40
- // Geography is optional not all databases use geography columns,
41
- // so PostGraphile may not introspect the geography type at all.
42
- if (!geometryCodec) {
42
+ // PostGIS is detected when at least one of geometry or geography
43
+ // codecs is present. Some databases use only geography columns
44
+ // (e.g. use_geography: true in DataPostGIS), so PostGraphile may
45
+ // introspect geography but not geometry.
46
+ if (!geometryCodec && !geographyCodec) {
43
47
  return build;
44
48
  }
45
49
  const postgisInfo = {
@@ -1,4 +1,5 @@
1
1
  import 'graphile-build';
2
+ import 'graphile-build-pg';
2
3
  import 'graphile-connection-filter';
3
4
  import type { ConnectionFilterOperatorFactory } from 'graphile-connection-filter';
4
5
  import '../types';
@@ -1,4 +1,5 @@
1
1
  import 'graphile-build';
2
+ import 'graphile-build-pg';
2
3
  import 'graphile-connection-filter';
3
4
  import sql from 'pg-sql2';
4
5
  import { CONCRETE_SUBTYPES } from '../constants';
@@ -44,7 +45,10 @@ export function createWithinDistanceOperatorFactory() {
44
45
  geometry: [],
45
46
  geography: []
46
47
  };
47
- const codecPairs = [['geometry', geometryCodec]];
48
+ const codecPairs = [];
49
+ if (geometryCodec) {
50
+ codecPairs.push(['geometry', geometryCodec]);
51
+ }
48
52
  if (geographyCodec) {
49
53
  codecPairs.push(['geography', geographyCodec]);
50
54
  }
package/esm/types.d.ts CHANGED
@@ -20,9 +20,9 @@ export interface GisFieldValue {
20
20
  export interface PostgisExtensionInfo {
21
21
  /** The schema name where PostGIS is installed (e.g. 'public') */
22
22
  schemaName: string;
23
- /** The geometry codec from the registry */
24
- geometryCodec: PgCodec;
25
- /** The geography codec from the registry (optional not all databases use geography columns) */
23
+ /** The geometry codec from the registry (null if only geography columns are used) */
24
+ geometryCodec: PgCodec | null;
25
+ /** The geography codec from the registry (null if only geometry columns are used) */
26
26
  geographyCodec: PgCodec | null;
27
27
  }
28
28
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "graphile-postgis",
3
- "version": "2.9.3",
3
+ "version": "2.9.5",
4
4
  "description": "PostGIS support for PostGraphile v5",
5
5
  "author": "Constructive <developers@constructive.io>",
6
6
  "homepage": "https://github.com/constructive-io/constructive",
@@ -46,7 +46,7 @@
46
46
  "graphile-build": "5.0.0",
47
47
  "graphile-build-pg": "5.0.0",
48
48
  "graphile-config": "1.0.0",
49
- "graphile-connection-filter": "^1.3.3",
49
+ "graphile-connection-filter": "^1.3.4",
50
50
  "graphql": "16.13.0",
51
51
  "pg-sql2": "5.0.0",
52
52
  "postgraphile": "5.0.0"
@@ -59,9 +59,9 @@
59
59
  "devDependencies": {
60
60
  "@types/geojson": "^7946.0.14",
61
61
  "@types/node": "^22.19.11",
62
- "graphile-test": "^4.7.3",
62
+ "graphile-test": "^4.7.4",
63
63
  "makage": "^0.3.0",
64
- "pgsql-test": "^4.7.3"
64
+ "pgsql-test": "^4.7.4"
65
65
  },
66
- "gitHead": "baae875effd00af36577612c861d0f6f9a1a792a"
66
+ "gitHead": "d28ce4f65863707e369e579f68c222b1d56c6ea3"
67
67
  }
@@ -1,4 +1,5 @@
1
1
  import 'graphile-build';
2
+ import 'graphile-build-pg';
2
3
  import 'graphile-connection-filter';
3
4
  import type { ConnectionFilterOperatorFactory } from 'graphile-connection-filter';
4
5
  /**
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.createPostgisOperatorFactory = createPostgisOperatorFactory;
7
7
  require("graphile-build");
8
+ require("graphile-build-pg");
8
9
  require("graphile-connection-filter");
9
10
  const pg_sql2_1 = __importDefault(require("pg-sql2"));
10
11
  const constants_1 = require("../constants");
@@ -217,7 +218,10 @@ function createPostgisOperatorFactory() {
217
218
  geometry: [],
218
219
  geography: []
219
220
  };
220
- const codecPairs = [['geometry', geometryCodec]];
221
+ const codecPairs = [];
222
+ if (geometryCodec) {
223
+ codecPairs.push(['geometry', geometryCodec]);
224
+ }
221
225
  if (geographyCodec) {
222
226
  codecPairs.push(['geography', geographyCodec]);
223
227
  }
@@ -37,12 +37,16 @@ exports.PostgisExtensionDetectionPlugin = {
37
37
  }
38
38
  else if (pg.name === 'geography') {
39
39
  geographyCodec = codec;
40
+ if (!geometryCodec) {
41
+ schemaName = pg.schemaName || 'public';
42
+ }
40
43
  }
41
44
  }
42
- // PostGIS requires at least the geometry codec to be present.
43
- // Geography is optional not all databases use geography columns,
44
- // so PostGraphile may not introspect the geography type at all.
45
- if (!geometryCodec) {
45
+ // PostGIS is detected when at least one of geometry or geography
46
+ // codecs is present. Some databases use only geography columns
47
+ // (e.g. use_geography: true in DataPostGIS), so PostGraphile may
48
+ // introspect geography but not geometry.
49
+ if (!geometryCodec && !geographyCodec) {
46
50
  return build;
47
51
  }
48
52
  const postgisInfo = {
@@ -1,4 +1,5 @@
1
1
  import 'graphile-build';
2
+ import 'graphile-build-pg';
2
3
  import 'graphile-connection-filter';
3
4
  import type { ConnectionFilterOperatorFactory } from 'graphile-connection-filter';
4
5
  import '../types';
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.createWithinDistanceOperatorFactory = createWithinDistanceOperatorFactory;
7
7
  require("graphile-build");
8
+ require("graphile-build-pg");
8
9
  require("graphile-connection-filter");
9
10
  const pg_sql2_1 = __importDefault(require("pg-sql2"));
10
11
  const constants_1 = require("../constants");
@@ -50,7 +51,10 @@ function createWithinDistanceOperatorFactory() {
50
51
  geometry: [],
51
52
  geography: []
52
53
  };
53
- const codecPairs = [['geometry', geometryCodec]];
54
+ const codecPairs = [];
55
+ if (geometryCodec) {
56
+ codecPairs.push(['geometry', geometryCodec]);
57
+ }
54
58
  if (geographyCodec) {
55
59
  codecPairs.push(['geography', geographyCodec]);
56
60
  }
package/types.d.ts CHANGED
@@ -20,9 +20,9 @@ export interface GisFieldValue {
20
20
  export interface PostgisExtensionInfo {
21
21
  /** The schema name where PostGIS is installed (e.g. 'public') */
22
22
  schemaName: string;
23
- /** The geometry codec from the registry */
24
- geometryCodec: PgCodec;
25
- /** The geography codec from the registry (optional not all databases use geography columns) */
23
+ /** The geometry codec from the registry (null if only geography columns are used) */
24
+ geometryCodec: PgCodec | null;
25
+ /** The geography codec from the registry (null if only geometry columns are used) */
26
26
  geographyCodec: PgCodec | null;
27
27
  }
28
28
  /**