Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
@graphile-contrib/pg-many-to-many
Advanced tools
Add connection fields for many-to-many relations
This Graphile Engine plugin adds connection fields for many-to-many relations.
Example:
{
allPeople {
nodes {
personName
# 👇 many-to-many relation
teamsByTeamMemberPersonIdAndTeamId {
nodes {
teamName
}
}
}
}
}
yarn add @graphile-contrib/pg-many-to-many
Requires postgraphile@^4.1.0-rc.2
or graphile-build-pg@^4.1.0-rc.2
Append this plugin and the additional fields will be added to your schema.
postgraphile --append-plugins @graphile-contrib/pg-order-by-related -c postgres:///my_db
const express = require("express");
const { postgraphile } = require("postgraphile");
const PgManyToMany = require("@graphile-contrib/pg-many-to-many");
const app = express();
app.use(
postgraphile(process.env.DATABASE_URL, "app_public", {
appendPlugins: [PgManyToMany]
})
);
app.listen(process.env.PORT || 3000);
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 adding an inflector plugin. For example, the following plugin shortens the names to just the table name (producing e.g. teams
):
const { makeAddInflectorsPlugin } = require("graphile-utils");
module.exports = makeAddInflectorsPlugin(
// TODO
);
See the makeAddInflectorsPlugin documentation for more information.
FAQs
Add connection fields for many-to-many relations
The npm package @graphile-contrib/pg-many-to-many receives a total of 4,281 weekly downloads. As such, @graphile-contrib/pg-many-to-many popularity was classified as popular.
We found that @graphile-contrib/pg-many-to-many demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.