@northernv/graphql

1.0.1 • Public • Published

@northernv/graphql

npm MIT licensed

Usage

npm install -S @northernv/graphql;
yarn add @northernv/graphql;

Schema for ...

Schema

  • Queries and Mutations are in queries.gql
  • Types are in types.gql

Templates

The client query/mutation/fragments are held in /t. These are used directly by the server when creating contract (integration) tests for the various GQL methods.

Client GQL files

Run the npm run build file to generate the frontend GQL files.

/static

Files ready to be consumed by React/Vue when using Apollo GraphQL loader

Usage

In Webpack

loaders: [
  {
    test: /\.(graphql|gql)$/,
    exclude: /node_modules/,
    loader: 'graphql-tag/loader'
  }
]

In the file

import Unit from '@northernv/vgql/static/unit.gql'

const { data, errors } = await this.$apollo.query({
  query: Unit,
  variables: {
    input: { ... },
  }
})

/json

Files ready to be consumed by Apollo, no need for graphql-tag

Usage

import Unit from '@northernv/vgql/json/unit'

const { data, errors } = await this.$apollo.query({
  query: Unit,
  variables: {
    input: { ... },
  }
})

/gql

Files used with graphql-tag

Usage

import Unit from '@northernv/vgql/gql/unit'
import gql from 'graphql-tag'

const { data, errors } = await this.$apollo.query({
  query: gql`Unit`,
  variables: {
    input: { ... },
  }
})

Directives

  • @timestamp: Adds createdAt, updatedAt, deletedAt properties to types timestamp-directive.js In your models, that are Javascript classes, include a static function called loaders that returns an object of dataloaders

Readme

Keywords

none

Package Sidebar

Install

npm i @northernv/graphql

Weekly Downloads

1

Version

1.0.1

License

MIT

Unpacked Size

12.6 kB

Total Files

12

Last publish

Collaborators

  • shanestillwell