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

graphql-info-transformer

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

graphql-info-transformer

This is a proof of concept to transform GraphQL's `info` into an object that can be consumed by Prisma's PhotonJS (API schema and DB schema must match). Can be useful when migrating from Prisma v1 to v2 (i.e. from Prisma Binding to PhotonJS).

  • 0.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

GraphQL Info Transformer

This is a proof of concept to transform GraphQL's info into an object that can be consumed by Prisma's PhotonJS (API schema and DB schema must match). Can be useful when migrating from Prisma v1 to v2 (i.e. from Prisma Binding to PhotonJS).

users(_, args, ctx, info) {
  return photon.users.findMany({
    select: infoToPhotonSelect(info)
  })
})

Based on this article and some GraphQL-related projects.

Installation

npm install graphql-info-transformer
yarn add graphql-info-transformer

Prisma2 example

In the example folder:

  1. Setup DB
yarn prisma2 dev
yarn seed
  1. Test query

Run the project with yarn start and open the Playground to try the following query:

query {
  users {
    id
    name
    email
    posts(where: { title: { contains: "prisma" } }, orderBy: { title: asc }) {
      id
      content
      title
    }
  }
}

It should show only 2 of the 3 posts in the seed.

FAQs

Package last updated on 23 Oct 2019

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