0.8.1 • Published 4 months ago

@graphql-ez/plugin-scalars v0.8.1

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

@graphql-ez/plugin-scalars

Integration with GraphQL Scalars

Currently this plugin requires the presence of Schema Plugin or GraphQL Modules Plugin in the same EZ App.

Usage

Check the GraphQL Scalars website docs to see all available scalars, of you can inspect the types of the plugin

import { ezScalars } from '@graphql-ez/plugin-scalars';

const ezApp = CreateApp({
  ez: {
    plugins: [
      // ...
      ezScalars({
        // ...
      }),
    ],
  },
  // ...
});

This plugin accepts different syntaxes:

Wildcard

If you specify "*", every scalar is added to you GraphQL Schema.

ezScalars('*');

Array

ezScalars(['DateTime', 'JSONObject']);

Object

ezScalars({
  // You can use `1` | `0`
  DateTime: 1,
  // or `true` | `false`
  JSONObject: true,
});

Custom Scalars / Override Resolvers

You can specify custom scalars or override the existing scalars resolvers with the second options parameter:

import { GraphQLScalarType } from 'graphql';

ezScalars(
  {
    DateTime: 1,
  },
  // Custom Scalars / Override
  {
    DateTime: new GraphQLScalarType({
      name: 'DateTime',
      // ...
    }),

    // New Custom Scalar
    IntID: new GraphQLScalarType({
      name: 'IntID',
      // ...
    }),
  }
);
0.8.1

4 months ago

0.7.6

1 year ago

0.8.0

1 year ago

0.7.5

2 years ago

0.7.4

2 years ago

0.7.3

3 years ago

0.7.2

3 years ago

0.7.1

3 years ago

0.7.0

3 years ago

0.6.3

3 years ago

0.6.2

3 years ago

0.6.1

3 years ago

0.6.0

3 years ago

0.5.0

3 years ago

0.4.2

3 years ago

0.4.1

3 years ago

0.4.0

3 years ago

0.3.2

3 years ago

0.3.1

3 years ago

0.3.0

3 years ago

0.1.2

3 years ago

0.2.0

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago