graphql-norm | Normalization and denormalization of GraphQL responses | GraphQL library

 by   dividab TypeScript Version: 1.3.6 License: MIT

kandi X-RAY | graphql-norm Summary

kandi X-RAY | graphql-norm Summary

graphql-norm is a TypeScript library typically used in Web Services, GraphQL applications. graphql-norm has no bugs, it has no vulnerabilities, it has a Permissive License and it has low support. You can download it from GitHub.

Responses from graphql servers may contain the same logical object several times. Consider for example a response from a blog server that contains a person object both as an author and a commenter. Both person objects have the same ID and are of the same GraphQL type so they are logically the same object. However, since they appear in two different parts of the response they need to be duplicated. When we want to store several GraphQL responsese the problem of duplication amplifies, as many respones may contain the same object. When we later want to update an object, it can be difficult to find all the places where the update needs to happen because there are multiple copies of the same logical object. This package solves these problems by using normalization and denormalization. A basic description of normalization (in this context) is that it takes a tree and flattens it to a map where each object will be assigned an unique ID which is used as the key in the map. Any references that an object holds to other objects will be exhanged to an ID instead of an object reference. The process of denormalizaton goes the other way around, starting with a map and producing a tree. The normalizr library does a good job of explaining this. In fact, this package is very similar to normalizr, but it was specifically designed to work with GraphQL so it does not require hand-coded normalization schemas. Instead it uses GraphQL queries to determine how to normalize and denormalize the data. Normalization and denormalization is useful for a number of scenarios but the main usage is probably to store and update a client-side GraphQL cache without any duplication problems. For example, Relay and Apollo use this approach for their caches. So the main use-case for this library is probably to build your own client-side cache where you get full control of the caching without loosing the benefit of normalization.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              graphql-norm has a low active ecosystem.
              It has 22 star(s) with 2 fork(s). There are 3 watchers for this library.
              OutlinedDot
              It had no major release in the last 12 months.
              There are 4 open issues and 19 have been closed. On average issues are closed in 67 days. There are 5 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of graphql-norm is 1.3.6

            kandi-Quality Quality

              graphql-norm has 0 bugs and 0 code smells.

            kandi-Security Security

              graphql-norm has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              graphql-norm code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              graphql-norm is licensed under the MIT License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              graphql-norm releases are not available. You will need to build from source code and install.
              Installation instructions are not available. Examples and code snippets are available.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of graphql-norm
            Get all kandi verified functions for this library.

            graphql-norm Key Features

            No Key Features are available at this moment for graphql-norm.

            graphql-norm Examples and Code Snippets

            No Code Snippets are available at this moment for graphql-norm.

            Community Discussions

            QUESTION

            Change the structure of a GraphQL response
            Asked 2019-Jun-06 at 09:13

            I have a GraphQL and Express project with these existing routes:

            ...

            ANSWER

            Answered 2019-Jun-06 at 09:13

            After a few good hours of searching left and right I found a viable solution. Luckily there is a formatResponse that you can use: https://github.com/apollographql/apollo-server/blob/master/packages/apollo-server-core/src/graphqlOptions.ts#L43

            The updated code looks like:

            Source https://stackoverflow.com/questions/56444837

            QUESTION

            Apollo Client (React): Possible to get normalized data from Query object?
            Asked 2018-Jul-30 at 19:24

            The Query.data object of react-apollo provides data in a nested form, like so:

            ...

            ANSWER

            Answered 2018-Jul-30 at 19:24

            You should be able to read the flattened data in the cache with client.readFragment()

            Have a look at the documentation here: https://www.apollographql.com/docs/react/advanced/caching.html#readfragment

            Source https://stackoverflow.com/questions/51575874

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install graphql-norm

            You can download it from GitHub.

            Support

            This project is developed using typescript and typescript types are distributed with the package.
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            Install
          • npm

            npm i graphql-norm

          • CLONE
          • HTTPS

            https://github.com/dividab/graphql-norm.git

          • CLI

            gh repo clone dividab/graphql-norm

          • sshUrl

            git@github.com:dividab/graphql-norm.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link

            Explore Related Topics

            Consider Popular GraphQL Libraries

            parse-server

            by parse-community

            graphql-js

            by graphql

            apollo-client

            by apollographql

            relay

            by facebook

            graphql-spec

            by graphql

            Try Top Libraries by dividab

            tsconfig-paths

            by dividabTypeScript

            tsconfig-paths-webpack-plugin

            by dividabTypeScript

            uom

            by dividabTypeScript

            three-x3d-loader

            by dividabJavaScript

            tslint-divid

            by dividabTypeScript