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.12 to 1.0.0-beta.13

2

index.js

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

};
depends("graphile-build-pg", "^4.4.0");
depends("graphile-build-pg", "^4.5.0");

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

{
"name": "@graphile-contrib/pg-many-to-many",
"version": "1.0.0-beta.12",
"version": "1.0.0-beta.13",
"description": "Add connection fields for many-to-many relations",
"main": "index.js",
"scripts": {
"lint": "eslint **/*.js",
"lint": "eslint .",
"test": "scripts/test"

@@ -26,8 +26,12 @@ },

"jest": "^24.9.0",
"jest-serializer-graphql-schema": "^4.4.6-alpha.0",
"pg": "^7.12.1",
"postgraphile-core": "4.4.0",
"postgraphile-core": "4.5.0",
"prettier": "1.18.2"
},
"jest": {
"testRegex": "__tests__/.*\\.test\\.js$"
"testRegex": "__tests__/.*\\.test\\.js$",
"snapshotSerializers": [
"jest-serializer-graphql-schema"
]
},

@@ -34,0 +38,0 @@ "files": [

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

> Requires `postgraphile@^4.4.0` or `graphile-build-pg@^4.4.0`
> Requires `postgraphile@^4.5.0` or `graphile-build-pg@^4.5.0`

@@ -10,0 +10,0 @@ Example:

@@ -103,4 +103,21 @@ module.exports = function PgManyToManyRelationInflectionPlugin(builder) {

},
/* eslint-disable no-unused-vars */
manyToManyRelationSubqueryName(
leftKeyAttributes,
junctionLeftKeyAttributes,
junctionRightKeyAttributes,
rightKeyAttributes,
junctionTable,
rightTable,
junctionLeftConstraint,
junctionRightConstraint,
leftTableTypeName
) {
/* eslint-enable no-unused-vars */
return `many-to-many-subquery-by-${this._singularizedTableName(
junctionTable
)}`;
},
});
});
};

@@ -150,16 +150,34 @@ const createManyToManyConnectionType = require("./createManyToManyConnectionType");

innerQueryBuilder.where(
sql.fragment`${rightTableAlias}.${sql.identifier(
rightKeyAttribute.name
)} in (select ${sql.identifier(
junctionRightKeyAttribute.name
)} from ${sql.identifier(
const subqueryName = inflection.manyToManyRelationSubqueryName(
leftKeyAttributes,
junctionLeftKeyAttributes,
junctionRightKeyAttributes,
rightKeyAttributes,
junctionTable,
rightTable,
junctionLeftConstraint,
junctionRightConstraint
);
const subqueryBuilder = innerQueryBuilder.buildNamedChildSelecting(
subqueryName,
sql.identifier(
junctionTable.namespace.name,
junctionTable.name
)} where ${sql.identifier(
),
sql.identifier(junctionRightKeyAttribute.name)
);
subqueryBuilder.where(
sql.fragment`${sql.identifier(
junctionLeftKeyAttribute.name
)} = ${leftTableAlias}.${sql.identifier(
leftKeyAttribute.name
)})`
)}`
);
innerQueryBuilder.where(
() =>
sql.fragment`${rightTableAlias}.${sql.identifier(
rightKeyAttribute.name
)} in (${subqueryBuilder.build()})`
);
},

@@ -166,0 +184,0 @@ queryBuilder.context,

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