Skip to content

Commit

Permalink
feat: Scoped Queries (#1544)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
vicary committed Apr 21, 2024
1 parent c3aaa1b commit a758ed1
Show file tree
Hide file tree
Showing 405 changed files with 36,315 additions and 89,697 deletions.
6 changes: 6 additions & 0 deletions .changeset/afraid-flowers-thank.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'gqty': minor
'@gqty/react': minor
---

Added `operationName` in `resolved()`, `inlineResolved()`, `useTransactionQuery()` and `useLazyQuery()`
5 changes: 5 additions & 0 deletions .changeset/clever-plums-shout.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'gqty': minor
---

feat: batching by microtask
10 changes: 7 additions & 3 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -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
}
Expand Down
5 changes: 0 additions & 5 deletions .changeset/cool-wolves-own.md

This file was deleted.

5 changes: 5 additions & 0 deletions .changeset/cyan-seas-relax.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'gqty': minor
---

Added `$meta` API
5 changes: 5 additions & 0 deletions .changeset/dull-hotels-listen.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'gqty': major
---

Added "Legacy" prefix to deprecated types
5 changes: 5 additions & 0 deletions .changeset/empty-worms-smell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@gqty/cli': major
---

Dropped inferrable types from generated schema
5 changes: 5 additions & 0 deletions .changeset/four-toys-crash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'gqty': major
---

Added new logging interface for `@gqty/logger`
5 changes: 5 additions & 0 deletions .changeset/gold-lemons-pump.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'gqty': major
---

`backupPersistence()` and `restorePersistence()` is now replaced with `persist()`, `restore()` and `restoreAsync()`.
5 changes: 5 additions & 0 deletions .changeset/grumpy-clouds-notice.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@gqty/react': minor
---

Upgrade to the new core
5 changes: 5 additions & 0 deletions .changeset/hip-kangaroos-give.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'gqty': major
---

QueryFetcher now accepts QueryPayload as the first parameter
5 changes: 5 additions & 0 deletions .changeset/lemon-bags-behave.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@gqty/cli': minor
---

feat: interactive mode
5 changes: 5 additions & 0 deletions .changeset/metal-windows-fly.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'gqty': major
---

Remade `Cache` with expiry, normalization and persistence
5 changes: 5 additions & 0 deletions .changeset/moody-onions-exercise.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'gqty': major
---

Axed `Scheduler`, `Interceptor` and `EventHandler`
5 changes: 5 additions & 0 deletions .changeset/polite-maps-draw.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@gqty/react': minor
---

Added `ResolverContainer` to replace scheduler for legacy resolvers.
5 changes: 5 additions & 0 deletions .changeset/polite-wolves-explode.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'gqty': major
---

Reworked `Accessor` and added scoped context
45 changes: 45 additions & 0 deletions .changeset/pre.json
Original file line number Diff line number Diff line change
@@ -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"
]
}
5 changes: 5 additions & 0 deletions .changeset/rare-pets-tan.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'gqty': major
---

Replaced `@gqty/subscriptions` with `graphql-ws` and `graphql-sse`
5 changes: 5 additions & 0 deletions .changeset/real-camels-run.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@gqty/react': minor
---

feat: Added onComplete for useMutation
5 changes: 5 additions & 0 deletions .changeset/seven-rings-retire.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@gqty/react': minor
---

Added `retry` in `useQuery()`
5 changes: 5 additions & 0 deletions .changeset/small-fishes-dress.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@gqty/cli': major
---

generated query fetcher now takes a single QueryPayload parameter
2 changes: 1 addition & 1 deletion .changeset/small-penguins-invent.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
'@gqty/react': minor
---

Window focus refetching
Added `refetchInteraval`, `refetchIntervalInBackground`, `refetchOnReconnect` and `refetchOnWindowVisible` in `useQuery`.
5 changes: 5 additions & 0 deletions .changeset/stale-schools-sleep.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'gqty': major
---

Rewritten `Selection` class
5 changes: 5 additions & 0 deletions .changeset/stale-windows-march.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'gqty': major
---

Introduced `resolve()` and `subscribe()` API
5 changes: 5 additions & 0 deletions .changeset/tiny-brooms-check.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@gqty/react': minor
---

Fetch errors now throws to boundaries in suspense mode.
5 changes: 5 additions & 0 deletions .changeset/tricky-coins-breathe.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'gqty': major
---

Replaced `lodash` with `just-*` and dropped `@gqty/utils`
5 changes: 5 additions & 0 deletions .changeset/violet-lions-count.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'gqty': major
---

Deprecated `resolved()`, `inlineResolved()`, `mutate()`, `track()`, `prefetch()` and `refetch()`
6 changes: 6 additions & 0 deletions .changeset/weak-cougars-compare.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@gqty/react': minor
'gqty': minor
---

feat: added extensions option
5 changes: 5 additions & 0 deletions .changeset/wise-coins-doubt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'gqty': minor
---

Added `name` in `GQtyError` for better logging
5 changes: 5 additions & 0 deletions .changeset/young-clocks-attend.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'gqty': major
---

Replace variable serializer with object-hash, now with shortened alias
44 changes: 9 additions & 35 deletions .github/workflows/canary.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
8 changes: 3 additions & 5 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,17 @@ 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: [16, 18, 20]
os: [ubuntu-latest]
steps:
- name: Checkout code
uses: actions/checkout@v3
- uses: pnpm/action-setup@v2.2.4
with:
version: ^7.1.1
- uses: pnpm/action-setup@v2.4.0
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
Expand Down
1 change: 1 addition & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"printWidth": 80,
"proseWrap": "always",
"semi": true,
"singleQuote": true,
"trailingComma": "es5"
Expand Down
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"typescript.tsdk": "node_modules/typescript/lib"
"typescript.tsdk": "node_modules/typescript/lib",
"prettier.proseWrap": "preserve"
}
4 changes: 3 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Contributing

Check [https://gqty.dev/docs/intro/contributing](https://gqty.dev/docs/intro/contributing)
Check our roadmap at [https://gqty.dev/#roadmap](https://gqty.dev/#roadmap), and
read our vision for GQty at
[https://github.com/sponsors/gqty-dev](https://github.com/sponsors/gqty-dev).
23 changes: 10 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,31 +1,28 @@
<p align="center">
<a href="https://gqty.dev">
<img src="internal/website/public/logo.png" height="150" alt="gqty">
<img src="internal/images/logo.png" height="150" alt="gqty" />
</a>
</p>

<h2 align="center">
a GraphQL client built for rapid iteration.
<a href="https://gqty.dev">
<img alt="Documentation" src="https://img.shields.io/badge/documentation-documentation?color=C00B84">
</a>
<a href="https://discord.gg/U967mp5qbQ">
<img alt="Discord" src="https://img.shields.io/discord/874477141834739762?color=7289d9&label=discord">
</a>
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)

</h2>

<a href="https://gqty.dev">
<img alt="Example usage" src="https://user-images.githubusercontent.com/13242392/112103674-fddc4980-8ba1-11eb-8c83-b527dcb0243d.PNG">
</a>
[![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)
2 changes: 1 addition & 1 deletion bob-esbuild.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { sep } from 'path';
import { readFileSync } from 'fs';
import { sep } from 'path';

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

Expand Down
13 changes: 0 additions & 13 deletions examples/ez-react-next/gqty.config.cjs

This file was deleted.

6 changes: 0 additions & 6 deletions examples/ez-react-next/next-env.d.ts

This file was deleted.

0 comments on commit a758ed1

Please sign in to comment.