# graphql-aggregator

> This library can aggregate some graphql things with types.

Latest version **1.0.4** (published 2022-02-25) · ISC license · 0 weekly downloads

## Install

```sh
npm install graphql-aggregator
pnpm add graphql-aggregator
yarn add graphql-aggregator
bun add graphql-aggregator
```

## Health

**Score 30/100 (F)** — status: abandoned.

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

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.4 |
| Published | 2022-02-25 |
| First published | 2022-02-25 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 32.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | skywill |

## Links

- npm: https://www.npmjs.com/package/graphql-aggregator
- Repository: https://github.com/T-Kisaku/graphql-aggregator
- Homepage: https://github.com/T-Kisaku/graphql-aggregator#readme
- Issues: https://github.com/T-Kisaku/graphql-aggregator/issues
- npm.io page: https://npm.io/package/graphql-aggregator

## Recent versions

- 1.0.4 (latest) — 2022-02-25
- 1.0.3 — 2022-02-25
- 1.0.2 — 2022-02-25
- 1.0.1 — 2022-02-25
- 1.0.0 — 2022-02-25

## README

# Table of contents<!-- omit in toc -->
- [What is this?](#what-is-this)
- [When should I use this?](#when-should-i-use-this)
- [Getting started](#getting-started)

# What is this?
You can use plugins to define graphql resolvers like below

```javascript
// This is src/utils/graphqlUtils.ts
import { resolverCreator } from 'graphql-aggregator/index';

import type {
  QueryResolvers,
  MutationResolvers,
} from "../../generated/graphql";
import { Context } from '@src/context';

export const
  defQuery = resolverCreator<QueryResolvers, Context>(),
  defMutation = resolverCreator<MutationResolvers, Context>()
```

Then define resolver and combine them.

```javascript
import { combineResolvers } from "@src/utils/graphqlType";
import { defQuery} from '@src/utils/graphqlUtils.ts'

const combinedQueryResolver = combineResolvers([
    defMutation("greeting", {
    type: GStr,
    resolve: async (_, args, ctx) => "Hello world with graphql-aggregator!!",
  }),
]);

import { GraphQLObjectType, GraphQLSchema } from 'graphql';

const schema = new GraphQLSchema({
    query: new GraphQLObjectType({
        name: "Query",
        fields: queryResolvers
    })
});

```

# When should I use this?
- Who don't like ApolloGraphql, TypeGrapql
- Who want to use [origint graphql library](https://github.com/graphql/graphql-js)
- Who want to apply type system to resolve

If you apply above conditions, this package help you.

# Getting started
```bash
npm install graphql-aggregator
```

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