Skip to content

Commit

Permalink
feat(openreader): add validation max errors
Browse files Browse the repository at this point in the history
  • Loading branch information
mo4islona committed Jan 9, 2025
1 parent 04e964b commit 9965cbe
Show file tree
Hide file tree
Showing 15 changed files with 2,434 additions and 2,393 deletions.
4,650 changes: 2,326 additions & 2,324 deletions common/config/rush/pnpm-lock.yaml

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions common/scripts/install-run-rush.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

122 changes: 77 additions & 45 deletions common/scripts/install-run.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions graphql/graphql-server/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@subsquid/graphql-server",
"version": "4.9.0",
"version": "4.10.0",
"description": "GraphQL server for squid project",
"license": "GPL-3.0-or-later",
"repository": "[email protected]:subsquid/squid.git",
Expand All @@ -24,15 +24,15 @@
"@graphql-tools/merge": "^9.0.1",
"@graphql-tools/utils": "^10.0.11",
"@graphql-tools/schema": "^10.0.2",
"@subsquid/openreader": "^5.2.0",
"@subsquid/openreader": "^5.3.0",
"@subsquid/typeorm-config": "^4.1.1",
"@subsquid/logger": "^1.3.3",
"@subsquid/util-internal": "^3.2.0",
"@subsquid/util-internal-commander": "^1.4.0",
"@subsquid/util-internal-http-server": "^2.0.0",
"@subsquid/util-internal-ts-node": "^0.0.0",
"apollo-server-core": "^3.13.0",
"apollo-server-express": "^3.13.0",
"@subsquid/apollo-server-core": "^3.14.0",
"@subsquid/apollo-server-express": "^3.14.0",
"commander": "^11.1.0",
"dotenv": "^16.3.1",
"express": "^4.18.2",
Expand Down
2 changes: 1 addition & 1 deletion graphql/graphql-server/src/check.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {Model} from '@subsquid/openreader/lib/model'
import {assertNotNull} from '@subsquid/util-internal'
import {PluginDefinition, GraphQLRequest} from 'apollo-server-core'
import {PluginDefinition, GraphQLRequest} from '@subsquid/apollo-server-core'
import {GraphQLSchema, OperationDefinitionNode} from 'graphql'


Expand Down
2 changes: 2 additions & 0 deletions graphql/graphql-server/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,14 @@ runProgram(async () => {
program.option('--dumb-cache-max-age <ms>', 'cache-control max-age in milliseconds', nat, 5000)
program.option('--dumb-cache-ttl <ms>', 'in-memory cached item TTL in milliseconds', nat, 5000)
program.option('--dumb-cache-size <mb>', 'max in-memory cache size in megabytes', nat, 50)
program.option('--validation-max-errors <count>', 'max validation errors', nat)
program.addOption(new Option('--dialect <type>').choices(Object.values(Dialect)))

let opts = program.parse().opts() as {
maxRequestSize: number
maxRootFields?: number
maxResponseSize?: number
validationMaxErrors?: number
squidStatus?: boolean
sqlStatementTimeout?: number
dumbCache?: "in-memory" | "redis"
Expand Down
4 changes: 3 additions & 1 deletion graphql/graphql-server/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {ResponseSizeLimit} from '@subsquid/openreader/lib/util/limit'
import {def} from '@subsquid/util-internal'
import {ListeningServer} from '@subsquid/util-internal-http-server'
import {isTsNode} from '@subsquid/util-internal-ts-node'
import {ApolloServerPluginCacheControl, KeyValueCache, PluginDefinition} from 'apollo-server-core'
import {ApolloServerPluginCacheControl, KeyValueCache, PluginDefinition} from '@subsquid/apollo-server-core'
import responseCachePlugin from 'apollo-server-plugin-response-cache'
import assert from 'assert'
import {GraphQLInt, GraphQLObjectType, GraphQLSchema, GraphQLString} from 'graphql'
Expand All @@ -31,6 +31,7 @@ export interface ServerOptions {
maxRequestSizeBytes?: number
maxRootFields?: number
maxResponseNodes?: number
validationMaxErrors?: number
sqlStatementTimeout?: number
squidStatus?: boolean
subscriptions?: boolean
Expand Down Expand Up @@ -97,6 +98,7 @@ export class Server {
graphiqlConsole: true,
maxRequestSizeBytes: this.options.maxRequestSizeBytes,
maxRootFields: this.options.maxRootFields,
validationMaxErrors: this.options.validationMaxErrors,
cache: this.cache()
})
}
Expand Down
1 change: 0 additions & 1 deletion graphql/graphql-server/src/typeorm.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import type {Logger} from '@subsquid/logger'
import type {OpenreaderContext} from '@subsquid/openreader/lib/context'
import {DbType} from '@subsquid/openreader/lib/db'
import type {Dialect} from '@subsquid/openreader/lib/dialect'
import type {Query} from '@subsquid/openreader/lib/sql/query'
import {Subscription} from '@subsquid/openreader/lib/subscription'
import {LazyTransaction} from '@subsquid/openreader/lib/util/lazy-transaction'
Expand Down
6 changes: 3 additions & 3 deletions graphql/openreader/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@subsquid/openreader",
"version": "5.2.0",
"version": "5.3.0",
"description": "GraphQL server for postgres-compatible databases",
"keywords": [
"graphql",
Expand Down Expand Up @@ -33,8 +33,8 @@
"@subsquid/util-internal-hex": "^1.2.2",
"@subsquid/util-internal-http-server": "^2.0.0",
"@subsquid/util-naming": "^1.3.0",
"apollo-server-core": "^3.13.0",
"apollo-server-express": "^3.13.0",
"@subsquid/apollo-server-core": "^3.14.0",
"@subsquid/apollo-server-express": "^3.14.0",
"commander": "^11.1.0",
"deep-equal": "^2.2.3",
"express": "^4.18.2",
Expand Down
2 changes: 1 addition & 1 deletion graphql/openreader/src/dialect/opencrud/schema.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {def, unexpectedCase} from '@subsquid/util-internal'
import {toCamelCase, toPlural} from '@subsquid/util-naming'
import {UserInputError} from 'apollo-server-core'
import {UserInputError} from '@subsquid/apollo-server-core'
import assert from 'assert'
import {
GraphQLBoolean,
Expand Down
Loading

0 comments on commit 9965cbe

Please sign in to comment.