diff --git a/.changeset/afraid-flowers-thank.md b/.changeset/afraid-flowers-thank.md
new file mode 100644
index 000000000..2bd2a077f
--- /dev/null
+++ b/.changeset/afraid-flowers-thank.md
@@ -0,0 +1,7 @@
+---
+'gqty': minor
+'@gqty/react': minor
+---
+
+Added `operationName` in `resolved()`, `inlineResolved()`,
+`useTransactionQuery()` and `useLazyQuery()`
diff --git a/.changeset/clever-plums-shout.md b/.changeset/clever-plums-shout.md
new file mode 100644
index 000000000..eb42aec2b
--- /dev/null
+++ b/.changeset/clever-plums-shout.md
@@ -0,0 +1,5 @@
+---
+'gqty': minor
+---
+
+feat: batching by microtask
diff --git a/.changeset/config.json b/.changeset/config.json
index 75653b37d..7fa399019 100644
--- a/.changeset/config.json
+++ b/.changeset/config.json
@@ -1,12 +1,16 @@
{
- "$schema": "https://unpkg.com/@changesets/config@1.5.0/schema.json",
- "changelog": "@changesets/cli/changelog",
+ "$schema": "https://unpkg.com/@changesets/config@2.1.0/schema.json",
+ "changelog": ["@changesets/changelog-github", { "repo": "gqty-dev/gqty" }],
"commit": false,
"linked": [],
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
- "ignore": ["example-*", "website"],
+ "ignore": ["example-*"],
+ "snapshot": {
+ "useCalculatedVersion": true,
+ "prereleaseTemplate": "{tag}-{datetime}.{commit}"
+ },
"___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH": {
"onlyUpdatePeerDependentsWhenOutOfRange": true
}
diff --git a/.changeset/cool-wolves-own.md b/.changeset/cool-wolves-own.md
deleted file mode 100644
index d07d4395c..000000000
--- a/.changeset/cool-wolves-own.md
+++ /dev/null
@@ -1,5 +0,0 @@
----
-'gqty': minor
----
-
-Add `operationName` option to `resolved()` and `inlineResolved()`.
diff --git a/.changeset/cyan-seas-relax.md b/.changeset/cyan-seas-relax.md
new file mode 100644
index 000000000..1fd805f1c
--- /dev/null
+++ b/.changeset/cyan-seas-relax.md
@@ -0,0 +1,5 @@
+---
+'gqty': minor
+---
+
+Added `$meta` API
diff --git a/.changeset/dull-hotels-listen.md b/.changeset/dull-hotels-listen.md
new file mode 100644
index 000000000..021c06c0a
--- /dev/null
+++ b/.changeset/dull-hotels-listen.md
@@ -0,0 +1,5 @@
+---
+'gqty': major
+---
+
+Added "Legacy" prefix to deprecated types
diff --git a/.changeset/empty-worms-smell.md b/.changeset/empty-worms-smell.md
new file mode 100644
index 000000000..ac8be24f1
--- /dev/null
+++ b/.changeset/empty-worms-smell.md
@@ -0,0 +1,5 @@
+---
+'@gqty/cli': major
+---
+
+Dropped inferrable types from generated schema
diff --git a/.changeset/four-toys-crash.md b/.changeset/four-toys-crash.md
new file mode 100644
index 000000000..1e7269cfb
--- /dev/null
+++ b/.changeset/four-toys-crash.md
@@ -0,0 +1,5 @@
+---
+'gqty': major
+---
+
+Added new logging interface for `@gqty/logger`
diff --git a/.changeset/gold-lemons-pump.md b/.changeset/gold-lemons-pump.md
new file mode 100644
index 000000000..1c29d5a95
--- /dev/null
+++ b/.changeset/gold-lemons-pump.md
@@ -0,0 +1,6 @@
+---
+'gqty': major
+---
+
+`backupPersistence()` and `restorePersistence()` is now replaced with
+`persist()`, `restore()` and `restoreAsync()`.
diff --git a/.changeset/grumpy-clouds-notice.md b/.changeset/grumpy-clouds-notice.md
new file mode 100644
index 000000000..d7e63219d
--- /dev/null
+++ b/.changeset/grumpy-clouds-notice.md
@@ -0,0 +1,5 @@
+---
+'@gqty/react': minor
+---
+
+Upgrade to the new core
diff --git a/.changeset/hip-kangaroos-give.md b/.changeset/hip-kangaroos-give.md
new file mode 100644
index 000000000..9fb12b73b
--- /dev/null
+++ b/.changeset/hip-kangaroos-give.md
@@ -0,0 +1,5 @@
+---
+'gqty': major
+---
+
+QueryFetcher now accepts QueryPayload as the first parameter
diff --git a/.changeset/lemon-bags-behave.md b/.changeset/lemon-bags-behave.md
new file mode 100644
index 000000000..cef159bed
--- /dev/null
+++ b/.changeset/lemon-bags-behave.md
@@ -0,0 +1,5 @@
+---
+'@gqty/cli': minor
+---
+
+feat: interactive mode
diff --git a/.changeset/metal-windows-fly.md b/.changeset/metal-windows-fly.md
new file mode 100644
index 000000000..3363de1ad
--- /dev/null
+++ b/.changeset/metal-windows-fly.md
@@ -0,0 +1,5 @@
+---
+'gqty': major
+---
+
+Remade `Cache` with expiry, normalization and persistence
diff --git a/.changeset/moody-onions-exercise.md b/.changeset/moody-onions-exercise.md
new file mode 100644
index 000000000..68104c8e8
--- /dev/null
+++ b/.changeset/moody-onions-exercise.md
@@ -0,0 +1,5 @@
+---
+'gqty': major
+---
+
+Axed `Scheduler`, `Interceptor` and `EventHandler`
diff --git a/.changeset/polite-maps-draw.md b/.changeset/polite-maps-draw.md
new file mode 100644
index 000000000..46ad31348
--- /dev/null
+++ b/.changeset/polite-maps-draw.md
@@ -0,0 +1,5 @@
+---
+'@gqty/react': minor
+---
+
+Added `ResolverContainer` to replace scheduler for legacy resolvers.
diff --git a/.changeset/polite-wolves-explode.md b/.changeset/polite-wolves-explode.md
new file mode 100644
index 000000000..004c1b02d
--- /dev/null
+++ b/.changeset/polite-wolves-explode.md
@@ -0,0 +1,5 @@
+---
+'gqty': major
+---
+
+Reworked `Accessor` and added scoped context
diff --git a/.changeset/pre.json b/.changeset/pre.json
new file mode 100644
index 000000000..8064d073d
--- /dev/null
+++ b/.changeset/pre.json
@@ -0,0 +1,45 @@
+{
+ "mode": "exit",
+ "tag": "beta",
+ "initialVersions": {
+ "example-gnt": "0.1.0",
+ "example-react": "1.0.0",
+ "example-vite": "0.0.0",
+ "test-utils": "0.1.0",
+ "@gqty/cli": "3.3.0",
+ "gqty": "2.3.0",
+ "@gqty/logger": "2.0.2",
+ "@gqty/react": "2.1.1",
+ "@gqty/subscriptions": "2.0.1"
+ },
+ "changesets": [
+ "afraid-flowers-thank",
+ "curvy-dragons-smell",
+ "cyan-seas-relax",
+ "dull-hotels-listen",
+ "empty-worms-smell",
+ "four-toys-crash",
+ "gold-lemons-pump",
+ "grumpy-clouds-notice",
+ "hip-kangaroos-give",
+ "lemon-bags-behave",
+ "metal-windows-fly",
+ "moody-onions-exercise",
+ "polite-maps-draw",
+ "polite-wolves-explode",
+ "rare-pets-tan",
+ "real-camels-run",
+ "seven-rings-retire",
+ "small-fishes-dress",
+ "small-penguins-invent",
+ "sour-rocks-vanish",
+ "stale-schools-sleep",
+ "stale-windows-march",
+ "tiny-brooms-check",
+ "tricky-bats-glow",
+ "tricky-coins-breathe",
+ "violet-lions-count",
+ "wise-coins-doubt",
+ "young-clocks-attend"
+ ]
+}
diff --git a/.changeset/rare-pets-tan.md b/.changeset/rare-pets-tan.md
new file mode 100644
index 000000000..422b665e8
--- /dev/null
+++ b/.changeset/rare-pets-tan.md
@@ -0,0 +1,5 @@
+---
+'gqty': major
+---
+
+Replaced `@gqty/subscriptions` with `graphql-ws` and `graphql-sse`
diff --git a/.changeset/real-camels-run.md b/.changeset/real-camels-run.md
new file mode 100644
index 000000000..cea9f7496
--- /dev/null
+++ b/.changeset/real-camels-run.md
@@ -0,0 +1,5 @@
+---
+'@gqty/react': minor
+---
+
+feat: Added onComplete for useMutation
diff --git a/.changeset/seven-rings-retire.md b/.changeset/seven-rings-retire.md
new file mode 100644
index 000000000..e52519fd7
--- /dev/null
+++ b/.changeset/seven-rings-retire.md
@@ -0,0 +1,5 @@
+---
+'@gqty/react': minor
+---
+
+Added `retry` in `useQuery()`
diff --git a/.changeset/small-fishes-dress.md b/.changeset/small-fishes-dress.md
new file mode 100644
index 000000000..a68826023
--- /dev/null
+++ b/.changeset/small-fishes-dress.md
@@ -0,0 +1,5 @@
+---
+'@gqty/cli': major
+---
+
+generated query fetcher now takes a single QueryPayload parameter
diff --git a/.changeset/small-penguins-invent.md b/.changeset/small-penguins-invent.md
index 2fbc31039..255c31fb2 100644
--- a/.changeset/small-penguins-invent.md
+++ b/.changeset/small-penguins-invent.md
@@ -2,4 +2,5 @@
'@gqty/react': minor
---
-Window focus refetching
+Added `refetchInteraval`, `refetchIntervalInBackground`, `refetchOnReconnect`
+and `refetchOnWindowVisible` in `useQuery`.
diff --git a/.changeset/stale-schools-sleep.md b/.changeset/stale-schools-sleep.md
new file mode 100644
index 000000000..1f831ecba
--- /dev/null
+++ b/.changeset/stale-schools-sleep.md
@@ -0,0 +1,5 @@
+---
+'gqty': major
+---
+
+Rewritten `Selection` class
diff --git a/.changeset/stale-windows-march.md b/.changeset/stale-windows-march.md
new file mode 100644
index 000000000..83e9987b1
--- /dev/null
+++ b/.changeset/stale-windows-march.md
@@ -0,0 +1,5 @@
+---
+'gqty': major
+---
+
+Introduced `resolve()` and `subscribe()` API
diff --git a/.changeset/tall-cheetahs-help.md b/.changeset/tall-cheetahs-help.md
new file mode 100644
index 000000000..2120dd950
--- /dev/null
+++ b/.changeset/tall-cheetahs-help.md
@@ -0,0 +1,9 @@
+---
+'@gqty/subscriptions': patch
+'@gqty/logger': patch
+'@gqty/react': patch
+'gqty': patch
+'@gqty/cli': patch
+---
+
+Fix missing exports types package.json
diff --git a/.changeset/tiny-brooms-check.md b/.changeset/tiny-brooms-check.md
new file mode 100644
index 000000000..d693acb5d
--- /dev/null
+++ b/.changeset/tiny-brooms-check.md
@@ -0,0 +1,5 @@
+---
+'@gqty/react': minor
+---
+
+Fetch errors now throws to boundaries in suspense mode.
diff --git a/.changeset/tricky-coins-breathe.md b/.changeset/tricky-coins-breathe.md
new file mode 100644
index 000000000..146b9eaf9
--- /dev/null
+++ b/.changeset/tricky-coins-breathe.md
@@ -0,0 +1,5 @@
+---
+'gqty': major
+---
+
+Replaced `lodash` with `just-*` and dropped `@gqty/utils`
diff --git a/.changeset/violet-lions-count.md b/.changeset/violet-lions-count.md
new file mode 100644
index 000000000..e8c2e2ce5
--- /dev/null
+++ b/.changeset/violet-lions-count.md
@@ -0,0 +1,6 @@
+---
+'gqty': major
+---
+
+Deprecated `resolved()`, `inlineResolved()`, `mutate()`, `track()`, `prefetch()`
+and `refetch()`
diff --git a/.changeset/weak-cougars-compare.md b/.changeset/weak-cougars-compare.md
new file mode 100644
index 000000000..520efc72e
--- /dev/null
+++ b/.changeset/weak-cougars-compare.md
@@ -0,0 +1,6 @@
+---
+'@gqty/react': minor
+'gqty': minor
+---
+
+feat: added extensions option
diff --git a/.changeset/wise-coins-doubt.md b/.changeset/wise-coins-doubt.md
new file mode 100644
index 000000000..1fb1b44f9
--- /dev/null
+++ b/.changeset/wise-coins-doubt.md
@@ -0,0 +1,5 @@
+---
+'gqty': minor
+---
+
+Added `name` in `GQtyError` for better logging
diff --git a/.changeset/young-clocks-attend.md b/.changeset/young-clocks-attend.md
new file mode 100644
index 000000000..f294abb40
--- /dev/null
+++ b/.changeset/young-clocks-attend.md
@@ -0,0 +1,5 @@
+---
+'gqty': major
+---
+
+Replace variable serializer with object-hash, now with shortened alias
diff --git a/.github/workflows/canary.yaml b/.github/workflows/canary.yaml
index cdcdb51af..855dd1ad3 100644
--- a/.github/workflows/canary.yaml
+++ b/.github/workflows/canary.yaml
@@ -6,38 +6,12 @@ on:
- main
jobs:
- publish-canary:
- name: Publish Canary
- runs-on: ubuntu-latest
- if: github.event.pull_request.head.repo.full_name == github.repository
- steps:
- - name: Checkout Repo
- uses: actions/checkout@v3
- with:
- # This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
- fetch-depth: 0
-
- - uses: pnpm/action-setup@v2.2.4
- with:
- version: ^7.1.1
- - name: Setup Node.js 16.x
- uses: actions/setup-node@v3
- with:
- node-version: 16.x
- cache: 'pnpm'
-
- - name: Setup NPM credentials
- run: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
- env:
- NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
-
- - name: Install Dependencies
- run: pnpm install
-
- - name: Release Canary
- id: canary
- uses: 'kamilkisiela/release-canary@master'
- with:
- npm-token: ${{ secrets.NPM_TOKEN }}
- npm-script: 'pnpm release:canary'
- changesets: true
+ release-canary:
+ uses: the-guild-org/shared-config/.github/workflows/release-snapshot.yml@main
+ with:
+ packageManager: pnpm
+ nodeVersion: 16 # align with the-guild-org/changesets-snapshot-action
+ npmTag: canary
+ secrets:
+ githubToken: ${{ secrets.GITHUB_TOKEN }}
+ npmToken: ${{ secrets.NPM_TOKEN }}
diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml
index 437a363d4..93fa53463 100644
--- a/.github/workflows/release.yaml
+++ b/.github/workflows/release.yaml
@@ -22,7 +22,7 @@ jobs:
- uses: pnpm/action-setup@v2.2.4
with:
- version: ^7.1.1
+ version: ^8.14.0
- name: Setup Node.js 16.x
uses: actions/setup-node@v3
with:
diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml
index 4a3f8153f..39db77168 100644
--- a/.github/workflows/tests.yaml
+++ b/.github/workflows/tests.yaml
@@ -20,19 +20,19 @@ env:
jobs:
build:
- timeout-minutes: 10
+ timeout-minutes: 20
name: Install, Build and Test
runs-on: ${{ matrix.os }}
strategy:
matrix:
- node-version: [14, 16, 18]
+ node-version: [18, 20.5.1]
os: [ubuntu-latest]
steps:
- name: Checkout code
uses: actions/checkout@v3
- uses: pnpm/action-setup@v2.2.4
with:
- version: ^7.1.1
+ version: ^8.14.0
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
diff --git a/.prettierrc b/.prettierrc
index 686ffa2ed..ec66f0d83 100644
--- a/.prettierrc
+++ b/.prettierrc
@@ -1,5 +1,6 @@
{
"printWidth": 80,
+ "proseWrap": "always",
"semi": true,
"singleQuote": true,
"trailingComma": "es5"
diff --git a/.vscode/settings.json b/.vscode/settings.json
index 25fa6215f..b87f0d5f5 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -1,3 +1,4 @@
{
- "typescript.tsdk": "node_modules/typescript/lib"
+ "typescript.tsdk": "node_modules/typescript/lib",
+ "prettier.proseWrap": "preserve"
}
diff --git a/README.md b/README.md
index ec4bd185b..882c1793c 100644
--- a/README.md
+++ b/README.md
@@ -1,31 +1,28 @@
-
+
- a GraphQL client built for rapid iteration.
-
-
-
-
-
-
+ The No-GraphQL Client for TypeScript
+
+[![Documentation](https://img.shields.io/badge/documentation-documentation?color=C00B84)](https://gqty.dev)
+[![Discord](https://img.shields.io/discord/874477141834739762?color=7289d9&label=discord)](https://discord.gg/U967mp5qbQ)
+
-
-
-
+[![GQty Hero Section](internal/images/hero.png)](https://gqty.dev)
---
-Head over to [gqty.dev](https://gqty.dev), to explore features and documentation.
+Head over to [gqty.dev](https://gqty.dev) to explore features and documentation.
---
## Get involved
-Documentation, bug reports, pull requests, and all other contributions are welcome! See [`CONTRIBUTING.md`](CONTRIBUTING.md).
+Documentation, bug reports, pull requests, and all other contributions are
+welcome! See [`CONTRIBUTING.md`](CONTRIBUTING.md).
Docs powered by [Vercel](https://vercel.com/?utm_source=gqty&utm_campaign=oss)
diff --git a/bob-esbuild.config.ts b/bob-esbuild.config.ts
index ccd37e88c..eb2a2ba2a 100644
--- a/bob-esbuild.config.ts
+++ b/bob-esbuild.config.ts
@@ -1,5 +1,5 @@
-import { sep } from 'path';
import { readFileSync } from 'fs';
+import { sep } from 'path';
const isCLIPackage = process.cwd().endsWith(sep + 'cli');
diff --git a/examples/ez-react-next/gqty.config.cjs b/examples/ez-react-next/gqty.config.cjs
deleted file mode 100644
index 8ff3234f7..000000000
--- a/examples/ez-react-next/gqty.config.cjs
+++ /dev/null
@@ -1,13 +0,0 @@
-/**
- * @type {import("@gqty/cli").GQtyConfig}
- */
-const config = {
- react: true,
- scalarTypes: { DateTime: 'string' },
- introspection: { endpoint: './schema.gql', headers: {} },
- destination: './src/gqty/index.ts',
- subscriptions: false,
- javascriptOutput: false,
-};
-
-module.exports = config;
diff --git a/examples/ez-react-next/next-env.d.ts b/examples/ez-react-next/next-env.d.ts
deleted file mode 100644
index 9bc3dd46b..000000000
--- a/examples/ez-react-next/next-env.d.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-///
-///
-///
-
-// NOTE: This file should not be edited
-// see https://nextjs.org/docs/basic-features/typescript for more information.
diff --git a/examples/ez-react-next/package.json b/examples/ez-react-next/package.json
deleted file mode 100644
index df7430864..000000000
--- a/examples/ez-react-next/package.json
+++ /dev/null
@@ -1,36 +0,0 @@
-{
- "name": "example-ez-react-next",
- "version": "0.0.1",
- "private": true,
- "scripts": {
- "build": "next build",
- "dev": "concurrently -r \"next dev\" \"wait-on -s 1 http://localhost:3000 && open-cli http://localhost:3000\"",
- "generate": "gqty generate",
- "start": "next start"
- },
- "dependencies": {
- "@gqty/logger": "workspace:^2.0.2",
- "@gqty/react": "workspace:^2.1.1",
- "@graphql-ez/nextjs": "^0.11.0",
- "@graphql-ez/plugin-codegen": "^0.8.0",
- "@graphql-ez/plugin-graphiql": "^0.12.0",
- "@graphql-ez/plugin-schema": "^0.9.0",
- "gqty": "workspace:^2.3.0",
- "graphql": "^16.6.0",
- "graphql-ez": "^0.16.0",
- "next": "^12.3.4",
- "react": "^17.0.2",
- "react-dom": "^17.0.2"
- },
- "devDependencies": {
- "@gqty/cli": "workspace:^3.3.0",
- "@types/node": "^18.15.5",
- "@types/react": "^17.0.53",
- "@types/react-dom": "^18.0.11",
- "concurrently": "^7.6.0",
- "esbuild": "^0.17.12",
- "open-cli": "^7.2.0",
- "typescript": "^4.9.5",
- "wait-on": "^7.0.1"
- }
-}
diff --git a/examples/ez-react-next/schema.gql b/examples/ez-react-next/schema.gql
deleted file mode 100644
index 4bedda35d..000000000
--- a/examples/ez-react-next/schema.gql
+++ /dev/null
@@ -1,13 +0,0 @@
-schema {
- query: Query
-}
-
-type Query {
- hello: String!
- user: User!
-}
-
-type User {
- id: ID!
- users: [User!]!
-}
diff --git a/examples/ez-react-next/src/ez.generated.ts b/examples/ez-react-next/src/ez.generated.ts
deleted file mode 100644
index 225cb9346..000000000
--- a/examples/ez-react-next/src/ez.generated.ts
+++ /dev/null
@@ -1,183 +0,0 @@
-import type { GraphQLResolveInfo } from 'graphql';
-import type { EZContext } from 'graphql-ez';
-export type Maybe = T | null;
-export type InputMaybe = Maybe;
-export type Exact = {
- [K in keyof T]: T[K];
-};
-export type MakeOptional = Omit & {
- [SubKey in K]?: Maybe;
-};
-export type MakeMaybe = Omit & {
- [SubKey in K]: Maybe;
-};
-export type ResolverFn = (
- parent: TParent,
- args: TArgs,
- context: TContext,
- info: GraphQLResolveInfo
-) =>
- | Promise>
- | import('graphql-ez').DeepPartial;
-/** All built-in and custom scalars, mapped to their actual values */
-export type Scalars = {
- ID: string;
- String: string;
- Boolean: boolean;
- Int: number;
- Float: number;
-};
-
-export type Query = {
- __typename?: 'Query';
- hello: Scalars['String'];
- user: User;
-};
-
-export type User = {
- __typename?: 'User';
- id: Scalars['ID'];
- users: Array;
-};
-
-export type ResolverTypeWrapper = Promise | T;
-
-export type ResolverWithResolve = {
- resolve: ResolverFn;
-};
-export type Resolver =
- | ResolverFn
- | ResolverWithResolve;
-
-export type SubscriptionSubscribeFn = (
- parent: TParent,
- args: TArgs,
- context: TContext,
- info: GraphQLResolveInfo
-) => AsyncIterable | Promise>;
-
-export type SubscriptionResolveFn = (
- parent: TParent,
- args: TArgs,
- context: TContext,
- info: GraphQLResolveInfo
-) => TResult | Promise;
-
-export interface SubscriptionSubscriberObject<
- TResult,
- TKey extends string,
- TParent,
- TContext,
- TArgs
-> {
- subscribe: SubscriptionSubscribeFn<
- { [key in TKey]: TResult },
- TParent,
- TContext,
- TArgs
- >;
- resolve?: SubscriptionResolveFn<
- TResult,
- { [key in TKey]: TResult },
- TContext,
- TArgs
- >;
-}
-
-export interface SubscriptionResolverObject {
- subscribe: SubscriptionSubscribeFn;
- resolve: SubscriptionResolveFn;
-}
-
-export type SubscriptionObject<
- TResult,
- TKey extends string,
- TParent,
- TContext,
- TArgs
-> =
- | SubscriptionSubscriberObject
- | SubscriptionResolverObject;
-
-export type SubscriptionResolver<
- TResult,
- TKey extends string,
- TParent = {},
- TContext = {},
- TArgs = {}
-> =
- | ((
- ...args: any[]
- ) => SubscriptionObject)
- | SubscriptionObject;
-
-export type TypeResolveFn = (
- parent: TParent,
- context: TContext,
- info: GraphQLResolveInfo
-) => Maybe | Promise>;
-
-export type IsTypeOfResolverFn = (
- obj: T,
- context: TContext,
- info: GraphQLResolveInfo
-) => boolean | Promise;
-
-export type NextResolverFn = () => Promise;
-
-export type DirectiveResolverFn<
- TResult = {},
- TParent = {},
- TContext = {},
- TArgs = {}
-> = (
- next: NextResolverFn,
- parent: TParent,
- args: TArgs,
- context: TContext,
- info: GraphQLResolveInfo
-) => TResult | Promise;
-
-/** Mapping between all available schema types and the resolvers types */
-export type ResolversTypes = {
- Query: ResolverTypeWrapper<{}>;
- String: ResolverTypeWrapper;
- User: ResolverTypeWrapper;
- ID: ResolverTypeWrapper;
- Boolean: ResolverTypeWrapper;
-};
-
-/** Mapping between all available schema types and the resolvers parents */
-export type ResolversParentTypes = {
- Query: {};
- String: Scalars['String'];
- User: User;
- ID: Scalars['ID'];
- Boolean: Scalars['Boolean'];
-};
-
-export type QueryResolvers<
- ContextType = EZContext,
- ParentType extends ResolversParentTypes['Query'] = ResolversParentTypes['Query']
-> = {
- hello?: Resolver;
- user?: Resolver;
-};
-
-export type UserResolvers<
- ContextType = EZContext,
- ParentType extends ResolversParentTypes['User'] = ResolversParentTypes['User']
-> = {
- id?: Resolver;
- users?: Resolver, ParentType, ContextType>;
- __isTypeOf?: IsTypeOfResolverFn;
-};
-
-export type Resolvers = {
- Query?: QueryResolvers;
- User?: UserResolvers;
-};
-
-declare module 'graphql-ez' {
- interface EZResolvers extends Resolvers {}
-}
diff --git a/examples/ez-react-next/src/gqty/index.ts b/examples/ez-react-next/src/gqty/index.ts
deleted file mode 100644
index 42d52d461..000000000
--- a/examples/ez-react-next/src/gqty/index.ts
+++ /dev/null
@@ -1,101 +0,0 @@
-/**
- * GQTY: You can safely modify this file and Query Fetcher based on your needs
- */
-
-import { createLogger } from '@gqty/logger';
-import { createReactClient } from '@gqty/react';
-import { createClient, QueryFetcher } from 'gqty';
-import {
- generatedSchema,
- GeneratedSchema,
- scalarsEnumsHash,
- SchemaObjectTypes,
- SchemaObjectTypesNames,
-} from './schema.generated';
-
-const endpoint =
- typeof window !== 'undefined'
- ? '/api/graphql'
- : 'http://localhost:3000/api/graphql';
-
-const queryFetcher: QueryFetcher = async function (
- query,
- variables,
- fetchOptions
-) {
- const response = await fetch(endpoint, {
- method: 'POST',
- headers: {
- 'Content-Type': 'application/json',
- },
- body: JSON.stringify({
- query,
- variables,
- }),
- ...fetchOptions,
- });
-
- const json = await response.json();
-
- return json;
-};
-
-export const client = createClient<
- GeneratedSchema,
- SchemaObjectTypesNames,
- SchemaObjectTypes
->({
- schema: generatedSchema,
- scalarsEnumsHash,
- queryFetcher,
-});
-
-if (typeof window !== 'undefined') {
- const logger = createLogger(client);
-
- logger.start();
-}
-
-const { query, mutation, mutate, subscription, resolved, refetch, track } =
- client;
-
-export { query, mutation, mutate, subscription, resolved, refetch, track };
-
-const {
- graphql,
- useQuery,
- usePaginatedQuery,
- useTransactionQuery,
- useLazyQuery,
- useRefetch,
- useMutation,
- useMetaState,
- prepareReactRender,
- useHydrateCache,
- prepareQuery,
-} = createReactClient(client, {
- defaults: {
- // Set this flag as "true" if your usage involves React Suspense
- // Keep in mind that you can overwrite it in a per-hook basis
- suspense: false,
-
- // Set this flag based on your needs
- staleWhileRevalidate: false,
- },
-});
-
-export {
- graphql,
- useQuery,
- usePaginatedQuery,
- useTransactionQuery,
- useLazyQuery,
- useRefetch,
- useMutation,
- useMetaState,
- prepareReactRender,
- useHydrateCache,
- prepareQuery,
-};
-
-export * from './schema.generated';
diff --git a/examples/ez-react-next/src/gqty/schema.generated.ts b/examples/ez-react-next/src/gqty/schema.generated.ts
deleted file mode 100644
index ce5a5af65..000000000
--- a/examples/ez-react-next/src/gqty/schema.generated.ts
+++ /dev/null
@@ -1,87 +0,0 @@
-/**
- * GQTY AUTO-GENERATED CODE: PLEASE DO NOT MODIFY MANUALLY
- */
-
-export type Maybe = T | null;
-export type InputMaybe = Maybe;
-export type Exact = {
- [K in keyof T]: T[K];
-};
-export type MakeOptional = Omit & {
- [SubKey in K]?: Maybe;
-};
-export type MakeMaybe = Omit & {
- [SubKey in K]: Maybe;
-};
-/** All built-in and custom scalars, mapped to their actual values */
-export interface Scalars {
- ID: string;
- String: string;
- Boolean: boolean;
- Int: number;
- Float: number;
-}
-
-export const scalarsEnumsHash: import('gqty').ScalarsEnumsHash = {
- Boolean: true,
- ID: true,
- String: true,
-};
-export const generatedSchema = {
- User: {
- __typename: { __type: 'String!' },
- id: { __type: 'ID!' },
- users: { __type: '[User!]!' },
- },
- mutation: {},
- query: {
- __typename: { __type: 'String!' },
- hello: { __type: 'String!' },
- user: { __type: 'User!' },
- },
- subscription: {},
-} as const;
-
-export interface User {
- __typename?: 'User';
- id: ScalarsEnums['ID'];
- users: Array;
-}
-
-export interface Mutation {
- __typename?: 'Mutation';
-}
-
-export interface Query {
- __typename?: 'Query';
- hello: ScalarsEnums['String'];
- user: User;
-}
-
-export interface Subscription {
- __typename?: 'Subscription';
-}
-
-export interface SchemaObjectTypes {
- Mutation: Mutation;
- Query: Query;
- Subscription: Subscription;
- User: User;
-}
-export type SchemaObjectTypesNames =
- | 'Mutation'
- | 'Query'
- | 'Subscription'
- | 'User';
-
-export interface GeneratedSchema {
- query: Query;
- mutation: Mutation;
- subscription: Subscription;
-}
-
-export type MakeNullable = {
- [K in keyof T]: T[K] | undefined;
-};
-
-export interface ScalarsEnums extends MakeNullable {}
diff --git a/examples/ez-react-next/src/pages/api/graphql.ts b/examples/ez-react-next/src/pages/api/graphql.ts
deleted file mode 100644
index ff49bf950..000000000
--- a/examples/ez-react-next/src/pages/api/graphql.ts
+++ /dev/null
@@ -1,48 +0,0 @@
-import { useGenerateGQty } from '@gqty/cli/envelop';
-import { CreateApp } from '@graphql-ez/nextjs';
-import { ezCodegen } from '@graphql-ez/plugin-codegen';
-import { ezGraphiQLIDE } from '@graphql-ez/plugin-graphiql';
-import { ezSchema, gql } from '@graphql-ez/plugin-schema';
-
-const { buildApp } = CreateApp({
- ez: {
- plugins: [
- ezGraphiQLIDE(),
- ezCodegen({
- outputSchema: true,
- }),
- ezSchema({
- schema: {
- typeDefs: gql`
- type Query {
- hello: String!
- user: User!
- }
- type User {
- id: ID!
- users: [User!]!
- }
- `,
- resolvers: {
- Query: {
- hello() {
- return 'Hello World';
- },
- user() {
- return {
- id: '1',
- users: [],
- };
- },
- },
- },
- },
- }),
- ],
- },
- envelop: {
- plugins: [useGenerateGQty()],
- },
-});
-
-export default buildApp().apiHandler;
diff --git a/examples/ez-react-next/src/pages/index.tsx b/examples/ez-react-next/src/pages/index.tsx
deleted file mode 100644
index a4beb954f..000000000
--- a/examples/ez-react-next/src/pages/index.tsx
+++ /dev/null
@@ -1,24 +0,0 @@
-import { useQuery, useRefetch } from '../gqty';
-
-export default function Index() {
- const refetch = useRefetch();
- const { hello, user } = useQuery();
- return (
-
-
{hello || '...'}
-
{user.id}
-
- {user.users.map((v) => (
-
{v.id}
- ))}
-
-
{
- refetch(user);
- }}
- >
- Refetch
-
-
- );
-}
diff --git a/examples/ez-react-next/tsconfig.json b/examples/ez-react-next/tsconfig.json
deleted file mode 100644
index 96cc1ff8b..000000000
--- a/examples/ez-react-next/tsconfig.json
+++ /dev/null
@@ -1,102 +0,0 @@
-{
- "compilerOptions": {
- /* Visit https://aka.ms/tsconfig.json to read more about this file */
- /* Projects */
- // "incremental": true, /* Enable incremental compilation */
- // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
- // "tsBuildInfoFile": "./", /* Specify the folder for .tsbuildinfo incremental compilation files. */
- // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects */
- // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
- // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
- /* Language and Environment */
- "target": "es2020" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
- // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
- // "jsx": "preserve", /* Specify what JSX code is generated. */
- // "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */
- // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
- // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h' */
- // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
- // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using `jsx: react-jsx*`.` */
- // "reactNamespace": "", /* Specify the object invoked for `createElement`. This only applies when targeting `react` JSX emit. */
- // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
- // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
- /* Modules */
- "module": "commonjs" /* Specify what module code is generated. */,
- // "rootDir": "./", /* Specify the root folder within your source files. */
- // "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */
- // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
- // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
- // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
- // "typeRoots": [], /* Specify multiple folders that act like `./node_modules/@types`. */
- // "types": [], /* Specify type package names to be included without being referenced in a source file. */
- // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
- // "resolveJsonModule": true, /* Enable importing .json files */
- // "noResolve": true, /* Disallow `import`s, `require`s or ``s from expanding the number of files TypeScript should add to a project. */
- /* JavaScript Support */
- // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files. */
- // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
- // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from `node_modules`. Only applicable with `allowJs`. */
- /* Emit */
- // "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
- // "declarationMap": true, /* Create sourcemaps for d.ts files. */
- // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
- // "sourceMap": true, /* Create source map files for emitted JavaScript files. */
- // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If `declaration` is true, also designates a file that bundles all .d.ts output. */
- // "outDir": "./", /* Specify an output folder for all emitted files. */
- // "removeComments": true, /* Disable emitting comments. */
- // "noEmit": true, /* Disable emitting files from a compilation. */
- // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
- // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types */
- // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
- // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
- // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
- // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
- // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
- // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
- // "newLine": "crlf", /* Set the newline character for emitting files. */
- // "stripInternal": true, /* Disable emitting declarations that have `@internal` in their JSDoc comments. */
- // "noEmitHelpers": true, /* Disable generating custom helper functions like `__extends` in compiled output. */
- // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
- // "preserveConstEnums": true, /* Disable erasing `const enum` declarations in generated code. */
- // "declarationDir": "./", /* Specify the output directory for generated declaration files. */
- /* Interop Constraints */
- // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
- // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
- "esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables `allowSyntheticDefaultImports` for type compatibility. */,
- // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
- "forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */,
- /* Type Checking */
- "strict": true /* Enable all strict type-checking options. */,
- // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied `any` type.. */
- // "strictNullChecks": true, /* When type checking, take into account `null` and `undefined`. */
- // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
- // "strictBindCallApply": true, /* Check that the arguments for `bind`, `call`, and `apply` methods match the original function. */
- // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
- // "noImplicitThis": true, /* Enable error reporting when `this` is given the type `any`. */
- // "useUnknownInCatchVariables": true, /* Type catch clause variables as 'unknown' instead of 'any'. */
- // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
- // "noUnusedLocals": true, /* Enable error reporting when a local variables aren't read. */
- // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read */
- // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
- // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
- // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
- // "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */
- // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
- // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type */
- // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
- // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
- /* Completeness */
- // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
- "skipLibCheck": true /* Skip type checking all .d.ts files. */,
- "lib": ["dom", "dom.iterable", "esnext"],
- "allowJs": true,
- "noEmit": true,
- "moduleResolution": "node",
- "resolveJsonModule": true,
- "isolatedModules": true,
- "jsx": "preserve",
- "incremental": true
- },
- "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
- "exclude": ["node_modules"]
-}
diff --git a/examples/ez/.gitignore b/examples/ez/.gitignore
deleted file mode 100644
index 4c9d7c35a..000000000
--- a/examples/ez/.gitignore
+++ /dev/null
@@ -1,4 +0,0 @@
-*.log
-.DS_Store
-node_modules
-dist
diff --git a/examples/ez/LICENSE.md b/examples/ez/LICENSE.md
deleted file mode 100644
index 2a6b02f89..000000000
--- a/examples/ez/LICENSE.md
+++ /dev/null
@@ -1,24 +0,0 @@
-# The MIT License (MIT)
-
-Copyright © `2021` `GQty`
-
-Permission is hereby granted, free of charge, to any person
-obtaining a copy of this software and associated documentation
-files (the “Software”), to deal in the Software without
-restriction, including without limitation the rights to use,
-copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the
-Software is furnished to do so, subject to the following
-conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-OTHER DEALINGS IN THE SOFTWARE.
diff --git a/examples/ez/README.md b/examples/ez/README.md
deleted file mode 100644
index e69de29bb..000000000
diff --git a/examples/ez/gqty.config.cjs b/examples/ez/gqty.config.cjs
deleted file mode 100644
index 1f38c5d85..000000000
--- a/examples/ez/gqty.config.cjs
+++ /dev/null
@@ -1,14 +0,0 @@
-/**
- * @type {import("@gqty/cli").GQtyConfig}
- */
-const config = {
- enumsAsStrings: false,
- react: false,
- scalarTypes: { DateTime: 'string', ExampleScalar: 'string' },
- preImport: '',
- introspection: { endpoint: './schema.gql' },
- destination: './src/generated/gqty.ts',
- subscriptions: false,
-};
-
-module.exports = config;
diff --git a/examples/ez/jest.config.js b/examples/ez/jest.config.js
deleted file mode 100644
index f2caf5bdd..000000000
--- a/examples/ez/jest.config.js
+++ /dev/null
@@ -1,3 +0,0 @@
-module.exports = require('test-utils/jest.config.js').getConfig({
- testTimeout: 20000,
-});
diff --git a/examples/ez/listen.ts b/examples/ez/listen.ts
deleted file mode 100644
index 27ab855d6..000000000
--- a/examples/ez/listen.ts
+++ /dev/null
@@ -1,9 +0,0 @@
-import { app } from './src/index';
-
-app.listen(3000, (err) => {
- if (err) {
- console.error(err);
- process.exit(1);
- }
- console.log('Listening on http://localhost:3000');
-});
diff --git a/examples/ez/package.json b/examples/ez/package.json
deleted file mode 100644
index a764c19a4..000000000
--- a/examples/ez/package.json
+++ /dev/null
@@ -1,38 +0,0 @@
-{
- "name": "example-ez",
- "version": "0.1.0",
- "private": true,
- "license": "MIT",
- "author": "PabloSzx ",
- "scripts": {
- "dev": "bob-tsm --watch src listen.ts --cjs listen.ts",
- "generate": "gqty generate",
- "listen": "bob-tsm --cjs listen.ts",
- "test": "jest"
- },
- "dependencies": {
- "@gqty/cli": "workspace:^3.3.0",
- "@graphql-ez/fastify": "^0.12.0",
- "@graphql-ez/fastify-testing": "^0.4.0",
- "@graphql-ez/plugin-altair": "^0.11.0",
- "@graphql-ez/plugin-codegen": "^0.8.0",
- "@graphql-ez/plugin-schema": "^0.9.0",
- "@graphql-typed-document-node/core": "^3.2.0",
- "fastify": "^4.11.0",
- "gqty": "workspace:^2.3.0",
- "graphql": "^16.6.0",
- "graphql-ez": "^0.16.0",
- "lodash": "^4.17.21",
- "randomstring": "^1.2.3",
- "test-utils": "workspace:^0.1.0"
- },
- "devDependencies": {
- "@types/lodash": "^4.14.191",
- "@types/node": "^18.15.5",
- "@types/randomstring": "^1.1.8",
- "bob-tsm": "^1.1.2",
- "esbuild": "^0.17.12",
- "jest": "^29.5.0",
- "typescript": "^4.9.5"
- }
-}
diff --git a/examples/ez/schema.gql b/examples/ez/schema.gql
deleted file mode 100644
index 73e08b84c..000000000
--- a/examples/ez/schema.gql
+++ /dev/null
@@ -1,75 +0,0 @@
-schema {
- query: Query
- mutation: Mutation
-}
-
-interface NamedEntity {
- name: String!
-}
-
-scalar ExampleScalar
-
-enum GreetingsEnum {
- Hello
- Hi
- Hey
-}
-
-input GreetingsInput {
- language: String!
- value: String
- scal: ExampleScalar
-}
-
-type Query {
- simpleString: String!
- stringWithArgs(hello: String!): String!
- stringNullableWithArgs(hello: String!, helloTwo: String): String
- stringNullableWithArgsArray(hello: [String]!): String
- object: Human
- objectArray: [Human]
- objectWithArgs(who: String!): Human!
- arrayString: [String!]!
- arrayObjectArgs(limit: Int!): [Human!]!
- greetings: GreetingsEnum!
- giveGreetingsInput(input: GreetingsInput!): String!
- number: Int!
- union: [TestUnion!]!
-}
-
-type Mutation {
- increment(n: Int!): Int!
-}
-
-type Human implements NamedEntity {
- name: String!
- father: Human!
- fieldWithArgs(id: Int!): Int!
- sons: [Human!]
- union: [TestUnion!]!
- args(a: String): Int
-}
-
-type Dog implements NamedEntity {
- name: String!
- owner: Human!
-}
-
-type A {
- a: String!
- common(a: String): Int
- z: String
-}
-
-type B {
- b: Int!
- common(b: Int): String
- z: String
-}
-
-type C {
- c: GreetingsEnum!
- z: String
-}
-
-union TestUnion = A | B | C
diff --git a/examples/ez/src/ez.generated.ts b/examples/ez/src/ez.generated.ts
deleted file mode 100644
index eef325fc3..000000000
--- a/examples/ez/src/ez.generated.ts
+++ /dev/null
@@ -1,706 +0,0 @@
-import type {
- GraphQLResolveInfo,
- GraphQLScalarType,
- GraphQLScalarTypeConfig,
-} from 'graphql';
-import type { EZContext } from 'graphql-ez';
-import type { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/core';
-export type Maybe = T | null;
-export type InputMaybe = Maybe;
-export type Exact = {
- [K in keyof T]: T[K];
-};
-export type MakeOptional = Omit & {
- [SubKey in K]?: Maybe;
-};
-export type MakeMaybe = Omit & {
- [SubKey in K]: Maybe;
-};
-export type ResolverFn = (
- parent: TParent,
- args: TArgs,
- context: TContext,
- info: GraphQLResolveInfo
-) =>
- | Promise>
- | import('graphql-ez').DeepPartial;
-export type Omit = Pick>;
-export type RequireFields = Omit & {
- [P in K]-?: NonNullable;
-};
-/** All built-in and custom scalars, mapped to their actual values */
-export type Scalars = {
- ID: string;
- String: string;
- Boolean: boolean;
- Int: number;
- Float: number;
- ExampleScalar: any;
-};
-
-export type NamedEntity = {
- name: Scalars['String'];
-};
-
-export enum GreetingsEnum {
- Hello = 'Hello',
- Hi = 'Hi',
- Hey = 'Hey',
-}
-
-export type GreetingsInput = {
- language: Scalars['String'];
- value?: InputMaybe;
- scal?: InputMaybe;
-};
-
-export type Query = {
- __typename?: 'Query';
- simpleString: Scalars['String'];
- stringWithArgs: Scalars['String'];
- stringNullableWithArgs?: Maybe;
- stringNullableWithArgsArray?: Maybe;
- object?: Maybe;
- objectArray?: Maybe>>;
- objectWithArgs: Human;
- arrayString: Array;
- arrayObjectArgs: Array;
- greetings: GreetingsEnum;
- giveGreetingsInput: Scalars['String'];
- number: Scalars['Int'];
- union: Array;
-};
-
-export type QueryStringWithArgsArgs = {
- hello: Scalars['String'];
-};
-
-export type QueryStringNullableWithArgsArgs = {
- hello: Scalars['String'];
- helloTwo?: InputMaybe;
-};
-
-export type QueryStringNullableWithArgsArrayArgs = {
- hello: Array>;
-};
-
-export type QueryObjectWithArgsArgs = {
- who: Scalars['String'];
-};
-
-export type QueryArrayObjectArgsArgs = {
- limit: Scalars['Int'];
-};
-
-export type QueryGiveGreetingsInputArgs = {
- input: GreetingsInput;
-};
-
-export type Mutation = {
- __typename?: 'Mutation';
- increment: Scalars['Int'];
-};
-
-export type MutationIncrementArgs = {
- n: Scalars['Int'];
-};
-
-export type Human = NamedEntity & {
- __typename?: 'Human';
- name: Scalars['String'];
- father: Human;
- fieldWithArgs: Scalars['Int'];
- sons?: Maybe>;
- union: Array;
- args?: Maybe;
-};
-
-export type HumanFieldWithArgsArgs = {
- id: Scalars['Int'];
-};
-
-export type HumanArgsArgs = {
- a?: InputMaybe;
-};
-
-export type Dog = NamedEntity & {
- __typename?: 'Dog';
- name: Scalars['String'];
- owner: Human;
-};
-
-export type A = {
- __typename?: 'A';
- a: Scalars['String'];
- common?: Maybe;
- z?: Maybe;
-};
-
-export type ACommonArgs = {
- a?: InputMaybe;
-};
-
-export type B = {
- __typename?: 'B';
- b: Scalars['Int'];
- common?: Maybe;
- z?: Maybe;
-};
-
-export type BCommonArgs = {
- b?: InputMaybe;
-};
-
-export type C = {
- __typename?: 'C';
- c: GreetingsEnum;
- z?: Maybe;
-};
-
-export type TestUnion = A | B | C;
-
-export type ResolverTypeWrapper = Promise | T;
-
-export type ResolverWithResolve = {
- resolve: ResolverFn;
-};
-export type Resolver =
- | ResolverFn
- | ResolverWithResolve;
-
-export type SubscriptionSubscribeFn = (
- parent: TParent,
- args: TArgs,
- context: TContext,
- info: GraphQLResolveInfo
-) => AsyncIterable | Promise>;
-
-export type SubscriptionResolveFn = (
- parent: TParent,
- args: TArgs,
- context: TContext,
- info: GraphQLResolveInfo
-) => TResult | Promise;
-
-export interface SubscriptionSubscriberObject<
- TResult,
- TKey extends string,
- TParent,
- TContext,
- TArgs
-> {
- subscribe: SubscriptionSubscribeFn<
- { [key in TKey]: TResult },
- TParent,
- TContext,
- TArgs
- >;
- resolve?: SubscriptionResolveFn<
- TResult,
- { [key in TKey]: TResult },
- TContext,
- TArgs
- >;
-}
-
-export interface SubscriptionResolverObject {
- subscribe: SubscriptionSubscribeFn;
- resolve: SubscriptionResolveFn;
-}
-
-export type SubscriptionObject<
- TResult,
- TKey extends string,
- TParent,
- TContext,
- TArgs
-> =
- | SubscriptionSubscriberObject
- | SubscriptionResolverObject;
-
-export type SubscriptionResolver<
- TResult,
- TKey extends string,
- TParent = {},
- TContext = {},
- TArgs = {}
-> =
- | ((
- ...args: any[]
- ) => SubscriptionObject)
- | SubscriptionObject;
-
-export type TypeResolveFn = (
- parent: TParent,
- context: TContext,
- info: GraphQLResolveInfo
-) => Maybe | Promise>;
-
-export type IsTypeOfResolverFn = (
- obj: T,
- context: TContext,
- info: GraphQLResolveInfo
-) => boolean | Promise;
-
-export type NextResolverFn = () => Promise;
-
-export type DirectiveResolverFn<
- TResult = {},
- TParent = {},
- TContext = {},
- TArgs = {}
-> = (
- next: NextResolverFn,
- parent: TParent,
- args: TArgs,
- context: TContext,
- info: GraphQLResolveInfo
-) => TResult | Promise;
-
-/** Mapping between all available schema types and the resolvers types */
-export type ResolversTypes = {
- NamedEntity: ResolversTypes['Human'] | ResolversTypes['Dog'];
- String: ResolverTypeWrapper;
- ExampleScalar: ResolverTypeWrapper;
- GreetingsEnum: GreetingsEnum;
- GreetingsInput: GreetingsInput;
- Query: ResolverTypeWrapper<{}>;
- Int: ResolverTypeWrapper;
- Mutation: ResolverTypeWrapper<{}>;
- Human: ResolverTypeWrapper<
- Omit & { union: Array }
- >;
- Dog: ResolverTypeWrapper;
- A: ResolverTypeWrapper;
- B: ResolverTypeWrapper;
- C: ResolverTypeWrapper;
- TestUnion: ResolversTypes['A'] | ResolversTypes['B'] | ResolversTypes['C'];
- Boolean: ResolverTypeWrapper;
-};
-
-/** Mapping between all available schema types and the resolvers parents */
-export type ResolversParentTypes = {
- NamedEntity: ResolversParentTypes['Human'] | ResolversParentTypes['Dog'];
- String: Scalars['String'];
- ExampleScalar: Scalars['ExampleScalar'];
- GreetingsInput: GreetingsInput;
- Query: {};
- Int: Scalars['Int'];
- Mutation: {};
- Human: Omit & {
- union: Array;
- };
- Dog: Dog;
- A: A;
- B: B;
- C: C;
- TestUnion:
- | ResolversParentTypes['A']
- | ResolversParentTypes['B']
- | ResolversParentTypes['C'];
- Boolean: Scalars['Boolean'];
-};
-
-export type NamedEntityResolvers<
- ContextType = EZContext,
- ParentType extends ResolversParentTypes['NamedEntity'] = ResolversParentTypes['NamedEntity']
-> = {
- __resolveType: TypeResolveFn<'Human' | 'Dog', ParentType, ContextType>;
- name?: Resolver;
-};
-
-export interface ExampleScalarScalarConfig
- extends GraphQLScalarTypeConfig {
- name: 'ExampleScalar';
-}
-
-export type QueryResolvers<
- ContextType = EZContext,
- ParentType extends ResolversParentTypes['Query'] = ResolversParentTypes['Query']
-> = {
- simpleString?: Resolver;
- stringWithArgs?: Resolver<
- ResolversTypes['String'],
- ParentType,
- ContextType,
- RequireFields
- >;
- stringNullableWithArgs?: Resolver<
- Maybe,
- ParentType,
- ContextType,
- RequireFields
- >;
- stringNullableWithArgsArray?: Resolver<
- Maybe,
- ParentType,
- ContextType,
- RequireFields
- >;
- object?: Resolver, ParentType, ContextType>;
- objectArray?: Resolver<
- Maybe>>,
- ParentType,
- ContextType
- >;
- objectWithArgs?: Resolver<
- ResolversTypes['Human'],
- ParentType,
- ContextType,
- RequireFields
- >;
- arrayString?: Resolver<
- Array,
- ParentType,
- ContextType
- >;
- arrayObjectArgs?: Resolver<
- Array,
- ParentType,
- ContextType,
- RequireFields
- >;
- greetings?: Resolver<
- ResolversTypes['GreetingsEnum'],
- ParentType,
- ContextType
- >;
- giveGreetingsInput?: Resolver<
- ResolversTypes['String'],
- ParentType,
- ContextType,
- RequireFields
- >;
- number?: Resolver;
- union?: Resolver, ParentType, ContextType>;
-};
-
-export type MutationResolvers<
- ContextType = EZContext,
- ParentType extends ResolversParentTypes['Mutation'] = ResolversParentTypes['Mutation']
-> = {
- increment?: Resolver<
- ResolversTypes['Int'],
- ParentType,
- ContextType,
- RequireFields
- >;
-};
-
-export type HumanResolvers<
- ContextType = EZContext,
- ParentType extends ResolversParentTypes['Human'] = ResolversParentTypes['Human']
-> = {
- name?: Resolver;
- father?: Resolver;
- fieldWithArgs?: Resolver<
- ResolversTypes['Int'],
- ParentType,
- ContextType,
- RequireFields
- >;
- sons?: Resolver<
- Maybe>,
- ParentType,
- ContextType
- >;
- union?: Resolver, ParentType, ContextType>;
- args?: Resolver<
- Maybe,
- ParentType,
- ContextType,
- Partial
- >;
- __isTypeOf?: IsTypeOfResolverFn;
-};
-
-export type DogResolvers<
- ContextType = EZContext,
- ParentType extends ResolversParentTypes['Dog'] = ResolversParentTypes['Dog']
-> = {
- name?: Resolver;
- owner?: Resolver;
- __isTypeOf?: IsTypeOfResolverFn;
-};
-
-export type AResolvers<
- ContextType = EZContext,
- ParentType extends ResolversParentTypes['A'] = ResolversParentTypes['A']
-> = {
- a?: Resolver;
- common?: Resolver<
- Maybe,
- ParentType,
- ContextType,
- Partial
- >;
- z?: Resolver, ParentType, ContextType>;
- __isTypeOf?: IsTypeOfResolverFn;
-};
-
-export type BResolvers<
- ContextType = EZContext,
- ParentType extends ResolversParentTypes['B'] = ResolversParentTypes['B']
-> = {
- b?: Resolver;
- common?: Resolver<
- Maybe,
- ParentType,
- ContextType,
- Partial
- >;
- z?: Resolver, ParentType, ContextType>;
- __isTypeOf?: IsTypeOfResolverFn;
-};
-
-export type CResolvers<
- ContextType = EZContext,
- ParentType extends ResolversParentTypes['C'] = ResolversParentTypes['C']
-> = {
- c?: Resolver;
- z?: Resolver, ParentType, ContextType>;
- __isTypeOf?: IsTypeOfResolverFn;
-};
-
-export type TestUnionResolvers<
- ContextType = EZContext,
- ParentType extends ResolversParentTypes['TestUnion'] = ResolversParentTypes['TestUnion']
-> = {
- __resolveType: TypeResolveFn<'A' | 'B' | 'C', ParentType, ContextType>;
-};
-
-export type Resolvers = {
- NamedEntity?: NamedEntityResolvers;
- ExampleScalar?: GraphQLScalarType;
- Query?: QueryResolvers;
- Mutation?: MutationResolvers;
- Human?: HumanResolvers;
- Dog?: DogResolvers;
- A?: AResolvers;
- B?: BResolvers;
- C?: CResolvers;
- TestUnion?: TestUnionResolvers;
-};
-
-export type SimpleStringQueryVariables = Exact<{ [key: string]: never }>;
-
-export type SimpleStringQuery = {
- __typename?: 'Query';
- simpleString: string;
- union: Array<
- | { __typename: 'A'; a: string }
- | { __typename: 'B'; b: number }
- | { __typename: 'C'; c: GreetingsEnum }
- >;
-};
-
-export type ArrayObjectArgsQueryVariables = Exact<{ [key: string]: never }>;
-
-export type ArrayObjectArgsQuery = {
- __typename?: 'Query';
- arrayObjectArgs: Array<{
- __typename?: 'Human';
- name: string;
- father: {
- __typename?: 'Human';
- name: string;
- father: { __typename?: 'Human'; name: string };
- };
- }>;
-};
-
-export type MultipleArgsQueryVariables = Exact<{ [key: string]: never }>;
-
-export type MultipleArgsQuery = {
- __typename?: 'Query';
- a1: { __typename?: 'Human'; zxc: string; abc: string };
- a2: { __typename?: 'Human'; name: string };
-};
-
-export const SimpleStringDocument = {
- kind: 'Document',
- definitions: [
- {
- kind: 'OperationDefinition',
- operation: 'query',
- name: { kind: 'Name', value: 'simpleString' },
- selectionSet: {
- kind: 'SelectionSet',
- selections: [
- { kind: 'Field', name: { kind: 'Name', value: 'simpleString' } },
- {
- kind: 'Field',
- name: { kind: 'Name', value: 'union' },
- selectionSet: {
- kind: 'SelectionSet',
- selections: [
- { kind: 'Field', name: { kind: 'Name', value: '__typename' } },
- {
- kind: 'InlineFragment',
- typeCondition: {
- kind: 'NamedType',
- name: { kind: 'Name', value: 'A' },
- },
- selectionSet: {
- kind: 'SelectionSet',
- selections: [
- { kind: 'Field', name: { kind: 'Name', value: 'a' } },
- ],
- },
- },
- {
- kind: 'InlineFragment',
- typeCondition: {
- kind: 'NamedType',
- name: { kind: 'Name', value: 'B' },
- },
- selectionSet: {
- kind: 'SelectionSet',
- selections: [
- { kind: 'Field', name: { kind: 'Name', value: 'b' } },
- ],
- },
- },
- {
- kind: 'InlineFragment',
- typeCondition: {
- kind: 'NamedType',
- name: { kind: 'Name', value: 'C' },
- },
- selectionSet: {
- kind: 'SelectionSet',
- selections: [
- { kind: 'Field', name: { kind: 'Name', value: 'c' } },
- ],
- },
- },
- ],
- },
- },
- ],
- },
- },
- ],
-} as unknown as DocumentNode;
-export const ArrayObjectArgsDocument = {
- kind: 'Document',
- definitions: [
- {
- kind: 'OperationDefinition',
- operation: 'query',
- name: { kind: 'Name', value: 'arrayObjectArgs' },
- selectionSet: {
- kind: 'SelectionSet',
- selections: [
- {
- kind: 'Field',
- name: { kind: 'Name', value: 'arrayObjectArgs' },
- arguments: [
- {
- kind: 'Argument',
- name: { kind: 'Name', value: 'limit' },
- value: { kind: 'IntValue', value: '2' },
- },
- ],
- selectionSet: {
- kind: 'SelectionSet',
- selections: [
- { kind: 'Field', name: { kind: 'Name', value: 'name' } },
- {
- kind: 'Field',
- name: { kind: 'Name', value: 'father' },
- selectionSet: {
- kind: 'SelectionSet',
- selections: [
- { kind: 'Field', name: { kind: 'Name', value: 'name' } },
- {
- kind: 'Field',
- name: { kind: 'Name', value: 'father' },
- selectionSet: {
- kind: 'SelectionSet',
- selections: [
- {
- kind: 'Field',
- name: { kind: 'Name', value: 'name' },
- },
- ],
- },
- },
- ],
- },
- },
- ],
- },
- },
- ],
- },
- },
- ],
-} as unknown as DocumentNode<
- ArrayObjectArgsQuery,
- ArrayObjectArgsQueryVariables
->;
-export const MultipleArgsDocument = {
- kind: 'Document',
- definitions: [
- {
- kind: 'OperationDefinition',
- operation: 'query',
- name: { kind: 'Name', value: 'multipleArgs' },
- selectionSet: {
- kind: 'SelectionSet',
- selections: [
- {
- kind: 'Field',
- alias: { kind: 'Name', value: 'a1' },
- name: { kind: 'Name', value: 'objectWithArgs' },
- arguments: [
- {
- kind: 'Argument',
- name: { kind: 'Name', value: 'who' },
- value: { kind: 'StringValue', value: 'hello', block: false },
- },
- ],
- selectionSet: {
- kind: 'SelectionSet',
- selections: [
- {
- kind: 'Field',
- alias: { kind: 'Name', value: 'zxc' },
- name: { kind: 'Name', value: 'name' },
- },
- {
- kind: 'Field',
- alias: { kind: 'Name', value: 'abc' },
- name: { kind: 'Name', value: 'name' },
- },
- ],
- },
- },
- {
- kind: 'Field',
- alias: { kind: 'Name', value: 'a2' },
- name: { kind: 'Name', value: 'objectWithArgs' },
- arguments: [
- {
- kind: 'Argument',
- name: { kind: 'Name', value: 'who' },
- value: { kind: 'StringValue', value: 'hello2', block: false },
- },
- ],
- selectionSet: {
- kind: 'SelectionSet',
- selections: [
- { kind: 'Field', name: { kind: 'Name', value: 'name' } },
- ],
- },
- },
- ],
- },
- },
- ],
-} as unknown as DocumentNode;
-
-declare module 'graphql-ez' {
- interface EZResolvers extends Resolvers {}
-}
diff --git a/examples/ez/src/generated/gqty.ts b/examples/ez/src/generated/gqty.ts
deleted file mode 100644
index ac036b71c..000000000
--- a/examples/ez/src/generated/gqty.ts
+++ /dev/null
@@ -1,50 +0,0 @@
-import { createClient, QueryFetcher } from 'gqty';
-
-import { ezApp } from '..';
-import {
- GeneratedSchema,
- generatedSchema,
- scalarsEnumsHash,
- SchemaObjectTypes,
- SchemaObjectTypesNames,
-} from './schema.generated';
-
-import { CreateTestClient } from '@graphql-ez/fastify-testing';
-
-const testClientPromise = CreateTestClient(ezApp);
-const queryFetcher: QueryFetcher = async function (query, variables) {
- const testClient = await testClientPromise;
-
- return testClient.query(query, {
- variables,
- });
-};
-
-export const client = createClient<
- GeneratedSchema,
- SchemaObjectTypesNames,
- SchemaObjectTypes
->({
- schema: generatedSchema,
- scalarsEnumsHash,
- queryFetcher,
- normalization: {
- identifier(obj) {
- switch (obj.__typename) {
- case 'A': {
- return obj.a;
- }
- default: {
- return;
- }
- }
- },
- keyFields: {},
- },
-});
-
-const { query, mutation, mutate, subscription, resolved, refetch } = client;
-
-export { query, mutation, mutate, subscription, resolved, refetch };
-
-export * from './schema.generated';
diff --git a/examples/ez/src/generated/schema.generated.ts b/examples/ez/src/generated/schema.generated.ts
deleted file mode 100644
index 769d2f8fc..000000000
--- a/examples/ez/src/generated/schema.generated.ts
+++ /dev/null
@@ -1,258 +0,0 @@
-/**
- * GQTY AUTO-GENERATED CODE: PLEASE DO NOT MODIFY MANUALLY
- */
-
-import { SchemaUnionsKey } from 'gqty';
-
-export type Maybe = T | null;
-export type InputMaybe = Maybe;
-export type Exact = {
- [K in keyof T]: T[K];
-};
-export type MakeOptional = Omit & {
- [SubKey in K]?: Maybe;
-};
-export type MakeMaybe = Omit & {
- [SubKey in K]: Maybe;
-};
-/** All built-in and custom scalars, mapped to their actual values */
-export interface Scalars {
- ID: string;
- String: string;
- Boolean: boolean;
- Int: number;
- Float: number;
- ExampleScalar: string;
-}
-
-export enum GreetingsEnum {
- Hello = 'Hello',
- Hey = 'Hey',
- Hi = 'Hi',
-}
-
-export interface GreetingsInput {
- language: Scalars['String'];
- scal?: InputMaybe;
- value?: InputMaybe;
-}
-
-export const scalarsEnumsHash: import('gqty').ScalarsEnumsHash = {
- Boolean: true,
- ExampleScalar: true,
- GreetingsEnum: true,
- Int: true,
- String: true,
-};
-export const generatedSchema = {
- A: {
- __typename: { __type: 'String!' },
- a: { __type: 'String!' },
- common: { __type: 'Int', __args: { a: 'String' } },
- z: { __type: 'String' },
- },
- B: {
- __typename: { __type: 'String!' },
- b: { __type: 'Int!' },
- common: { __type: 'String', __args: { b: 'Int' } },
- z: { __type: 'String' },
- },
- C: {
- __typename: { __type: 'String!' },
- c: { __type: 'GreetingsEnum!' },
- z: { __type: 'String' },
- },
- Dog: {
- __typename: { __type: 'String!' },
- name: { __type: 'String!' },
- owner: { __type: 'Human!' },
- },
- GreetingsInput: {
- language: { __type: 'String!' },
- scal: { __type: 'ExampleScalar' },
- value: { __type: 'String' },
- },
- Human: {
- __typename: { __type: 'String!' },
- args: { __type: 'Int', __args: { a: 'String' } },
- father: { __type: 'Human!' },
- fieldWithArgs: { __type: 'Int!', __args: { id: 'Int!' } },
- name: { __type: 'String!' },
- sons: { __type: '[Human!]' },
- union: { __type: '[TestUnion!]!' },
- },
- NamedEntity: {
- __typename: { __type: 'String!' },
- name: { __type: 'String!' },
- $on: { __type: '$NamedEntity!' },
- },
- TestUnion: {
- __typename: { __type: 'String!' },
- $on: { __type: '$TestUnion!' },
- },
- mutation: {
- __typename: { __type: 'String!' },
- increment: { __type: 'Int!', __args: { n: 'Int!' } },
- },
- query: {
- __typename: { __type: 'String!' },
- arrayObjectArgs: { __type: '[Human!]!', __args: { limit: 'Int!' } },
- arrayString: { __type: '[String!]!' },
- giveGreetingsInput: {
- __type: 'String!',
- __args: { input: 'GreetingsInput!' },
- },
- greetings: { __type: 'GreetingsEnum!' },
- number: { __type: 'Int!' },
- object: { __type: 'Human' },
- objectArray: { __type: '[Human]' },
- objectWithArgs: { __type: 'Human!', __args: { who: 'String!' } },
- simpleString: { __type: 'String!' },
- stringNullableWithArgs: {
- __type: 'String',
- __args: { hello: 'String!', helloTwo: 'String' },
- },
- stringNullableWithArgsArray: {
- __type: 'String',
- __args: { hello: '[String]!' },
- },
- stringWithArgs: { __type: 'String!', __args: { hello: 'String!' } },
- union: { __type: '[TestUnion!]!' },
- },
- subscription: {},
- [SchemaUnionsKey]: {
- NamedEntity: ['Dog', 'Human'],
- TestUnion: ['A', 'B', 'C'],
- },
-} as const;
-
-export interface A {
- __typename?: 'A';
- a: ScalarsEnums['String'];
- common: (args?: {
- a?: Maybe;
- }) => Maybe;
- z?: Maybe;
-}
-
-export interface B {
- __typename?: 'B';
- b: ScalarsEnums['Int'];
- common: (args?: {
- b?: Maybe;
- }) => Maybe;
- z?: Maybe;
-}
-
-export interface C {
- __typename?: 'C';
- c: ScalarsEnums['GreetingsEnum'];
- z?: Maybe;
-}
-
-export interface Dog {
- __typename?: 'Dog';
- name: ScalarsEnums['String'];
- owner: Human;
-}
-
-export interface Human {
- __typename?: 'Human';
- args: (args?: { a?: Maybe }) => Maybe;
- father: Human;
- fieldWithArgs: (args: { id: Scalars['Int'] }) => ScalarsEnums['Int'];
- name: ScalarsEnums['String'];
- sons?: Maybe>;
- union: Array;
-}
-
-export interface NamedEntity {
- __typename?: 'Dog' | 'Human';
- name: ScalarsEnums['String'];
- $on: $NamedEntity;
-}
-
-export interface TestUnion {
- __typename?: 'A' | 'B' | 'C';
- $on: $TestUnion;
-}
-
-export interface Mutation {
- __typename?: 'Mutation';
- increment: (args: { n: Scalars['Int'] }) => ScalarsEnums['Int'];
-}
-
-export interface Query {
- __typename?: 'Query';
- arrayObjectArgs: (args: { limit: Scalars['Int'] }) => Array;
- arrayString: Array;
- giveGreetingsInput: (args: {
- input: GreetingsInput;
- }) => ScalarsEnums['String'];
- greetings: ScalarsEnums['GreetingsEnum'];
- number: ScalarsEnums['Int'];
- object?: Maybe;
- objectArray?: Maybe>>;
- objectWithArgs: (args: { who: Scalars['String'] }) => Human;
- simpleString: ScalarsEnums['String'];
- stringNullableWithArgs: (args: {
- hello: Scalars['String'];
- helloTwo?: Maybe;
- }) => Maybe;
- stringNullableWithArgsArray: (args: {
- hello: Array>;
- }) => Maybe;
- stringWithArgs: (args: {
- hello: Scalars['String'];
- }) => ScalarsEnums['String'];
- union: Array;
-}
-
-export interface Subscription {
- __typename?: 'Subscription';
-}
-
-export interface SchemaObjectTypes {
- A: A;
- B: B;
- C: C;
- Dog: Dog;
- Human: Human;
- Mutation: Mutation;
- Query: Query;
- Subscription: Subscription;
-}
-export type SchemaObjectTypesNames =
- | 'A'
- | 'B'
- | 'C'
- | 'Dog'
- | 'Human'
- | 'Mutation'
- | 'Query'
- | 'Subscription';
-
-export interface $NamedEntity {
- Dog?: Dog;
- Human?: Human;
-}
-
-export interface $TestUnion {
- A?: A;
- B?: B;
- C?: C;
-}
-
-export interface GeneratedSchema {
- query: Query;
- mutation: Mutation;
- subscription: Subscription;
-}
-
-export type MakeNullable = {
- [K in keyof T]: T[K] | undefined;
-};
-
-export interface ScalarsEnums extends MakeNullable {
- GreetingsEnum: GreetingsEnum | undefined;
-}
diff --git a/examples/ez/src/graphql/operations.gql b/examples/ez/src/graphql/operations.gql
deleted file mode 100644
index 06d4b7635..000000000
--- a/examples/ez/src/graphql/operations.gql
+++ /dev/null
@@ -1,37 +0,0 @@
-query simpleString {
- simpleString
- union {
- __typename
- ... on A {
- a
- }
- ... on B {
- b
- }
- ... on C {
- c
- }
- }
-}
-
-query arrayObjectArgs {
- arrayObjectArgs(limit: 2) {
- name
- father {
- name
- father {
- name
- }
- }
- }
-}
-
-query multipleArgs {
- a1: objectWithArgs(who: "hello") {
- zxc: name
- abc: name
- }
- a2: objectWithArgs(who: "hello2") {
- name
- }
-}
diff --git a/examples/ez/src/index.ts b/examples/ez/src/index.ts
deleted file mode 100644
index b034a5afd..000000000
--- a/examples/ez/src/index.ts
+++ /dev/null
@@ -1,187 +0,0 @@
-import { useGenerateGQty } from '@gqty/cli/envelop';
-import { CreateApp } from '@graphql-ez/fastify';
-import { ezAltairIDE } from '@graphql-ez/plugin-altair/static';
-import { ezCodegen } from '@graphql-ez/plugin-codegen';
-import { ezSchema } from '@graphql-ez/plugin-schema';
-import Fastify, { LogLevel } from 'fastify';
-import { random, range } from 'lodash';
-import { generate } from 'randomstring';
-import { gql } from 'test-utils';
-import { GreetingsEnum, Human, TestUnion } from './ez.generated';
-
-export const app = Fastify({
- logger: {
- level: 'warn' as LogLevel,
- },
-});
-
-const getUnion = (): TestUnion[] => [
- {
- a: 'asd',
- },
- {
- b: 123,
- },
- {
- c: GreetingsEnum.Hey,
- },
-];
-
-export const newHuman = ({ name }: { name?: string } = {}): Partial => {
- return {
- name: name || generate(),
- union: getUnion(),
- };
-};
-
-export const ezApp = CreateApp({
- ez: {
- plugins: [
- ezCodegen({
- outputSchema: true,
- config: {
- documents: 'src/graphql/operations.gql',
- },
- enableCodegen: true,
- }),
- ezSchema(),
- ezAltairIDE(),
- ],
- },
- envelop: {
- plugins: [useGenerateGQty()],
- },
- prepare({ registerTypeDefs, registerResolvers }) {
- let inc = 0;
- registerTypeDefs(gql`
- interface NamedEntity {
- name: String!
- }
- scalar ExampleScalar
-
- enum GreetingsEnum {
- Hello
- Hi
- Hey
- }
- input GreetingsInput {
- language: String!
- value: String
- scal: ExampleScalar
- }
- type Query {
- simpleString: String!
- stringWithArgs(hello: String!): String!
- stringNullableWithArgs(hello: String!, helloTwo: String): String
- stringNullableWithArgsArray(hello: [String]!): String
- object: Human
- objectArray: [Human]
- objectWithArgs(who: String!): Human!
- arrayString: [String!]!
- arrayObjectArgs(limit: Int!): [Human!]!
- greetings: GreetingsEnum!
- giveGreetingsInput(input: GreetingsInput!): String!
- number: Int!
- union: [TestUnion!]!
- }
- type Mutation {
- increment(n: Int!): Int!
- }
- type Human implements NamedEntity {
- name: String!
- father: Human!
- fieldWithArgs(id: Int!): Int!
- sons: [Human!]
- union: [TestUnion!]!
- args(a: String): Int
- }
- type Dog implements NamedEntity {
- name: String!
- owner: Human!
- }
- type A {
- a: String!
- common(a: String): Int
- z: String
- }
- type B {
- b: Int!
- common(b: Int): String
- z: String
- }
- type C {
- c: GreetingsEnum!
- z: String
- }
- union TestUnion = A | B | C
- `);
- registerResolvers({
- Query: {
- simpleString() {
- return generate();
- },
- stringWithArgs(_root, { hello }) {
- return hello;
- },
- object() {
- return newHuman();
- },
- objectArray() {
- return range(random(2, 3)).map(() => newHuman());
- },
- objectWithArgs(_root, { who }) {
- return newHuman({ name: who });
- },
- arrayString() {
- return range(random(1, 2)).map(() => generate());
- },
- arrayObjectArgs(_root, { limit }) {
- return range(limit).map(() => newHuman());
- },
- giveGreetingsInput(_root, { input }) {
- return input.language;
- },
- greetings() {
- return GreetingsEnum.Hello;
- },
- stringNullableWithArgs(_root, { hello, helloTwo }) {
- return hello || helloTwo;
- },
- stringNullableWithArgsArray(_root, { hello }) {
- return hello[0];
- },
- number() {
- return inc;
- },
- union() {
- return getUnion();
- },
- },
- Mutation: {
- increment(_root, { n }) {
- return (inc += n);
- },
- },
- Human: {
- father() {
- return newHuman();
- },
- fieldWithArgs(_root, { id }) {
- return id;
- },
- sons() {
- return range(random(2, 3)).map(() => newHuman());
- },
- },
- TestUnion: {
- __resolveType(obj) {
- if ('a' in obj) return 'A';
- if ('b' in obj) return 'B';
- return 'C';
- },
- },
- });
- },
-});
-
-app.register(ezApp.buildApp().fastifyPlugin);
diff --git a/examples/ez/test/example.test.ts b/examples/ez/test/example.test.ts
deleted file mode 100644
index fd34cbd3f..000000000
--- a/examples/ez/test/example.test.ts
+++ /dev/null
@@ -1,340 +0,0 @@
-import { waitForExpect } from 'test-utils';
-
-import { selectFields } from 'gqty';
-
-import {
- client as generatedClient,
- GreetingsEnum,
- mutation,
- query,
- resolved,
-} from '../src/generated/gqty';
-import {
- ArrayObjectArgsDocument,
- MultipleArgsDocument,
- SimpleStringDocument,
-} from '../src/ez.generated';
-
-import { CreateTestClient, GlobalTeardown } from '@graphql-ez/fastify-testing';
-import { ezApp } from '../src';
-
-const testClientPromise = CreateTestClient(ezApp);
-
-afterAll(GlobalTeardown);
-
-test('works', async () => {
- const testClient = await testClientPromise;
-
- await testClient.query(SimpleStringDocument).then((response) => {
- expect(typeof response.data?.simpleString).toBe('string');
- });
-
- await testClient.query(ArrayObjectArgsDocument).then((resp) => {
- expect(resp.errors).toBe(undefined);
- });
-});
-
-test('multiple args', async () => {
- const testClient = await testClientPromise;
-
- const response = await testClient.query(MultipleArgsDocument);
-
- expect(response).toEqual({
- data: {
- a1: {
- zxc: 'hello',
- abc: 'hello',
- },
- a2: {
- name: 'hello2',
- },
- },
- });
-});
-
-describe('gqty integration tests', () => {
- test('generatedClient', async () => {
- const anon = generatedClient.query.objectWithArgs({
- who: 'anon',
- });
-
- const { name, fatherName } = await resolved(() => {
- return {
- name: anon.name,
- fatherName: anon.father.father.name,
- };
- });
-
- expect(typeof name).toBe('string');
-
- expect(typeof fatherName).toBe('string');
-
- expect(typeof anon.name).toBe('string');
-
- expect(typeof anon.father.father.name).toBe('string');
-
- const arrayDataAfterResolved = await resolved(() => {
- return generatedClient.query.objectArray?.map((v) => v?.name);
- });
-
- expect((arrayDataAfterResolved?.length ?? 0) > 0).toBeTruthy();
-
- expect(
- arrayDataAfterResolved?.every(
- (v) => typeof v === 'string' && v.length > 30
- )
- ).toBeTruthy();
- });
-
- test('args', async () => {
- const name = await resolved(() => {
- return generatedClient.query.objectWithArgs({
- who: 'asd',
- }).name;
- });
-
- expect(name).toBe('asd');
- });
-
- test('refetch works', async () => {
- const firstHumanName = await resolved(() => {
- return generatedClient.query.object?.name;
- });
-
- expect((firstHumanName?.length ?? 0) > 20).toBeTruthy();
-
- const secondHumanName = await resolved(
- () => {
- return generatedClient.query.object?.name;
- },
- {
- refetch: true,
- }
- );
-
- expect((secondHumanName?.length ?? 0) > 20).toBeTruthy();
-
- expect(firstHumanName !== secondHumanName).toBeTruthy();
- });
-
- test('scheduler', async () => {
- const hello = 'zxczxc';
- const shouldBeUndefined = generatedClient.query.stringWithArgs({
- hello,
- });
-
- expect(shouldBeUndefined).toBe(undefined);
-
- waitForExpect(() => {
- const shouldBeString = generatedClient.query.stringWithArgs({
- hello,
- });
-
- expect(shouldBeString).toBe(hello);
- });
- });
-
- test('resolved no cache', async () => {
- const hello = 'asdasd';
- const helloQueryString = await resolved(
- () => {
- return generatedClient.query.stringWithArgs({
- hello,
- });
- },
- {
- noCache: true,
- }
- );
-
- expect(helloQueryString).toBe(hello);
-
- const shouldBeUndefined = generatedClient.query.stringWithArgs({
- hello,
- });
-
- expect(shouldBeUndefined).toBe(undefined);
- });
-
- test('arrays', async () => {
- const result = await resolved(() => {
- return generatedClient.query.arrayString;
- });
-
- expect(result.length).toBeGreaterThanOrEqual(1);
-
- expect(
- result.every((v) => {
- expect(v!.length).toBeGreaterThan(10);
- expect(typeof v).toBe('string');
- })
- );
- });
-
- test('input type', async () => {
- const result = await resolved(() => {
- return generatedClient.query.giveGreetingsInput({
- input: {
- language: 'spanish',
- },
- });
- });
-
- expect(result).toBe('spanish');
- });
-
- test('enum', async () => {
- const result = await resolved(() => {
- return generatedClient.query.greetings;
- });
-
- expect(Object.values(GreetingsEnum).includes(result!)).toBeTruthy();
- });
-
- test('nullable', async () => {
- const resultA = await resolved(() => {
- return generatedClient.query.stringNullableWithArgs({
- hello: 'a',
- });
- });
-
- expect(resultA).toBe('a');
-
- const resultB = await resolved(() => {
- return generatedClient.query.stringNullableWithArgs({
- hello: '',
- helloTwo: 'b',
- });
- });
-
- expect(resultB).toBe('b');
- });
-
- test('args array', async () => {
- const resultA = await resolved(() => {
- return generatedClient.query.stringNullableWithArgsArray({
- hello: ['a', 'b', 'c'],
- });
- });
-
- expect(resultA).toBe('a');
-
- const resultEmpty = await resolved(() => {
- return generatedClient.query.stringNullableWithArgsArray({
- hello: [],
- });
- });
-
- expect(resultEmpty).toBe(null);
- });
-
- test('type field with args', async () => {
- const result = await resolved(() => {
- return generatedClient.query.object?.fieldWithArgs({
- id: 123,
- });
- });
-
- expect(result).toBe(123);
- });
-
- describe('mutation', () => {
- test('mutation works', async () => {
- await resolved(() => {
- return mutation.increment({
- n: 1,
- });
- }).then((n) => {
- expect(n).toBe(1);
- });
-
- await resolved(
- () => {
- return mutation.increment({
- n: 2,
- });
- },
- {
- refetch: true,
- }
- ).then((n) => {
- expect(n).toBe(3);
- });
-
- const n = mutation.increment({
- n: 2,
- });
-
- expect(n).toBe(3);
-
- await resolved(() => {
- return query.number;
- }).then((n) => {
- expect(n).toBe(3);
- });
- });
- });
-});
-
-describe('select fields', () => {
- test('selectFields recursive', async () => {
- await resolved(
- () => {
- const one = selectFields(query, '*', 1);
- const two = selectFields(query, '*', 2);
- const three = selectFields(query, '*', 3);
-
- return {
- one,
- two,
- three,
- };
- },
- {
- refetch: true,
- }
- ).then((response) => {
- expect(typeof response.one?.arrayObjectArgs).toBe('function');
- expect(response.one?.objectArray?.length).toBeGreaterThanOrEqual(2);
- expect(typeof response.two?.object?.name).toBe('string');
- });
- });
-
- test('selectFields an array', async () => {
- await resolved(
- () => {
- return selectFields(query.objectArray, '*', 2);
- },
- {
- noCache: true,
- }
- ).then((response) => {
- expect(typeof response?.[0]?.name).toBe('string');
- expect(typeof response?.[0]?.father.name).toBe('string');
- });
- });
-
- test('selectFields named', async () => {
- await resolved(
- () => {
- return selectFields(query.object, [
- 'name',
- 'father.name',
- 'sons.0.name',
- 'fieldWithArgs',
- 'sons',
- ]);
- },
- {
- noCache: true,
- }
- ).then((response) => {
- expect(typeof response?.name).toBe('string');
- expect(typeof response?.father?.name).toBe('string');
- expect(typeof response?.fieldWithArgs).toBe('function');
- expect(response?.sons?.length).toBeGreaterThanOrEqual(2);
- expect(typeof response?.sons?.[0]?.name).toBe('string');
- expect(typeof response?.sons?.[1]?.name).toBe('string');
- });
- });
-});
diff --git a/examples/ez/test/tsconfig.json b/examples/ez/test/tsconfig.json
deleted file mode 100644
index 18fd4c7a2..000000000
--- a/examples/ez/test/tsconfig.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "extends": "../tsconfig.json",
- "include": ["example.test.ts"],
- "exclude": []
-}
diff --git a/examples/ez/tsconfig.json b/examples/ez/tsconfig.json
deleted file mode 100644
index 980738209..000000000
--- a/examples/ez/tsconfig.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "extends": "../../tsconfig.json",
- "include": ["**/*.ts"]
-}
diff --git a/examples/github/gqty.config.cjs b/examples/github/gqty.config.cjs
deleted file mode 100644
index 46966f971..000000000
--- a/examples/github/gqty.config.cjs
+++ /dev/null
@@ -1,32 +0,0 @@
-require('dotenv').config();
-
-/**
- * @type {import("@gqty/cli").GQtyConfig}
- */
-const config = {
- enumsAsStrings: false,
- react: false,
- scalarTypes: {
- DateTime: 'string',
- Date: 'string',
- GitObjectID: 'string',
- GitSSHRemote: 'string',
- GitTimestamp: 'string',
- HTML: 'string',
- PreciseDateTime: 'string',
- URI: 'string',
- X509Certificate: 'string',
- },
- preImport: '',
- introspection: {
- endpoint: 'https://api.github.com/graphql',
- headers: {
- authorization: `bearer ${process.env.GITHUB_TOKEN}`,
- },
- },
- destination: './src/gqty/index.ts',
- subscriptions: false,
- javascriptOutput: false,
-};
-
-module.exports = config;
diff --git a/examples/github/jest.config.js b/examples/github/jest.config.js
deleted file mode 100644
index 6e155aacb..000000000
--- a/examples/github/jest.config.js
+++ /dev/null
@@ -1 +0,0 @@
-module.exports = require('test-utils/jest.config.js').default;
diff --git a/examples/github/package.json b/examples/github/package.json
deleted file mode 100644
index 70d099ebc..000000000
--- a/examples/github/package.json
+++ /dev/null
@@ -1,25 +0,0 @@
-{
- "name": "example-github",
- "version": "1.0.0",
- "private": true,
- "description": "",
- "license": "MIT",
- "author": "PabloSzx ",
- "scripts": {
- "generate": "gqty generate",
- "test:manual": "jest -u"
- },
- "dependencies": {
- "@gqty/cli": "workspace:^3.3.0",
- "dotenv": "^16.0.3",
- "gqty": "workspace:^2.3.0",
- "test-utils": "workspace:^0.1.0"
- },
- "devDependencies": {
- "@types/node": "^18.15.5",
- "esbuild": "^0.17.12",
- "isomorphic-unfetch": "^4.0.2",
- "jest": "^29.5.0",
- "typescript": "^4.9.5"
- }
-}
diff --git a/examples/github/src/gqty/index.ts b/examples/github/src/gqty/index.ts
deleted file mode 100644
index 940913bda..000000000
--- a/examples/github/src/gqty/index.ts
+++ /dev/null
@@ -1,58 +0,0 @@
-/**
- * GQTY: You can safely modify this file and Query Fetcher based on your needs
- */
-
-import 'isomorphic-unfetch';
-import 'dotenv/config';
-
-import { createClient, QueryFetcher } from 'gqty';
-
-import {
- generatedSchema,
- GeneratedSchema,
- scalarsEnumsHash,
- SchemaObjectTypes,
- SchemaObjectTypesNames,
-} from './schema.generated';
-
-if (!process.env.GITHUB_TOKEN) {
- console.error(
- 'You have to create a .env file with a Github Personal Access token, like this: \nGITHUB_TOKEN=your_token_here'
- );
- process.exit(1);
-}
-
-const queryFetcher: QueryFetcher = async function (query, variables) {
- const response = await fetch('https://api.github.com/graphql', {
- method: 'POST',
- headers: {
- 'Content-Type': 'application/json',
- authorization: `bearer ${process.env.GITHUB_TOKEN}`,
- },
- body: JSON.stringify({
- query,
- variables,
- }),
- mode: 'cors',
- });
-
- const json = await response.json();
-
- return json;
-};
-
-export const client = createClient<
- GeneratedSchema,
- SchemaObjectTypesNames,
- SchemaObjectTypes
->({
- schema: generatedSchema,
- scalarsEnumsHash,
- queryFetcher,
-});
-
-const { query, mutation, mutate, subscription, resolved, refetch } = client;
-
-export { query, mutation, mutate, subscription, resolved, refetch };
-
-export * from './schema.generated';
diff --git a/examples/github/src/gqty/schema.generated.ts b/examples/github/src/gqty/schema.generated.ts
deleted file mode 100644
index d927e7358..000000000
--- a/examples/github/src/gqty/schema.generated.ts
+++ /dev/null
@@ -1,52993 +0,0 @@
-/**
- * GQTY AUTO-GENERATED CODE: PLEASE DO NOT MODIFY MANUALLY
- */
-
-import { SchemaUnionsKey } from 'gqty';
-
-export type Maybe = T | null;
-export type InputMaybe = Maybe;
-export type Exact = {
- [K in keyof T]: T[K];
-};
-export type MakeOptional = Omit & {
- [SubKey in K]?: Maybe;
-};
-export type MakeMaybe = Omit & {
- [SubKey in K]: Maybe;
-};
-/** All built-in and custom scalars, mapped to their actual values */
-export interface Scalars {
- ID: string;
- String: string;
- Boolean: boolean;
- Int: number;
- Float: number;
- /** A (potentially binary) string encoded using base64. */
- Base64String: any;
- /** An ISO-8601 encoded date string. */
- Date: string;
- /** An ISO-8601 encoded UTC date string. */
- DateTime: string;
- /** A Git object ID. */
- GitObjectID: string;
- /** Git SSH string */
- GitSSHRemote: string;
- /** An ISO-8601 encoded date string. Unlike the DateTime type, GitTimestamp is not converted in UTC. */
- GitTimestamp: string;
- /** A string containing HTML code. */
- HTML: string;
- /** An ISO-8601 encoded UTC date string with millisecond precision. */
- PreciseDateTime: string;
- /** An RFC 3986, RFC 3987, and RFC 6570 (level 4) compliant URI string. */
- URI: string;
- /** A valid x509 certificate string */
- X509Certificate: string;
-}
-
-/** Autogenerated input type of AcceptEnterpriseAdministratorInvitation */
-export interface AcceptEnterpriseAdministratorInvitationInput {
- /** A unique identifier for the client performing the mutation. */
- clientMutationId?: InputMaybe;
- /** The id of the invitation being accepted */
- invitationId: Scalars['ID'];
-}
-
-/** Autogenerated input type of AcceptTopicSuggestion */
-export interface AcceptTopicSuggestionInput {
- /** A unique identifier for the client performing the mutation. */
- clientMutationId?: InputMaybe