@northernv/vgql

CabinKey Schema

Usage no npm install needed!

<script type="module">
  import northernvVgql from 'https://cdn.skypack.dev/@northernv/vgql';
</script>

README

Schema for ...

.gitlab-ci.yml is located in https://gitlab.com/northernv/gitlab-ci-templates

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