Skip to content

Commit

Permalink
gql schema generation
Browse files Browse the repository at this point in the history
  • Loading branch information
gmbronco committed Jan 15, 2025
1 parent c0b8122 commit 2064cd2
Show file tree
Hide file tree
Showing 30 changed files with 1,165 additions and 1,363 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { gql } from 'apollo-server-express';
import { gql } from 'graphql-request';
export const schema = gql`
#
# THIS FILE IS AUTOGENERATED — DO NOT EDIT IT
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion apps/api/gql/resolvers/beets.resolvers.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Resolvers } from '../../../../schema';
import { Resolvers } from '../generated-schema';
import { beetsService } from '../../../../modules/beets/beets.service';
import { getRequiredAccountAddress, isAdminRoute } from '../../../../modules/auth/auth-context';
import { userService } from '../../../../modules/user/user.service';
Expand Down
2 changes: 1 addition & 1 deletion apps/api/gql/resolvers/blocks.resolvers.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Resolvers } from '../../../../schema';
import { Resolvers } from '../generated-schema';
import { isAdminRoute } from '../../../../modules/auth/auth-context';
import { blocksSubgraphService } from '../../../../modules/subgraphs/blocks-subgraph/blocks-subgraph.service';

Expand Down
2 changes: 1 addition & 1 deletion apps/api/gql/resolvers/content.resolvers.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Resolvers } from '../../../../schema';
import { Resolvers } from '../generated-schema';
import { headerChain } from '../../../../modules/context/header-chain';
import { SanityContentService } from '../../../../modules/content/sanity-content.service';
import { GraphQLError } from 'graphql';
Expand Down
2 changes: 1 addition & 1 deletion apps/api/gql/resolvers/pool.resolvers.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { poolService } from '../../../../modules/pool/pool.service';
import { GqlChain, Resolvers } from '../../../../schema';
import { GqlChain, Resolvers } from '../generated-schema';
import { isAdminRoute } from '../../../../modules/auth/auth-context';
import { networkContext } from '../../../../modules/network/network-context.service';
import { headerChain } from '../../../../modules/context/header-chain';
Expand Down
2 changes: 1 addition & 1 deletion apps/api/gql/resolvers/protocol.resolvers.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { GqlLatestSyncedBlocks, Resolvers } from '../../../../schema';
import { GqlLatestSyncedBlocks, Resolvers } from '../generated-schema';
import { protocolService } from '../../../../modules/protocol/protocol.service';
import { networkContext } from '../../../../modules/network/network-context.service';
import { headerChain } from '../../../../modules/context/header-chain';
Expand Down
2 changes: 1 addition & 1 deletion apps/api/gql/resolvers/scalar.resolvers.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Resolvers } from '../../../../schema';
import { Resolvers } from '../generated-schema';
import { GraphQLScalarType, Kind } from 'graphql';

const dateScalar = new GraphQLScalarType<Date | null, string | null>({
Expand Down
2 changes: 1 addition & 1 deletion apps/api/gql/resolvers/sftmx.resolvers.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Resolvers } from '../../../../schema';
import { Resolvers } from '../generated-schema';
import { SftmxController } from '../../../../modules/controllers';

const resolvers: Resolvers = {
Expand Down
2 changes: 1 addition & 1 deletion apps/api/gql/resolvers/sor.resolvers.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Resolvers } from '../../../../schema';
import { Resolvers } from '../generated-schema';
import { sorService } from '../../../../modules/sor/sor.service';
import { headerChain } from '../../../../modules/context/header-chain';
import { GraphQLError } from 'graphql';
Expand Down
2 changes: 1 addition & 1 deletion apps/api/gql/resolvers/sts.resolvers.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Resolvers } from '../../../../schema';
import { Resolvers } from '../generated-schema';
import { StakedSonicController } from '../../../../modules/controllers';

const resolvers: Resolvers = {
Expand Down
2 changes: 1 addition & 1 deletion apps/api/gql/resolvers/token.resolvers.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { GqlChain, GqlHistoricalTokenPrice, Resolvers } from '../../../../schema';
import { GqlChain, GqlHistoricalTokenPrice, Resolvers } from '../generated-schema';
import _ from 'lodash';
import { isAdminRoute } from '../../../../modules/auth/auth-context';
import { tokenService } from '../../../../modules/token/token.service';
Expand Down
2 changes: 1 addition & 1 deletion apps/api/gql/resolvers/user.resolvers.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Resolvers } from '../../../../schema';
import { Resolvers } from '../generated-schema';
import { userService } from '../../../../modules/user/user.service';
import { getRequiredAccountAddress, isAdminRoute } from '../../../../modules/auth/auth-context';
import { tokenService } from '../../../../modules/token/token.service';
Expand Down
2 changes: 1 addition & 1 deletion apps/api/gql/resolvers/vebal.resolvers.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Resolvers } from '../../../../schema';
import { Resolvers } from '../generated-schema';
import { getRequiredAccountAddress, isAdminRoute } from '../../../../modules/auth/auth-context';
import { veBalService } from '../../../../modules/vebal/vebal.service';
import { veBalVotingListService } from '../../../../modules/vebal/vebal-voting-list.service';
Expand Down
2 changes: 1 addition & 1 deletion apps/api/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { corsMiddleware, lowerCaseMiddleware, sessionMiddleware } from './middle
import { ApolloServerPluginDrainHttpServer } from '@apollo/server/plugin/drainHttpServer';
import { ApolloServerPluginUsageReporting } from '@apollo/server/plugin/usageReporting';
import { ApolloServerPluginLandingPageLocalDefault } from '@apollo/server/plugin/landingPage/default';
import { schema } from '../../graphql_schema_generated';
import { schema } from './gql/generated-schema-ast';
import { resolvers } from './gql/resolvers';
import { ResolverContext, resolverContext } from './gql/resolver-context';
import { apolloSentryPlugin } from './apollo/sentry-plugin';
Expand Down
6 changes: 3 additions & 3 deletions codegen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,20 +121,20 @@ const files = {
},
},
},
['graphql_schema_generated.ts']: {
['apps/api/gql/generated-schema-ast.ts']: {
schema: './apps/api/gql/schema/*.gql',
plugins: [
{
add: {
content:
"import { gql } from 'apollo-server-express';\nexport const schema = gql`\n#\n# THIS FILE IS AUTOGENERATED — DO NOT EDIT IT\n#\n",
"import { gql } from 'graphql-request';\nexport const schema = gql`\n#\n# THIS FILE IS AUTOGENERATED — DO NOT EDIT IT\n#\n",
},
},
'schema-ast',
{ add: { content: '`;', placement: 'append' } },
],
},
['schema.ts']: {
['apps/api/gql/generated-schema.ts']: {
schema: './apps/api/gql/schema/*.gql',
plugins: [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ export type VaultSchemaHistoricApRsArgs = {
};

export type AllPoolsQueryVariables = Exact<{
chainIds?: Maybe<Array<Scalars['Int']> | Scalars['Int']>;
chainIds?: InputMaybe<Array<Scalars['Int']> | Scalars['Int']>;
}>;

export type AllPoolsQuery = {
Expand All @@ -427,7 +427,7 @@ export type PoolSchemaFragment = {
};

export type AccountsQueryVariables = Exact<{
ids?: Maybe<Array<Scalars['String']> | Scalars['String']>;
ids?: InputMaybe<Array<Scalars['String']> | Scalars['String']>;
}>;

export type AccountsQuery = {
Expand Down Expand Up @@ -515,9 +515,10 @@ export const AccountsDocument = gql`
export type SdkFunctionWrapper = <T>(
action: (requestHeaders?: Record<string, string>) => Promise<T>,
operationName: string,
operationType?: string,
) => Promise<T>;

const defaultWrapper: SdkFunctionWrapper = (action, _operationName) => action();
const defaultWrapper: SdkFunctionWrapper = (action, _operationName, _operationType) => action();

export function getSdk(client: GraphQLClient, withWrapper: SdkFunctionWrapper = defaultWrapper) {
return {
Expand All @@ -532,6 +533,7 @@ export function getSdk(client: GraphQLClient, withWrapper: SdkFunctionWrapper =
...wrappedRequestHeaders,
}),
'allPools',
'query',
);
},
accounts(
Expand All @@ -545,6 +547,7 @@ export function getSdk(client: GraphQLClient, withWrapper: SdkFunctionWrapper =
...wrappedRequestHeaders,
}),
'accounts',
'query',
);
},
};
Expand Down
26 changes: 14 additions & 12 deletions modules/sources/subgraphs/balancer-v3-pools/generated/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -514,25 +514,25 @@ export type FactoryFragment = {
id: string;
type: PoolType;
version: number;
pools?: Array<{ __typename?: 'Pool'; id: string; address: string }> | null | undefined;
pools?: Array<{ __typename?: 'Pool'; id: string; address: string }> | null;
};

export type TypePoolFragment = {
__typename?: 'Pool';
id: string;
address: string;
factory: { __typename?: 'Factory'; id: string; type: PoolType; version: number };
stableParams?: { __typename?: 'StableParams'; amp: string } | null | undefined;
weightedParams?: { __typename?: 'WeightedParams'; weights: Array<string> } | null | undefined;
stableParams?: { __typename?: 'StableParams'; amp: string } | null;
weightedParams?: { __typename?: 'WeightedParams'; weights: Array<string> } | null;
};

export type PoolsQueryVariables = Exact<{
skip?: Maybe<Scalars['Int']>;
first?: Maybe<Scalars['Int']>;
orderBy?: Maybe<Pool_OrderBy>;
orderDirection?: Maybe<OrderDirection>;
where?: Maybe<Pool_Filter>;
block?: Maybe<Block_Height>;
skip?: InputMaybe<Scalars['Int']>;
first?: InputMaybe<Scalars['Int']>;
orderBy?: InputMaybe<Pool_OrderBy>;
orderDirection?: InputMaybe<OrderDirection>;
where?: InputMaybe<Pool_Filter>;
block?: InputMaybe<Block_Height>;
}>;

export type PoolsQuery = {
Expand All @@ -542,8 +542,8 @@ export type PoolsQuery = {
id: string;
address: string;
factory: { __typename?: 'Factory'; id: string; type: PoolType; version: number };
stableParams?: { __typename?: 'StableParams'; amp: string } | null | undefined;
weightedParams?: { __typename?: 'WeightedParams'; weights: Array<string> } | null | undefined;
stableParams?: { __typename?: 'StableParams'; amp: string } | null;
weightedParams?: { __typename?: 'WeightedParams'; weights: Array<string> } | null;
}>;
};

Expand Down Expand Up @@ -601,9 +601,10 @@ export const PoolsDocument = gql`
export type SdkFunctionWrapper = <T>(
action: (requestHeaders?: Record<string, string>) => Promise<T>,
operationName: string,
operationType?: string,
) => Promise<T>;

const defaultWrapper: SdkFunctionWrapper = (action, _operationName) => action();
const defaultWrapper: SdkFunctionWrapper = (action, _operationName, _operationType) => action();

export function getSdk(client: GraphQLClient, withWrapper: SdkFunctionWrapper = defaultWrapper) {
return {
Expand All @@ -615,6 +616,7 @@ export function getSdk(client: GraphQLClient, withWrapper: SdkFunctionWrapper =
...wrappedRequestHeaders,
}),
'Pools',
'query',
);
},
};
Expand Down
Loading

0 comments on commit 2064cd2

Please sign in to comment.