Support fragments in GQL queries #11

Merged
nabarun merged 1 commits from ng-gql-fragment into main 2024-05-17 11:58:03 +00:00
4 changed files with 192 additions and 326 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "@cerc-io/ajna-watcher-ts", "name": "@cerc-io/ajna-watcher-ts",
"version": "0.1.7", "version": "0.1.8",
"description": "ajna-watcher-ts", "description": "ajna-watcher-ts",
"private": true, "private": true,
"main": "dist/index.js", "main": "dist/index.js",
@ -39,11 +39,11 @@
"homepage": "https://github.com/cerc-io/watcher-ts#readme", "homepage": "https://github.com/cerc-io/watcher-ts#readme",
"dependencies": { "dependencies": {
"@apollo/client": "^3.3.19", "@apollo/client": "^3.3.19",
"@cerc-io/cli": "^0.2.88", "@cerc-io/cli": "^0.2.89",
"@cerc-io/ipld-eth-client": "^0.2.88", "@cerc-io/ipld-eth-client": "^0.2.89",
"@cerc-io/solidity-mapper": "^0.2.88", "@cerc-io/solidity-mapper": "^0.2.89",
"@cerc-io/util": "^0.2.88", "@cerc-io/util": "^0.2.89",
"@cerc-io/graph-node": "^0.2.88", "@cerc-io/graph-node": "^0.2.89",
"@ethersproject/providers": "^5.4.4", "@ethersproject/providers": "^5.4.4",
"debug": "^4.3.1", "debug": "^4.3.1",
"decimal.js": "^10.3.1", "decimal.js": "^10.3.1",

View File

@ -6,7 +6,7 @@ import assert from 'assert';
import { DeepPartial, FindConditions, FindManyOptions, ObjectLiteral } from 'typeorm'; import { DeepPartial, FindConditions, FindManyOptions, ObjectLiteral } from 'typeorm';
import debug from 'debug'; import debug from 'debug';
import { ethers, constants } from 'ethers'; import { ethers, constants } from 'ethers';
import { SelectionNode } from 'graphql'; import { GraphQLResolveInfo } from 'graphql';
import { JsonFragment } from '@ethersproject/abi'; import { JsonFragment } from '@ethersproject/abi';
import { BaseProvider } from '@ethersproject/providers'; import { BaseProvider } from '@ethersproject/providers';
@ -464,9 +464,9 @@ export class Indexer implements IndexerInterface {
entity: new () => Entity, entity: new () => Entity,
id: string, id: string,
block: BlockHeight, block: BlockHeight,
selections: ReadonlyArray<SelectionNode> = [] queryInfo: GraphQLResolveInfo
): Promise<any> { ): Promise<any> {
const data = await this._graphWatcher.getEntity(entity, id, this._relationsMap, block, selections); const data = await this._graphWatcher.getEntity(entity, id, this._relationsMap, block, queryInfo);
return data; return data;
} }
@ -476,9 +476,9 @@ export class Indexer implements IndexerInterface {
block: BlockHeight, block: BlockHeight,
where: { [key: string]: any } = {}, where: { [key: string]: any } = {},
queryOptions: QueryOptions = {}, queryOptions: QueryOptions = {},
selections: ReadonlyArray<SelectionNode> = [] queryInfo: GraphQLResolveInfo
): Promise<any[]> { ): Promise<any[]> {
return this._graphWatcher.getEntities(entity, this._relationsMap, block, where, queryOptions, selections); return this._graphWatcher.getEntities(entity, this._relationsMap, block, where, queryOptions, queryInfo);
} }
// eslint-disable-next-line @typescript-eslint/no-unused-vars // eslint-disable-next-line @typescript-eslint/no-unused-vars

File diff suppressed because it is too large Load Diff

View File

