New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@graphile-contrib/pg-many-to-many

Package Overview
Dependencies
Maintainers
4
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@graphile-contrib/pg-many-to-many - npm Package Compare versions

Comparing version 1.0.0-beta.6 to 1.0.0-beta.7

2

index.js

@@ -26,3 +26,3 @@ module.exports = function PgManyToManyPlugin(builder, options) {

};
depends("graphile-build-pg", "^4.1.0");
depends("graphile-build-pg", "^4.3.1");

@@ -29,0 +29,0 @@ // Register this plugin

{
"name": "@graphile-contrib/pg-many-to-many",
"version": "1.0.0-beta.6",
"version": "1.0.0-beta.7",
"description": "Add connection fields for many-to-many relations",

@@ -27,3 +27,3 @@ "main": "index.js",

"pg": "^7.8.0",
"postgraphile-core": "4.1.0",
"postgraphile-core": "4.3.1",
"prettier": "1.16.4"

@@ -30,0 +30,0 @@ },

@@ -7,3 +7,3 @@ # @graphile-contrib/pg-many-to-many

> Requires `postgraphile@^4.1.0` or `graphile-build-pg@^4.1.0`
> Requires `postgraphile@^4.3.1` or `graphile-build-pg@^4.3.1`

@@ -61,6 +61,10 @@ Example:

To avoid naming conflicts, this plugin uses a verbose naming convention (e.g. `teamsByTeamMemberTeamId`), similar to how related fields are named by default in PostGraphile v4.
To avoid naming conflicts, this plugin uses a verbose naming convention (e.g. `teamsByTeamMemberTeamId`), similar to how related fields are named by default in PostGraphile v4. You can override this by writing a custom inflector plugin or by using smart comments in your SQL schema.
You can override this by adding an inflector plugin. For example, the following plugin shortens the names to just the table name (producing e.g. `teams`):
### Inflector Plugin
Writing a custom inflector plugin gives you full control over the GraphQL field names. Here is an example plugin that shortens the field names to just the table name (producing e.g. `teams`):
> :warning: Warning: Simplifying the field names as shown below will lead to field name conflicts if your junction table has multiple foreign keys referencing the same table. You will need to customize the inflector function to resolve the conflicts.
```js

@@ -110,8 +114,10 @@ const { makeAddInflectorsPlugin } = require("graphile-utils");

See the [makeAddInflectorsPlugin documentation](https://www.graphile.org/postgraphile/make-add-inflectors-plugin/) for more information.
For more information on custom inflector plugins, see the [makeAddInflectorsPlugin documentation](https://www.graphile.org/postgraphile/make-add-inflectors-plugin/).
You can also override individual field names using `@manyToManyFieldName` and `@manyToManySimpleFieldName` smart comments.
### Smart Comments
To rename the Connection field from `teamsByTeamMemberTeamId` to `teams`:
The `@manyToManyFieldName` and `@manyToManySimpleFieldName` smart comments allow you to override the field names generated by this plugin.
For example, to rename the Connection field from `teamsByTeamMemberTeamId` to `teams`:
```sql

@@ -118,0 +124,0 @@ comment on constraint team_member_team_id_fkey on p.team_member is E'@manyToManyFieldName teams';

@@ -293,3 +293,5 @@ module.exports = function PgManyToManyRelationPlugin(

);
}
},
queryBuilder.context,
queryBuilder.rootValue
);

@@ -331,5 +333,5 @@ return sql.fragment`(${query})`;

`Many-to-many relation (${
`Many-to-many relation field (${
isConnection ? "connection" : "simple collection"
}) for ${describePgEntity(
}) on ${Self.name} type for ${describePgEntity(
junctionLeftConstraint

@@ -336,0 +338,0 @@ )} and ${describePgEntity(junctionRightConstraint)}.`

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc