Skip to content

Commit a758ed1

Browse files
authored
feat: Scoped Queries (#1544)
* feat(package/core): scoped query * feat(package/subscriptions): drop the package for graphql-ws * feat(packages/utils): drop unused package * fix(packages/logger): scoped query shim * feat: refactor resolvers for react * chore: error message * feat(packages/react): new core shim * fix: facebook/react#26230 * fix: generated subscription client * feat(packages/gqty): compat with queryFetcher and subsscriptionsClient * chore(compat): queryFetcher and subscriptionsClient * fix(package/react): infinite render loop * feat(package/gqty): separate Cache instantiation from client * chore(package/gqty): compat and optimized normalization * fix(package/react): react hooks * chore(deps): upgrade multidict * feat(package/gqty): rename fetchPolicy to cachePolicy * feat(package/gqty): add reload in cachePolicy * fix(package/react): consistent API * feat(package/react): Added onComplete for useMutation * feat(packages/cli): interactive mode * feat(examples): added the gnt example * fix(package/react): missing fetches in useQuery * fix(package/react): incorrect suspense in usePrepared * feat(package/cli): rename introspectionOptions to introspections * fix(deps): upgrade faulty multidict * fix(ci): use esm imports * fix(packages/gqty): compat, cache option should be optional. * fix(ci): dlx errors * feat(package/gqty): batching with microtask * chore(package/cli): refactor generated client * chore: remove legacy website * feat(package/gqty): passthru return types of selectors * chore(deps): upgrade testing-library for React 18 * fix(examples/vite): compatibility with v3 * chore(package/gqty): warn about empty selections * fix(packages/gqty): pure peer dep of graphql-ws * feat(package/gqty): edge compatible microtask * chore(examples/github): remove stale example * chore(deps): upgrade and dedupe typescript * feat(package/gqty): added extensions option * fix(packages/react): defaults to soft to match the docs * fix(packages/react): better simulate useTransactionQuery * chore(docs): self-contained images in README.md * fix(packages/react): flaky waitFor * chore(deps): make type-fest optional * feat(package/cli): error handling in generated client * chore(package/cli): code-splitting for watch mode * chore(deps): remove ws dependency * fix(package/react): infinite render loop * fix(package/react): early cache hydration * fix(package/react): default mode * feat(core): even more stickier fetches * chore: verbatimModuleSyntax * chore: test grommet fetch loop * fix(package/react): properly dispose cache subscribers * chore(deps): update esbuild * feat(cli): prompt for destination * fix(packages/react): infinite fetch via stale proxy #1588 * feat(examples/gnt): add bundle analyzer * fix(cli): compat with config.introspection * fix(cli): fetch all schemas before merging * fix(cli): install peer dep 'graphql' * fix(cli): allow disable subscription via arg * fix(packages/cli): typo on options definition * feat(cli): add negative options * fix(gqty): safe auto-selection on nullable interfaces * feat(gqty): remove default return from resolve() * fix(package/react): clear selections post-fetch in useQuery (#1594) * chore(compat): normalize import.meta.url to increase compatibility. * fix(package/gqty, package/react): error handling * feat(chore): prettier v3 * fix(cli): revert prettier to v2, deps are not ready for it * fix(package/react): reduce over-fetching between renders #1594 * feat(cli): enable suspense in the generated client * chore(examples/gnt): simulate noverby's infinite fetch bug * fix(package/react): reduce infinite fetch when normalization is disabled * fix(package/react): prevent non-query types from sticky fetching * chore(ci): test theguild's snapshot action * fix(cli): missing default import in watch mode * feat(cli): do not exit on fetch errors during watch mode * chore(deps): remove unused packages * chore(lint): add prettier-plugin-jsdoc * feat(package/react): add extensions option to useMutation * chore(prettier): remove jsdoc plugin to prevent noisy changes * feat(package/react): increase compatibility with non-web environments * fix(package/react): prevent infinite fetches * feat(package/react): experimental greedy fetch * feat(package/gqty): expose aliasLength option * feat(package/gqty): supress empty warnings when onEmptyResolve is specified * chore(exampels/vite-react): upgrade deprecated deps * feat(package/logger): fix fetch timer * chore(packages/gqty): user communication on fallbacks * chore(ci): fix release errors * chore(packages/gqty): prevent fetching stale inputs * chore(package/gqty): add mutation test for the new core * chore(examples/vite-react): clean up for suspense * fix(package/gqty): properly batch with microtask * feat(package/cli): allow force disabling of react * feat(package/react): add initialLoadingState option * chore(package/gqty): tidy up file structure * fix(packages/react): prevent fetch loops from cofetching resolvers * fix(packages/gqty): disable initialLoadingState upon first fetch * fix(package/gqty): rerender after first fetch to refresh isLoading * chore(examples/gnt): upgrade nhost client * chore: fix type resolutions in esm * chore(packages/cli): TypeScript v5 friendly type imports * chore(packages/react): reduce redundant iterations * chore(deps): upgrade pnpm * chore(examples/gnt): preparation work for Supabase example API * chore(package/react): remove experimental feature
1 parent c3aaa1b commit a758ed1

File tree

405 files changed

+36315
-89697
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

405 files changed

+36315
-89697
lines changed

.changeset/afraid-flowers-thank.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'gqty': minor
3+
'@gqty/react': minor
4+
---
5+
6+
Added `operationName` in `resolved()`, `inlineResolved()`, `useTransactionQuery()` and `useLazyQuery()`

.changeset/clever-plums-shout.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'gqty': minor
3+
---
4+
5+
feat: batching by microtask

.changeset/config.json

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
{
2-
"$schema": "https://unpkg.com/@changesets/config@1.5.0/schema.json",
3-
"changelog": "@changesets/cli/changelog",
2+
"$schema": "https://unpkg.com/@changesets/config@2.1.0/schema.json",
3+
"changelog": ["@changesets/changelog-github", { "repo": "gqty-dev/gqty" }],
44
"commit": false,
55
"linked": [],
66
"access": "public",
77
"baseBranch": "main",
88
"updateInternalDependencies": "patch",
9-
"ignore": ["example-*", "website"],
9+
"ignore": ["example-*"],
10+
"snapshot": {
11+
"useCalculatedVersion": true,
12+
"prereleaseTemplate": "{tag}-{datetime}.{commit}"
13+
},
1014
"___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH": {
1115
"onlyUpdatePeerDependentsWhenOutOfRange": true
1216
}

.changeset/cool-wolves-own.md

-5
This file was deleted.

.changeset/cyan-seas-relax.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'gqty': minor
3+
---
4+
5+
Added `$meta` API

.changeset/dull-hotels-listen.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'gqty': major
3+
---
4+
5+
Added "Legacy" prefix to deprecated types

.changeset/empty-worms-smell.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@gqty/cli': major
3+
---
4+
5+
Dropped inferrable types from generated schema

.changeset/four-toys-crash.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'gqty': major
3+
---
4+
5+
Added new logging interface for `@gqty/logger`

.changeset/gold-lemons-pump.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'gqty': major
3+
---
4+
5+
`backupPersistence()` and `restorePersistence()` is now replaced with `persist()`, `restore()` and `restoreAsync()`.

.changeset/grumpy-clouds-notice.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@gqty/react': minor
3+
---
4+
5+
Upgrade to the new core

.changeset/hip-kangaroos-give.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'gqty': major
3+
---
4+
5+
QueryFetcher now accepts QueryPayload as the first parameter

.changeset/lemon-bags-behave.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@gqty/cli': minor
3+
---
4+
5+
feat: interactive mode

.changeset/metal-windows-fly.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'gqty': major
3+
---
4+
5+
Remade `Cache` with expiry, normalization and persistence

.changeset/moody-onions-exercise.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'gqty': major
3+
---
4+
5+
Axed `Scheduler`, `Interceptor` and `EventHandler`

.changeset/polite-maps-draw.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@gqty/react': minor
3+
---
4+
5+
Added `ResolverContainer` to replace scheduler for legacy resolvers.

.changeset/polite-wolves-explode.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'gqty': major
3+
---
4+
5+
Reworked `Accessor` and added scoped context

.changeset/pre.json

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
{
2+
"mode": "exit",
3+
"tag": "beta",
4+
"initialVersions": {
5+
"example-gnt": "0.1.0",
6+
"example-react": "1.0.0",
7+
"example-vite": "0.0.0",
8+
"test-utils": "0.1.0",
9+
"@gqty/cli": "3.3.0",
10+
"gqty": "2.3.0",
11+
"@gqty/logger": "2.0.2",
12+
"@gqty/react": "2.1.1",
13+
"@gqty/subscriptions": "2.0.1"
14+
},
15+
"changesets": [
16+
"afraid-flowers-thank",
17+
"curvy-dragons-smell",
18+
"cyan-seas-relax",
19+
"dull-hotels-listen",
20+
"empty-worms-smell",
21+
"four-toys-crash",
22+
"gold-lemons-pump",
23+
"grumpy-clouds-notice",
24+
"hip-kangaroos-give",
25+
"lemon-bags-behave",
26+
"metal-windows-fly",
27+
"moody-onions-exercise",
28+
"polite-maps-draw",
29+
"polite-wolves-explode",
30+
"rare-pets-tan",
31+
"real-camels-run",
32+
"seven-rings-retire",
33+
"small-fishes-dress",
34+
"small-penguins-invent",
35+
"sour-rocks-vanish",
36+
"stale-schools-sleep",
37+
"stale-windows-march",
38+
"tiny-brooms-check",
39+
"tricky-bats-glow",
40+
"tricky-coins-breathe",
41+
"violet-lions-count",
42+
"wise-coins-doubt",
43+
"young-clocks-attend"
44+
]
45+
}

.changeset/rare-pets-tan.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'gqty': major
3+
---
4+
5+
Replaced `@gqty/subscriptions` with `graphql-ws` and `graphql-sse`

.changeset/real-camels-run.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@gqty/react': minor
3+
---
4+
5+
feat: Added onComplete for useMutation

.changeset/seven-rings-retire.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@gqty/react': minor
3+
---
4+
5+
Added `retry` in `useQuery()`

.changeset/small-fishes-dress.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@gqty/cli': major
3+
---
4+
5+
generated query fetcher now takes a single QueryPayload parameter

.changeset/small-penguins-invent.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
'@gqty/react': minor
33
---
44

5-
Window focus refetching
5+
Added `refetchInteraval`, `refetchIntervalInBackground`, `refetchOnReconnect` and `refetchOnWindowVisible` in `useQuery`.

.changeset/stale-schools-sleep.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'gqty': major
3+
---
4+
5+
Rewritten `Selection` class

.changeset/stale-windows-march.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'gqty': major
3+
---
4+
5+
Introduced `resolve()` and `subscribe()` API

.changeset/tiny-brooms-check.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@gqty/react': minor
3+
---
4+
5+
Fetch errors now throws to boundaries in suspense mode.

.changeset/tricky-coins-breathe.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'gqty': major
3+
---
4+
5+
Replaced `lodash` with `just-*` and dropped `@gqty/utils`

.changeset/violet-lions-count.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'gqty': major
3+
---
4+
5+
Deprecated `resolved()`, `inlineResolved()`, `mutate()`, `track()`, `prefetch()` and `refetch()`

.changeset/weak-cougars-compare.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@gqty/react': minor
3+
'gqty': minor
4+
---
5+
6+
feat: added extensions option

.changeset/wise-coins-doubt.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'gqty': minor
3+
---
4+
5+
Added `name` in `GQtyError` for better logging

.changeset/young-clocks-attend.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'gqty': major
3+
---
4+
5+
Replace variable serializer with object-hash, now with shortened alias

.github/workflows/canary.yaml

+9-35
Original file line numberDiff line numberDiff line change
@@ -6,38 +6,12 @@ on:
66
- main
77

88
jobs:
9-
publish-canary:
10-
name: Publish Canary
11-
runs-on: ubuntu-latest
12-
if: github.event.pull_request.head.repo.full_name == github.repository
13-
steps:
14-
- name: Checkout Repo
15-
uses: actions/checkout@v3
16-
with:
17-
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
18-
fetch-depth: 0
19-
20-
- uses: pnpm/[email protected]
21-
with:
22-
version: ^7.1.1
23-
- name: Setup Node.js 16.x
24-
uses: actions/setup-node@v3
25-
with:
26-
node-version: 16.x
27-
cache: 'pnpm'
28-
29-
- name: Setup NPM credentials
30-
run: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
31-
env:
32-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
33-
34-
- name: Install Dependencies
35-
run: pnpm install
36-
37-
- name: Release Canary
38-
id: canary
39-
uses: 'kamilkisiela/release-canary@master'
40-
with:
41-
npm-token: ${{ secrets.NPM_TOKEN }}
42-
npm-script: 'pnpm release:canary'
43-
changesets: true
9+
release-canary:
10+
uses: the-guild-org/shared-config/.github/workflows/release-snapshot.yml@main
11+
with:
12+
packageManager: pnpm
13+
nodeVersion: 16 # align with the-guild-org/changesets-snapshot-action
14+
npmTag: canary
15+
secrets:
16+
githubToken: ${{ secrets.GITHUB_TOKEN }}
17+
npmToken: ${{ secrets.NPM_TOKEN }}

.github/workflows/tests.yaml

+3-5
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,17 @@ env:
2020

2121
jobs:
2222
build:
23-
timeout-minutes: 10
23+
timeout-minutes: 20
2424
name: Install, Build and Test
2525
runs-on: ${{ matrix.os }}
2626
strategy:
2727
matrix:
28-
node-version: [14, 16, 18]
28+
node-version: [16, 18, 20]
2929
os: [ubuntu-latest]
3030
steps:
3131
- name: Checkout code
3232
uses: actions/checkout@v3
33-
- uses: pnpm/[email protected]
34-
with:
35-
version: ^7.1.1
33+
- uses: pnpm/[email protected]
3634
- name: Use Node.js ${{ matrix.node-version }}
3735
uses: actions/setup-node@v3
3836
with:

.prettierrc

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"printWidth": 80,
3+
"proseWrap": "always",
34
"semi": true,
45
"singleQuote": true,
56
"trailingComma": "es5"

.vscode/settings.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
{
2-
"typescript.tsdk": "node_modules/typescript/lib"
2+
"typescript.tsdk": "node_modules/typescript/lib",
3+
"prettier.proseWrap": "preserve"
34
}

CONTRIBUTING.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
# Contributing
22

3-
Check [https://gqty.dev/docs/intro/contributing](https://gqty.dev/docs/intro/contributing)
3+
Check our roadmap at [https://gqty.dev/#roadmap](https://gqty.dev/#roadmap), and
4+
read our vision for GQty at
5+
[https://github.com/sponsors/gqty-dev](https://github.com/sponsors/gqty-dev).

README.md

+10-13
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,28 @@
11
<p align="center">
22
<a href="https://gqty.dev">
3-
<img src="internal/website/public/logo.png" height="150" alt="gqty">
3+
<img src="internal/images/logo.png" height="150" alt="gqty" />
44
</a>
55
</p>
66

77
<h2 align="center">
8-
a GraphQL client built for rapid iteration.
9-
<a href="https://gqty.dev">
10-
<img alt="Documentation" src="https://img.shields.io/badge/documentation-documentation?color=C00B84">
11-
</a>
12-
<a href="https://discord.gg/U967mp5qbQ">
13-
<img alt="Discord" src="https://img.shields.io/discord/874477141834739762?color=7289d9&label=discord">
14-
</a>
8+
The No-GraphQL Client for TypeScript
9+
10+
[![Documentation](https://img.shields.io/badge/documentation-documentation?color=C00B84)](https://gqty.dev)
11+
[![Discord](https://img.shields.io/discord/874477141834739762?color=7289d9&label=discord)](https://discord.gg/U967mp5qbQ)
12+
1513
</h2>
1614

17-
<a href="https://gqty.dev">
18-
<img alt="Example usage" src="https://user-images.githubusercontent.com/13242392/112103674-fddc4980-8ba1-11eb-8c83-b527dcb0243d.PNG">
19-
</a>
15+
[![GQty Hero Section](internal/images/hero.png)](https://gqty.dev)
2016

2117
---
2218

23-
Head over to [gqty.dev](https://gqty.dev), to explore features and documentation.
19+
Head over to [gqty.dev](https://gqty.dev) to explore features and documentation.
2420

2521
---
2622

2723
## Get involved
2824

29-
Documentation, bug reports, pull requests, and all other contributions are welcome! See [`CONTRIBUTING.md`](CONTRIBUTING.md).
25+
Documentation, bug reports, pull requests, and all other contributions are
26+
welcome! See [`CONTRIBUTING.md`](CONTRIBUTING.md).
3027

3128
Docs powered by [Vercel](https://vercel.com/?utm_source=gqty&utm_campaign=oss)

bob-esbuild.config.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { sep } from 'path';
21
import { readFileSync } from 'fs';
2+
import { sep } from 'path';
33

44
const isCLIPackage = process.cwd().endsWith(sep + 'cli');
55

examples/ez-react-next/gqty.config.cjs

-13
This file was deleted.

examples/ez-react-next/next-env.d.ts

-6
This file was deleted.

0 commit comments

Comments
 (0)