@dumbql/persisted-queries
v1.0.5
Published
Automatic Persisted Queries (APQ) for DumbQL — reduces bandwidth by sending query hashes instead of full query strings.
Maintainers
Readme
@dumbql/persisted-queries
Automatic Persisted Queries (APQ) for DumbQL — reduces bandwidth by sending query hashes instead of full query strings.
Install
npm install @dumbql/persisted-queriesQuick Start
import { apqMiddleware } from '@dumbql/persisted-queries';
provideDumbql({
endpoint: '/graphql',
middleware: [apqMiddleware()],
});How It Works
- First request sends
extensions.persistedQuerywith the SHA‑256 hash of the query. - If the server responds with
PersistedQueryNotFound, the middleware automatically retries with the full query body, registering it on the server. - Subsequent requests send only the hash.
API
| Export | Description |
|--------|-------------|
| apqMiddleware() | Middleware function — wire into DumbqlConfig.middleware |
| PersistedQueryService | Injectable service wrapping GraphqlService.query() with APQ |
Dependencies
@angular/core, @dumbql/core, rxjs
