@subsquid+graphql-server+3.3.2.patch 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. diff --git a/node_modules/@subsquid/graphql-server/lib/resolvers.js b/node_modules/@subsquid/graphql-server/lib/resolvers.js
  2. index ea605c2..2564ebd 100644
  3. --- a/node_modules/@subsquid/graphql-server/lib/resolvers.js
  4. +++ b/node_modules/@subsquid/graphql-server/lib/resolvers.js
  5. @@ -19,6 +19,7 @@ async function loadCustomResolvers(mod) {
  6. return (0, type_graphql_1.buildSchema)({
  7. resolvers: [mod],
  8. scalarsMap,
  9. + validate: { forbidUnknownValues: false },
  10. container: resolverData => new CustomResolversContainer(resolverData)
  11. });
  12. }
  13. diff --git a/node_modules/@subsquid/graphql-server/lib/server.js b/node_modules/@subsquid/graphql-server/lib/server.js
  14. index 04e74c3..e95a07b 100644
  15. --- a/node_modules/@subsquid/graphql-server/lib/server.js
  16. +++ b/node_modules/@subsquid/graphql-server/lib/server.js
  17. @@ -90,16 +90,17 @@ class Server {
  18. });
  19. }
  20. async schema() {
  21. - let schemas = [
  22. - new schema_2.SchemaBuilder({ model: this.model(), subscriptions: this.options.subscriptions }).build()
  23. - ];
  24. - if (this.options.squidStatus !== false) {
  25. - schemas.push(this.squidStatusSchema());
  26. - }
  27. let customResolvers = await this.customResolvers();
  28. + let schemas = []
  29. if (customResolvers) {
  30. schemas.push(customResolvers);
  31. }
  32. + schemas.push(
  33. + new schema_2.SchemaBuilder({ model: this.model(), subscriptions: this.options.subscriptions }).build()
  34. + );
  35. + if (this.options.squidStatus !== false) {
  36. + schemas.push(this.squidStatusSchema());
  37. + }
  38. return (0, schema_1.mergeSchemas)({ schemas });
  39. }
  40. squidStatusSchema() {
  41. @@ -177,7 +178,7 @@ class Server {
  42. return new db_1.PoolOpenreaderContext(dialect, pool, pool, this.options.subscriptionPollInterval);
  43. };
  44. }
  45. - return () => {
  46. + return ({ req }) => {
  47. let openreader = createOpenreader();
  48. if (this.options.maxResponseNodes) {
  49. openreader.responseSizeLimit = new limit_1.ResponseSizeLimit(this.options.maxResponseNodes);
  50. @@ -186,7 +187,7 @@ class Server {
  51. if (this.options.subscriptionMaxResponseNodes) {
  52. openreader.subscriptionResponseSizeLimit = new limit_1.ResponseSizeLimit(this.options.subscriptionMaxResponseNodes);
  53. }
  54. - return { openreader };
  55. + return { req, openreader };
  56. };
  57. }
  58. async createTypeormConnection(options) {