graphile-settings 4.25.1 → 4.26.0

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.
@@ -306,8 +306,7 @@ export const InflektPlugin = {
306
306
  hasDirectRelation = true;
307
307
  }
308
308
  }
309
- if (rel.isReferencee &&
310
- rel.remoteResource?.codec?.name !== rightTable.codec.name) {
309
+ if (rel.isReferencee) {
311
310
  const junctionRelations = rel.remoteResource?.getRelations?.() || {};
312
311
  for (const [_jRelName, jRel] of Object.entries(junctionRelations)) {
313
312
  if (!jRel.isReferencee &&
@@ -42,6 +42,15 @@ import type { GraphileConfig } from 'graphile-config';
42
42
  *
43
43
  * This overrides the default behavior from @graphile-contrib/pg-many-to-many
44
44
  * to require explicit `@behavior +manyToMany` smart tags.
45
+ *
46
+ * NOTE ON TYPE REGISTRATION:
47
+ * The upstream plugin's init hook registers GraphQL types (edge/connection)
48
+ * for ALL discovered relationships unconditionally — before behavior filtering.
49
+ * Our pgManyToMany behavior only gates field creation, not type registration.
50
+ * If two junction tables produce the same inflected type name, the duplicate
51
+ * registration will crash graphile-build. The build hook below wraps
52
+ * registerObjectType to catch such collisions and skip the duplicate,
53
+ * preventing the crash without modifying the upstream plugin.
45
54
  */
46
55
  export declare const ManyToManyOptInPlugin: GraphileConfig.Plugin;
47
56
  /**
@@ -42,6 +42,15 @@ import { PgManyToManyPreset } from '@graphile-contrib/pg-many-to-many';
42
42
  *
43
43
  * This overrides the default behavior from @graphile-contrib/pg-many-to-many
44
44
  * to require explicit `@behavior +manyToMany` smart tags.
45
+ *
46
+ * NOTE ON TYPE REGISTRATION:
47
+ * The upstream plugin's init hook registers GraphQL types (edge/connection)
48
+ * for ALL discovered relationships unconditionally — before behavior filtering.
49
+ * Our pgManyToMany behavior only gates field creation, not type registration.
50
+ * If two junction tables produce the same inflected type name, the duplicate
51
+ * registration will crash graphile-build. The build hook below wraps
52
+ * registerObjectType to catch such collisions and skip the duplicate,
53
+ * preventing the crash without modifying the upstream plugin.
45
54
  */
46
55
  export const ManyToManyOptInPlugin = {
47
56
  name: 'ManyToManyOptInPlugin',
@@ -63,6 +72,29 @@ export const ManyToManyOptInPlugin = {
63
72
  },
64
73
  },
65
74
  },
75
+ hooks: {
76
+ build(build) {
77
+ const originalRegister = build.registerObjectType;
78
+ build.registerObjectType = function (...args) {
79
+ try {
80
+ return originalRegister.apply(this, args);
81
+ }
82
+ catch (e) {
83
+ const origin = args[3];
84
+ if (e.message?.includes('type naming conflict') &&
85
+ typeof origin === 'string' &&
86
+ origin.includes('many-to-many')) {
87
+ // Silently skip duplicate many-to-many type registration.
88
+ // The first registration wins; the duplicate is harmless
89
+ // because the inflector already produced a unique field name.
90
+ return;
91
+ }
92
+ throw e;
93
+ }
94
+ };
95
+ return build;
96
+ },
97
+ },
66
98
  },
67
99
  };
68
100
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "graphile-settings",
3
- "version": "4.25.1",
3
+ "version": "4.26.0",
4
4
  "author": "Constructive <developers@constructive.io>",
5
5
  "description": "graphile settings",
6
6
  "main": "index.js",
@@ -30,39 +30,39 @@
30
30
  },
