# @graphql-ez/plugin-scalars

> Integration with [GraphQL Scalars](https://www.graphql-scalars.dev/)

Latest version **0.8.1** (published 2024-01-04) · MIT license · 0 weekly downloads

## Install

```sh
npm install @graphql-ez/plugin-scalars
pnpm add @graphql-ez/plugin-scalars
yarn add @graphql-ez/plugin-scalars
bun add @graphql-ez/plugin-scalars
```

## Health

**Score 40/100 (D)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high maintenance score.

Warnings: low downloads; pre 1.0.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 0.8.1 |
| Published | 2024-01-04 |
| First published | 2021-06-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=14.13.1 |
| Dependencies | 3 |
| Unpacked size | 9.9 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 59 |
| Author | PabloSz |
| Maintainers | pablosz |

## Links

- npm: https://www.npmjs.com/package/@graphql-ez/plugin-scalars
- Repository: https://github.com/PabloSzx/graphql-ez
- Homepage: https://www.graphql-ez.com
- Issues: https://github.com/PabloSzx/graphql-ez/issues
- npm.io page: https://npm.io/package/@graphql-ez/plugin-scalars

## Dependencies (3)

- [graphql-scalars](https://npm.io/package/graphql-scalars.md) ^1.20.1
- [@graphql-ez/utils](https://npm.io/package/@graphql-ez/utils.md) ^0.2.1
- [@graphql-tools/utils](https://npm.io/package/@graphql-tools/utils.md) ^9.1.3

## Recent versions

- 0.8.1 (latest) — 2024-01-04
- 0.8.0 — 2022-12-18
- 0.7.6 — 2022-12-18
- 0.7.5 — 2022-05-18
- 0.7.4 — 2022-02-02
- 0.7.3 — 2021-09-09
- 0.7.2 — 2021-09-03
- 0.7.1 — 2021-08-28
- 0.7.0 — 2021-08-20
- 0.6.3 — 2021-08-12
- 0.6.2 — 2021-08-11
- 0.6.1 — 2021-08-03
- 0.6.0 — 2021-07-28
- 0.5.0 — 2021-07-25
- 0.4.2 — 2021-07-12
- … 9 more at https://npm.io/package/@graphql-ez/plugin-scalars/versions

## README

# @graphql-ez/plugin-scalars

Integration with [GraphQL Scalars](https://www.graphql-scalars.dev/)

Currently this plugin requires the presence of [Schema Plugin](https://www.graphql-ez.com/plugins/schema) or [GraphQL Modules Plugin](https://www.graphql-ez.com/plugins/graphql-scalars) in the same EZ App.

## Usage

Check the [GraphQL Scalars website docs](https://www.graphql-scalars.dev/docs) to see all available scalars, of you can inspect the types of the plugin

```ts
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.

```ts
ezScalars('*');
```

### Array

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

### Object

```ts
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:

```ts
import { GraphQLScalarType } from 'graphql';

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

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

---
_Source: https://npm.io/package/@graphql-ez/plugin-scalars · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
