@graphile-contrib/pg-simplify-inflector
Advanced tools
Comparing version 2.0.0 to 2.0.1
13
index.js
@@ -11,3 +11,12 @@ /* | ||
module.exports = function PgSimplifyInflectorPlugin(builder) { | ||
module.exports = function PgSimplifyInflectorPlugin(builder, { pgSimpleCollections, pgOmitListSuffix }) { | ||
const hasConnections = pgSimpleCollections !== "only"; | ||
const hasSimpleCollections = pgSimpleCollections === "only" || pgSimpleCollections === "both"; | ||
if (hasConnections && hasSimpleCollections && pgOmitListSuffix) { | ||
throw new Error("Cannot omit -list suffix (`pgOmitListSuffix`) if both relay connections and simple collections are enabled."); | ||
} | ||
if (hasSimpleCollections && !hasConnections && pgOmitListSuffix !== true && pgOmitListSuffix !== false) { | ||
console.warn("You can simplify the inflector further by adding `{graphileOptions: {pgOmitListSuffix: true}}` to the options passed to PostGraphile, however be aware that doing so will mean that later enabling relay connections will be a breaking change. To dismiss this message, set `pgOmitListSuffix` to false instead."); | ||
} | ||
builder.hook("inflection", inflection => { | ||
@@ -44,3 +53,3 @@ return { | ||
return this.camelCase( | ||
`${this.pluralize(this._singularizedTableName(table))}` | ||
`${this.pluralize(this._singularizedTableName(table))}` + (pgOmitListSuffix ? '' : '-list') | ||
); | ||
@@ -47,0 +56,0 @@ }, |
{ | ||
"name": "@graphile-contrib/pg-simplify-inflector", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"description": "Simplifies the graphile-build-pg inflector to trim the `ByFooIdAndBarId` from relations", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4883
55