Coder Social home page Coder Social logo

qlaffont / unify-mercurius Goto Github PK

View Code? Open in Web Editor NEW
1.0 3.0 0.0 1.04 MB

Mercurius error formater with unify-errors

Home Page: https://www.npmjs.com/package/unify-mercurius

License: MIT License

TypeScript 100.00%
fastify graphql typescript unify-errors mercurius

unify-mercurius's Introduction

Test Coverage Maintainability npm npm Snyk Vulnerabilities for npm package NPM

Unify Mercurius

A Mercurius plugin wrapping unify-errors to handle REST errors. Old Owner: @flexper

Install

npm i unify-mercurius
# Or
yarn add unify-mercurius
# Or
pnpm add unify-mercurius

Use

'use strict'

const Fastify = require('fastify')
const mercurius = require('mercurius')
const { unifyMercuriusErrorFormatter } = require('unify-mercurius')

const app = Fastify()

const schema = `
  type Query {
    add(x: Int, y: Int): Int
  }
`

const resolvers = {
  Query: {
    add: async (_, { x, y }) => x + y
  }
}

app.register(mercurius, {
  schema,
  resolvers,
  errorFormatter: unifyMercuriusErrorFormatter()
})

app.get('/', async function (req, reply) {
  const query = '{ add(x: 2, y: 2) }'
  return reply.graphql(query)
})

app.listen(3000)

Plugin options

name default description
disableDetails false If true will remove the originalError key from the error response
disableLog false Disable logging on error

Tests

To execute jest tests (all errors, type integrity test)

pnpm test

Maintain

This package use TSdx. Please check documentation to update this package.

unify-mercurius's People

Contributors

lucasgras avatar qlaffont avatar renovate[bot] avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

unify-mercurius's Issues

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Ignored or Blocked

These are blocked by an existing closed PR and will not be recreated unless you click a checkbox below.

Detected dependencies

github-actions
.github/workflows/main.yml
  • actions/checkout v4
  • actions/setup-node v4
  • pnpm/action-setup v4.0.0
  • actions/checkout v4
  • actions/setup-node v4
  • pnpm/action-setup v4.0.0
  • paambaati/codeclimate-action v6.0.0
.github/workflows/publish.yml
  • dorny/paths-filter v3
  • actions/checkout v4
  • actions/setup-node v4
  • pnpm/action-setup v4.0.0
  • qzb/standard-version-action v1.0.13
  • JS-DevTools/npm-publish v3
npm
package.json
  • graphql ^16.6.0
  • mercurius ^14.0.0
  • unify-errors ^1.2.124
  • @jest/globals 29.7.0
  • @size-limit/preset-small-lib 11.1.2
  • @types/jest ^29.5.0
  • @types/node 20.12.10
  • @typescript-eslint/eslint-plugin 7.8.0
  • @typescript-eslint/parser 7.8.0
  • eslint 8.57.0
  • eslint-config-prettier 9.1.0
  • eslint-plugin-import 2.29.1
  • eslint-plugin-prettier 5.1.3
  • eslint-plugin-simple-import-sort 12.1.0
  • fastify 4.27.0
  • husky 9.0.11
  • jest ^29.5.0
  • jest-environment-jsdom ^29.5.0
  • mercurius-codegen 5.0.4
  • mercurius-integration-testing 8.2.0
  • node-abort-controller 3.1.1
  • node-fetch 3.3.2
  • prettier 3.2.5
  • size-limit 11.1.2
  • ts-jest ^29.1.0
  • tsdx 0.14.1
  • tslib 2.6.2
  • typescript 5.4.5
  • node >=10
nvm
.nvmrc
  • node 20.13.0

  • Check this box to trigger a request for Renovate to run again on this repository

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.