Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@graphile-contrib/pg-simplify-inflector

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@graphile-contrib/pg-simplify-inflector

Simplifies the graphile-build-pg inflector to trim the `ByFooIdAndBarId` from relations

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

@graphile-contrib/pg-simplify-inflector

Simplifies relation names; e.g. postsByAuthorId becomes simply posts.

Installation:

yarn add @graphile-contrib/pg-simplify-inflector

or

npm install --save @graphile-contrib/pg-simplify-inflector

Usage:

CLI:

postgraphile --append-plugins @graphile-contrib/pg-simplify-inflector

Library:

const PgSimplifyInflectorPlugin =
  require('@graphile-contrib/pg-simplify-inflector');

// ...

app.use(
  postgraphile(process.env.AUTH_DATABASE_URL, "app_public", {
    appendPlugins: [
      PgSimplifyInflectorPlugin,
    ],
    // ... other settings ...
  })
);

Handling field conflicts:

If you have two relations that will result in a conflict (e.g. postsByAuthorId and postsByEditorId would both become posts with this plugin) then you will need to rename one of them - you can do so using smart comments, e.g.:

comment on constraint posts_editor_id_fkey on posts is
  E'@foreignFieldName editedPosts\n@fieldName editor';

Keywords

FAQs

Package last updated on 27 Jun 2018

Did you know?

Socket

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.

Install

Related posts

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