unify-elysia-gql
TypeScript icon, indicating that this package has built-in type declarations

1.1.9 • Public • Published

unify-elysia-gql

Library to have GraphQL generic errors from unify-error library.

Support :

Usage

import { pluginUnifyElysiaGraphQL } from 'unify-elysia-gql';
const { handleQueryAndResolver } = pluginUnifyElysiaGraphQL(config);

const server = new Elysia()
  .use(
    yoga({
      typeDefs: `
        type Query {
          BadRequest: String!
        }
      `,
      resolvers: {
        Query: {
          BadRequest: handleQueryAndResolver(() => {
            throw new BadRequest({
              issue: 'This is the issue',
            });
          }),
        },
      },
    }),
  );

Return

name description
handleQueryAndResolver Map query and/or resolver callback
handleQueriesAndResolvers Map array of queries and/or resolvers callback

Plugin options

name default description
logInstance undefined (OPTIONAL) Pino or Console or @bogeychan/elysia-logger instance
disableDetails false Disable error details like stack
disableLog false Disable logging on error

Tests

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

bun test

Readme

Keywords

none

Package Sidebar

Install

npm i unify-elysia-gql

Weekly Downloads

177

Version

1.1.9

License

none

Unpacked Size

28.6 kB

Total Files

7

Last publish

Collaborators

  • qlaffont