You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
`graph-client` implements automatic pagination using `first:` and `after:` filters of `graph-node`.
8
+
9
+
At the moment, `graph-node` allow fetching only 1000 records per query. This transfomer allow you to run queries with any limit, and the breaks it automatically to multiple concurrent requests, then merges the responses into a single response.
10
+
11
+
This feature is implemented in `@graphprotocol/client-auto-pagination` and installed automatically with the `graph-client` CLI package.
`graph-client` implements automatic block tracking using `number_gte` filter of `graph-node`. This automates the process [of fetching and tracking the block number of entites](https://thegraph.com/docs/en/developer/distributed-systems/#polling-for-updated-data).
8
+
9
+
This feature is implemented in `@graphprotocol/client-block-tracking` and installed automatically with the `graph-client` CLI package.
> You can find the [complete documentation for the `graphql` handler here](https://www.graphql-mesh.com/docs/handlers/graphql#config-api-reference).
172
174
173
-
#### Environment Variables Inteporlation
175
+
#### Environment Variables Interpolation
174
176
175
177
If you wish to use environment variables in your The Graph Client configuration file, you can use interpolation with `env` helper:
176
178
@@ -282,6 +284,84 @@ sources:
282
284
283
285
</details>
284
286
287
+
#### Block Tracking
288
+
289
+
The Graph Client can track block numbers and do the following queries by following [this pattern](https://thegraph.com/docs/en/developer/distributed-systems/#polling-for-updated-data) with `blockTracking` transform;
# You might want to disable schema validation for faster startup
300
+
validateSchema: true
301
+
# Ignore the fields that you don't want to be tracked
302
+
ignoreFieldNames: [users, prices]
303
+
# Exclude the operation with the following names
304
+
ignoreOperationNames: [NotFollowed]
305
+
```
306
+
307
+
[You can try a working example here](./examples/transforms)
308
+
309
+
#### Automatic Pagination
310
+
311
+
With most subgraphs, the number of records you can fetch is limited. In this case, you have to send multiple requests with pagination.
312
+
313
+
```graphql
314
+
query {
315
+
# Will throw an error if the limit is 1000
316
+
users(first: 2000) {
317
+
id
318
+
name
319
+
}
320
+
}
321
+
```
322
+
323
+
So you have to send the following operations one after the other:
324
+
325
+
```graphql
326
+
query {
327
+
# Will throw an error if the limit is 1000
328
+
users(first: 1000) {
329
+
id
330
+
name
331
+
}
332
+
}
333
+
```
334
+
335
+
Then after the first response;
336
+
337
+
```graphql
338
+
query {
339
+
# Will throw an error if the limit is 1000
340
+
users(first: 1000, skip: 1000) {
341
+
id
342
+
name
343
+
}
344
+
}
345
+
```
346
+
347
+
After the second response, you have to merge the results manually. But instead The Graph Client allows you to do the first one and automatically does those multiple requests for you under the hood.
# You might want to disable schema validation for faster startup
360
+
validateSchema: true
361
+
```
362
+
363
+
[You can try a working example here](./examples/transforms)
364
+
285
365
#### Client-side Composition
286
366
287
367
The Graph Client has built-in support for client-side GraphQL Composition (powered by [GraphQL-Tools Schema-Stitching](https://www.graphql-tools.com/docs/schema-stitching/stitch-combining-schemas)).
`graph-client` implements automatic pagination using `first:` and `after:` filters of `graph-node`.
4
+
5
+
At the moment, `graph-node` allow fetching only 1000 records per query. This transfomer allow you to run queries with any limit, and the breaks it automatically to multiple concurrent requests, then merges the responses into a single response.
6
+
7
+
This feature is implemented in `@graphprotocol/client-auto-pagination` and installed automatically with the `graph-client` CLI package.
0 commit comments