@ -176,10 +176,10 @@
binaryen "101.0.0-nightly.20210723" binaryen "101.0.0-nightly.20210723"
long "^4.0.0" long "^4.0.0"
"@cerc-io/cache@^0.2.88": "@cerc-io/cache@^0.2.89":
version "0.2.88" version "0.2.89"
resolved "https://git.vdb.to/api/packages/cerc-io/npm/%40cerc-io%2Fcache/-/0.2.88/cache-0.2.88.tgz#93a2b201541d5912d550739a9e4a295e491edc6d" resolved "https://git.vdb.to/api/packages/cerc-io/npm/%40cerc-io%2Fcache/-/0.2.89/cache-0.2.89.tgz#89bddf8e1e9ae40939315cd8aec5dd9138feb85a"
integrity sha512-OiEXcegdUlXSXHF+iWWAQFXwRQq1CJ9RJ4xn9a0oNTKcJH2PHt9DsCwSp4VE7PwFzOr7Luzw3RnloGOpjqxhng== integrity sha512-cF565BA7vltlecC7AG+Ih0hzEyAS89MLxLMFnCdYzObGqM0vyBP7RruC6RNu304Jg1zV/T2ablb6qh4VBPgCvQ==
dependencies: dependencies:
canonical-json "^0.0.4" canonical-json "^0.0.4"
debug "^4.3.1" debug "^4.3.1"
@ -187,19 +187,19 @@
fs-extra "^10.0.0" fs-extra "^10.0.0"
level "^7.0.0" level "^7.0.0"
"@cerc-io/cli@^0.2.88": "@cerc-io/cli@^0.2.89":
version "0.2.88" version "0.2.89"
resolved "https://git.vdb.to/api/packages/cerc-io/npm/%40cerc-io%2Fcli/-/0.2.88/cli-0.2.88.tgz#6a4e58499730db5f96431ac6825791dce1f418ce" resolved "https://git.vdb.to/api/packages/cerc-io/npm/%40cerc-io%2Fcli/-/0.2.89/cli-0.2.89.tgz#9b67bd9add6f1f6ca67e947b38cc544ad6108c4c"
integrity sha512-/ctrqTNX8nV1FZEivjbUqFfnifWOUffn7XdfSPs3HHSF2vaflsn8pnRk9nK3P2g0xc5dpxP5ZrhvHuHLcQE6tw== integrity sha512-Jduv4PCa8+Lru1VRYM+EudWXT9UE7uy+hRaHfWi4wGhWLKGd6S8A7WymbJtjA9NC0sNinBbfZmOLQ8xeiIypZA==
dependencies: dependencies:
"@apollo/client" "^3.7.1" "@apollo/client" "^3.7.1"
"@cerc-io/cache" "^0.2.88" "@cerc-io/cache" "^0.2.89"
"@cerc-io/ipld-eth-client" "^0.2.88" "@cerc-io/ipld-eth-client" "^0.2.89"
"@cerc-io/libp2p" "^0.42.2-laconic-0.1.4" "@cerc-io/libp2p" "^0.42.2-laconic-0.1.4"
"@cerc-io/nitro-node" "^0.1.15" "@cerc-io/nitro-node" "^0.1.15"
"@cerc-io/peer" "^0.2.88" "@cerc-io/peer" "^0.2.89"
"@cerc-io/rpc-eth-client" "^0.2.88" "@cerc-io/rpc-eth-client" "^0.2.89"
"@cerc-io/util" "^0.2.88" "@cerc-io/util" "^0.2.89"
"@ethersproject/providers" "^5.4.4" "@ethersproject/providers" "^5.4.4"
"@graphql-tools/utils" "^9.1.1" "@graphql-tools/utils" "^9.1.1"
"@ipld/dag-cbor" "^8.0.0" "@ipld/dag-cbor" "^8.0.0"
@ -220,16 +220,16 @@
typeorm "0.2.37" typeorm "0.2.37"
yargs "^17.0.1" yargs "^17.0.1"
"@cerc-io/graph-node@^0.2.88": "@cerc-io/graph-node@^0.2.89":
version "0.2.88" version "0.2.89"
resolved "https://git.vdb.to/api/packages/cerc-io/npm/%40cerc-io%2Fgraph-node/-/0.2.88/graph-node-0.2.88.tgz#82c3bde2e9b5f8416e39adae4c4dc680ee7c4140" resolved "https://git.vdb.to/api/packages/cerc-io/npm/%40cerc-io%2Fgraph-node/-/0.2.89/graph-node-0.2.89.tgz#ee536a33a109cb470551190505ed16616fdb279f"
integrity sha512-jpYrjY1/QR+505VGhXwI0nF+gNDRy3yqQYDOLsXls9TMgI4Q5f+l42J/+Il4zgRh1V+fK4faoi1vm+5M7gwM4Q== integrity sha512-Jolu16pGpx9L9I/GBP1vY08Gvcv+imDKvttIeH4AHbWeMvPAAFYSh57PJGYwVO3T1/Sbg5o9xU6po+rYRDhqTw==
dependencies: dependencies:
"@apollo/client" "^3.3.19" "@apollo/client" "^3.3.19"
"@cerc-io/assemblyscript" "0.19.10-watcher-ts-0.1.2" "@cerc-io/assemblyscript" "0.19.10-watcher-ts-0.1.2"
"@cerc-io/cache" "^0.2.88" "@cerc-io/cache" "^0.2.89"
"@cerc-io/ipld-eth-client" "^0.2.88" "@cerc-io/ipld-eth-client" "^0.2.89"
"@cerc-io/util" "^0.2.88" "@cerc-io/util" "^0.2.89"
"@types/json-diff" "^0.5.2" "@types/json-diff" "^0.5.2"
"@types/yargs" "^17.0.0" "@types/yargs" "^17.0.0"
bn.js "^4.11.9" bn.js "^4.11.9"
@ -246,14 +246,14 @@
typeorm-naming-strategies "^2.0.0" typeorm-naming-strategies "^2.0.0"
yargs "^17.0.1" yargs "^17.0.1"
"@cerc-io/ipld-eth-client@^0.2.88": "@cerc-io/ipld-eth-client@^0.2.89":
version "0.2.88" version "0.2.89"
resolved "https://git.vdb.to/api/packages/cerc-io/npm/%40cerc-io%2Fipld-eth-client/-/0.2.88/ipld-eth-client-0.2.88.tgz#274b144dabe3a65651cd5b4126e8d176ea7e3171" resolved "https://git.vdb.to/api/packages/cerc-io/npm/%40cerc-io%2Fipld-eth-client/-/0.2.89/ipld-eth-client-0.2.89.tgz#c0e969207cafb853d82989fe354ef86c54790e40"
integrity sha512-fe1wtx4GBDSyF/zgqJLWuBEkj8S8aD2c64YxABlhK+zqxRZRIQ+KOqKnAwlMNcTKKIzy7AR4i6zp/N4z1yU9rA== integrity sha512-NVW8ro5Is6YlBLZUw2LRxB3r1Wig23XO49iKYSPKl3NHD9vb8DuhSn2ZKTEnH5PQ23LmjeaOPUOe6iD83OC/qg==
dependencies: dependencies:
"@apollo/client" "^3.7.1" "@apollo/client" "^3.7.1"
"@cerc-io/cache" "^0.2.88" "@cerc-io/cache" "^0.2.89"
"@cerc-io/util" "^0.2.88" "@cerc-io/util" "^0.2.89"
cross-fetch "^3.1.4" cross-fetch "^3.1.4"
debug "^4.3.1" debug "^4.3.1"
ethers "^5.4.4" ethers "^5.4.4"
@ -406,10 +406,10 @@
unique-names-generator "^4.7.1" unique-names-generator "^4.7.1"
yargs "^17.0.1" yargs "^17.0.1"
"@cerc-io/peer@^0.2.88": "@cerc-io/peer@^0.2.89":
version "0.2.88" version "0.2.89"
resolved "https://git.vdb.to/api/packages/cerc-io/npm/%40cerc-io%2Fpeer/-/0.2.88/peer-0.2.88.tgz#3a7efb9d3db9b7b91542a1319f80c2f23ed5ad30" resolved "https://git.vdb.to/api/packages/cerc-io/npm/%40cerc-io%2Fpeer/-/0.2.89/peer-0.2.89.tgz#0e91ff1d84bdc30011c25caebafe0a509d4a6676"
integrity sha512-MycvZSIu81SGPn1Z/8ZQd+rxshcl403MRjq8rgEnGyzVPhQw5X05lm4ZHJqRVOwr7h7fEpgutUHI7BVXtkkxyA== integrity sha512-N0bi5HowDxWJ8H1klIJrqLsZSpcmvP1g4lpfM4lEcnmTmc3j0IchKO4Z4OelPLlWZWqHCSXsTzD2p1KnxkIKDw==
dependencies: dependencies:
"@cerc-io/libp2p" "^0.42.2-laconic-0.1.4" "@cerc-io/libp2p" "^0.42.2-laconic-0.1.4"
"@cerc-io/prometheus-metrics" "1.1.4" "@cerc-io/prometheus-metrics" "1.1.4"
@ -448,23 +448,23 @@
it-stream-types "^1.0.4" it-stream-types "^1.0.4"
promjs "^0.4.2" promjs "^0.4.2"
"@cerc-io/rpc-eth-client@^0.2.88": "@cerc-io/rpc-eth-client@^0.2.89":
version "0.2.88" version "0.2.89"
resolved "https://git.vdb.to/api/packages/cerc-io/npm/%40cerc-io%2Frpc-eth-client/-/0.2.88/rpc-eth-client-0.2.88.tgz#de1a342c5e1061f138356e597891ff0aee3f169d" resolved "https://git.vdb.to/api/packages/cerc-io/npm/%40cerc-io%2Frpc-eth-client/-/0.2.89/rpc-eth-client-0.2.89.tgz#8f0750677598395d15b70e55d3730ee40e143ab5"
integrity sha512-KbSGTnG4bIPC01P8YK7F/M/yEMw6KcF4DDhA4vOTC/KYoXQ/UN7PjiOCq4GVNxbWGnyqhQjNc4n83dMfGG1r+A== integrity sha512-N/s2OMIszD+7NQwCbC4m8R+AjnIG4W4/V9q/4//H6EIgfNYno+mnjYi3qU+nFlZe2gbWR4JiOU6JT7R4hm16kw==
dependencies: dependencies:
"@cerc-io/cache" "^0.2.88" "@cerc-io/cache" "^0.2.89"
"@cerc-io/ipld-eth-client" "^0.2.88" "@cerc-io/ipld-eth-client" "^0.2.89"
"@cerc-io/util" "^0.2.88" "@cerc-io/util" "^0.2.89"
chai "^4.3.4" chai "^4.3.4"
ethers "^5.4.4" ethers "^5.4.4"
left-pad "^1.3.0" left-pad "^1.3.0"
mocha "^8.4.0" mocha "^8.4.0"
"@cerc-io/solidity-mapper@^0.2.88": "@cerc-io/solidity-mapper@^0.2.89":
version "0.2.88" version "0.2.89"
resolved "https://git.vdb.to/api/packages/cerc-io/npm/%40cerc-io%2Fsolidity-mapper/-/0.2.88/solidity-mapper-0.2.88.tgz#34bdef4ba47f364434b7330cb908d83b387cf11b" resolved "https://git.vdb.to/api/packages/cerc-io/npm/%40cerc-io%2Fsolidity-mapper/-/0.2.89/solidity-mapper-0.2.89.tgz#9cf1cfb125d9f275fd6c3d8a09571e65ac80475f"
integrity sha512-Qvez8TKs+xmeox9zqoj3nHOe2SCDsJQGbFfclptAyT3ofRMTEj362+6Yqia8tU8UoGnfFM9EEWbz3lt1x/OQbA== integrity sha512-gBecAbjpnvi+i/EEhgkJc5BXHV+U9ZsvEWESdO7Hse+GW4EVb0nwEAVHcWAUp+MfcBFz5XcH/6oEHnCselk4Ew==
dependencies: dependencies:
dotenv "^10.0.0" dotenv "^10.0.0"
@ -473,15 +473,15 @@
resolved "https://git.vdb.to/api/packages/cerc-io/npm/%40cerc-io%2Fts-channel/-/1.0.3-ts-nitro-0.1.1/ts-channel-1.0.3-ts-nitro-0.1.1.tgz#0768781313a167295c0bf21307f47e02dc17e936" resolved "https://git.vdb.to/api/packages/cerc-io/npm/%40cerc-io%2Fts-channel/-/1.0.3-ts-nitro-0.1.1/ts-channel-1.0.3-ts-nitro-0.1.1.tgz#0768781313a167295c0bf21307f47e02dc17e936"
integrity sha512-2jFICUSyffuZ+8+qRhXuLSJq4GJ6Y02wxiXoubH0Kzv2lIKkJtWICY1ZQQhtXAvP0ncAQB85WJHqtqwH8l7J3Q== integrity sha512-2jFICUSyffuZ+8+qRhXuLSJq4GJ6Y02wxiXoubH0Kzv2lIKkJtWICY1ZQQhtXAvP0ncAQB85WJHqtqwH8l7J3Q==
"@cerc-io/util@^0.2.88": "@cerc-io/util@^0.2.89":
version "0.2.88" version "0.2.89"
resolved "https://git.vdb.to/api/packages/cerc-io/npm/%40cerc-io%2Futil/-/0.2.88/util-0.2.88.tgz#d053e53db6bf58f165e8b134a2ecab4d07c040f3" resolved "https://git.vdb.to/api/packages/cerc-io/npm/%40cerc-io%2Futil/-/0.2.89/util-0.2.89.tgz#ab12302e503723bdb86c80979abd5ba7640ba5ff"
integrity sha512-g9gylT3Igg+hA6OpprXI+niPMGUDCmpBtygim9svXj+iwZCtDZQoLuzlPetcm6wiQMhK0Ai5ReTDAnd0IrrZWw== integrity sha512-NdiyNKOMXVUEchVQ7cjwfGg57v664NXAML6RXakxnkk1KoD1WIO9EeZHilvCCnEK9aDDyu3Wz3hVW3y/6TCEwQ==
dependencies: dependencies:
"@apollo/utils.keyvaluecache" "^1.0.1" "@apollo/utils.keyvaluecache" "^1.0.1"
"@cerc-io/nitro-node" "^0.1.15" "@cerc-io/nitro-node" "^0.1.15"
"@cerc-io/peer" "^0.2.88" "@cerc-io/peer" "^0.2.89"
"@cerc-io/solidity-mapper" "^0.2.88" "@cerc-io/solidity-mapper" "^0.2.89"
"@cerc-io/ts-channel" "1.0.3-ts-nitro-0.1.1" "@cerc-io/ts-channel" "1.0.3-ts-nitro-0.1.1"
"@ethersproject/properties" "^5.7.0" "@ethersproject/properties" "^5.7.0"
"@ethersproject/providers" "^5.4.4" "@ethersproject/providers" "^5.4.4"