31
31
  "dependencies": {
32
32
  "@aws-sdk/client-s3": "^3.1009.0",
33
- "@constructive-io/bucket-provisioner": "^0.6.0",
34
- "@constructive-io/graphql-env": "^3.6.1",
35
- "@constructive-io/graphql-types": "^3.5.1",
36
- "@constructive-io/s3-streamer": "^2.19.1",
37
- "@constructive-io/s3-utils": "^2.12.1",
38
- "@constructive-io/upload-names": "^2.11.0",
33
+ "@constructive-io/bucket-provisioner": "^0.7.0",
34
+ "@constructive-io/graphql-env": "^3.7.0",
35
+ "@constructive-io/graphql-types": "^3.6.0",
36
+ "@constructive-io/s3-streamer": "^2.20.0",
37
+ "@constructive-io/s3-utils": "^2.13.0",
38
+ "@constructive-io/upload-names": "^2.12.0",
39
39
  "@dataplan/json": "1.0.0",
40
40
  "@dataplan/pg": "1.0.0",
41
41
  "@graphile-contrib/pg-many-to-many": "2.0.0-rc.2",
42
- "@pgpmjs/logger": "^2.6.0",
43
- "@pgpmjs/types": "^2.22.0",
42
+ "@pgpmjs/logger": "^2.7.0",
43
+ "@pgpmjs/types": "^2.23.0",
44
44
  "@pgsql/quotes": "^17.1.0",
45
45
  "cors": "^2.8.6",
46
46
  "express": "^5.2.1",
47
47
  "grafast": "1.0.0",
48
48
  "grafserv": "1.0.0",
49
- "graphile-bucket-provisioner-plugin": "0.6.0",
49
+ "graphile-bucket-provisioner-plugin": "0.7.0",
50
50
  "graphile-build": "5.0.0",
51
51
  "graphile-build-pg": "5.0.0",
52
52
  "graphile-config": "1.0.0",
53
- "graphile-connection-filter": "^1.5.6",
54
- "graphile-ltree": "^1.1.0",
55
- "graphile-postgis": "^2.11.7",
56
- "graphile-presigned-url-plugin": "^0.9.0",
57
- "graphile-search": "^1.7.6",
58
- "graphile-sql-expression-validator": "^2.7.0",
59
- "graphile-upload-plugin": "^2.6.0",
53
+ "graphile-connection-filter": "^1.6.0",
54
+ "graphile-ltree": "^1.2.0",
55
+ "graphile-postgis": "^2.12.0",
56
+ "graphile-presigned-url-plugin": "^0.10.0",
57
+ "graphile-search": "^1.8.0",
58
+ "graphile-sql-expression-validator": "^2.8.0",
59
+ "graphile-upload-plugin": "^2.7.0",
60
60
  "graphile-utils": "5.0.0",
61
61
  "graphql": "16.13.0",
62
62
  "inflekt": "^0.7.1",
63
63
  "lru-cache": "^11.2.7",
64
64
  "pg": "^8.20.0",
65
- "pg-query-context": "^2.10.0",
65
+ "pg-query-context": "^2.11.0",
66
66
  "pg-sql2": "5.0.0",
67
67
  "postgraphile": "5.0.0",
68
68
  "request-ip": "^3.3.0",
@@ -73,7 +73,7 @@
73
73
  "@types/express": "^5.0.6",
74
74
  "@types/pg": "^8.18.0",
75
75
  "@types/request-ip": "^0.0.41",
76
- "graphile-test": "^4.9.5",
76
+ "graphile-test": "^4.10.0",
77
77
  "makage": "^0.3.0",
78
78
  "nodemon": "^3.1.14",
79
79
  "ts-node": "^10.9.2"
@@ -85,5 +85,5 @@
85
85
  "constructive",
86
86
  "graphql"
87
87
  ],
88
- "gitHead": "caf38236170287e2ad06d5c47482ce246fb3233e"
88
+ "gitHead": "fb12131bc72ca66e2eb554e15c49e35dc5b362ac"
89
89
  }
@@ -309,8 +309,7 @@ exports.InflektPlugin = {
309
309
  hasDirectRelation = true;
310
310
  }
311
311
  }
312
- if (rel.isReferencee &&
313
- rel.remoteResource?.codec?.name !== rightTable.codec.name) {
312
+ if (rel.isReferencee) {
314
313
  const junctionRelations = rel.remoteResource?.getRelations?.() || {};
315
314
  for (const [_jRelName, jRel] of Object.entries(junctionRelations)) {
316
315
  if (!jRel.isReferencee &&
@@ -42,6 +42,15 @@ import type { GraphileConfig } from 'graphile-config';
42
42
  *
43
43
  * This overrides the default behavior from @graphile-contrib/pg-many-to-many
44
44
  * to require explicit `@behavior +manyToMany` smart tags.
45
+ *
46
+ * NOTE ON TYPE REGISTRATION:
47
+ * The upstream plugin's init hook registers GraphQL types (edge/connection)
48
+ * for ALL discovered relationships unconditionally — before behavior filtering.
49
+ * Our pgManyToMany behavior only gates field creation, not type registration.
50
+ * If two junction tables produce the same inflected type name, the duplicate
51
+ * registration will crash graphile-build. The build hook below wraps
52
+ * registerObjectType to catch such collisions and skip the duplicate,
53
+ * preventing the crash without modifying the upstream plugin.
45
54
  */
46
55
  export declare const ManyToManyOptInPlugin: GraphileConfig.Plugin;
47
56
  /**
@@ -45,6 +45,15 @@ const pg_many_to_many_1 = require("@graphile-contrib/pg-many-to-many");
45
45
  *
46
46
  * This overrides the default behavior from @graphile-contrib/pg-many-to-many
47
47
  * to require explicit `@behavior +manyToMany` smart tags.
48
+ *
49
+ * NOTE ON TYPE REGISTRATION:
50
+ * The upstream plugin's init hook registers GraphQL types (edge/connection)
51
+ * for ALL discovered relationships unconditionally — before behavior filtering.
52
+ * Our pgManyToMany behavior only gates field creation, not type registration.
53
+ * If two junction tables produce the same inflected type name, the duplicate
54
+ * registration will crash graphile-build. The build hook below wraps
55
+ * registerObjectType to catch such collisions and skip the duplicate,
56
+ * preventing the crash without modifying the upstream plugin.
48
57
  */
49
58
  exports.ManyToManyOptInPlugin = {
50
59
  name: 'ManyToManyOptInPlugin',
@@ -66,6 +75,29 @@ exports.ManyToManyOptInPlugin = {
66
75
  },
67
76
  },
68
77
  },
78
+ hooks: {
79
+ build(build) {
80
+ const originalRegister = build.registerObjectType;
81
+ build.registerObjectType = function (...args) {
82
+ try {
83
+ return originalRegister.apply(this, args);
84
+ }
85
+ catch (e) {
86
+ const origin = args[3];
87
+ if (e.message?.includes('type naming conflict') &&
88
+ typeof origin === 'string' &&
89
+ origin.includes('many-to-many')) {
90
+ // Silently skip duplicate many-to-many type registration.
91
+ // The first registration wins; the duplicate is harmless
92
+ // because the inflector already produced a unique field name.
93
+ return;
94
+ }
95
+ throw e;
96
+ }
97
+ };
98
+ return build;
99
+ },
100
+ },
69
101
  },
70
102
  };
71
103
  /**