Skip to content

Commit 92a7892

Browse files
committed
FixPathAndAddPassSourceWithArgs
1 parent ca54425 commit 92a7892

File tree

10 files changed

+209
-85
lines changed

10 files changed

+209
-85
lines changed

package-lock.json

Lines changed: 103 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/integrations/gei-basic/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "gei-basic",
33
"version": "0.1.0",
44
"description": "Automatically generated by graphql-editor-cli",
5-
"main": "index.js",
5+
"main": "lib/index.js",
66
"scripts": {
77
"start": "gecli dev",
88
"build": "tsc",

packages/integrations/gei-basic/schema.graphql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@
33
type Query{
44
pipe: Query
55
passSource: Query
6+
passSourceWithArgs: Query
67
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { FieldResolveInput } from 'stucco-js';
2+
import { resolverFor } from '../zeus/index.js';
3+
4+
export const handler = async (input: FieldResolveInput) =>
5+
resolverFor('Query', 'passSourceWithArgs', async (args, src) => {
6+
return { ...args, ...src };
7+
})(input.arguments, input.source);

packages/integrations/gei-basic/src/index.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { NewIntegration } from 'graphql-editor-cli';
22

33
import { handler as pipe } from './Query/pipe.js';
44
import { handler as passSource } from './Query/passSource.js';
5+
import { handler as passSourceWithArgs } from './Query/passSourceWithArgs.js';
56

67
export const integration = NewIntegration({
78
Query: {
@@ -15,6 +16,11 @@ export const integration = NewIntegration({
1516
description: 'Pass the resolver and go furhter. Pass the source to the next resolver',
1617
handler: passSource,
1718
},
19+
passSourceWithArgs: {
20+
name: 'Pass the source resolver',
21+
description: 'Pass the resolver and go furhter. Pass the source and arguments to the next resolver',
22+
handler: passSourceWithArgs,
23+
},
1824
},
1925
});
2026

packages/integrations/gei-basic/src/integration.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,14 @@ const integration: IntegrationSpecification = {
3232
name: 'lib/Query/passSource',
3333
},
3434
},
35+
['Query.passSourceWithArgs']: {
36+
data: {},
37+
description: 'Pass the resolver and go furhter. Pass the source and arguments to the next resolver',
38+
name: 'Pass the source and arguments resolver',
39+
resolve: {
40+
name: 'lib/Query/passSource',
41+
},
42+
},
3543
};
3644

3745
export default integration;
Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
/* eslint-disable */
22

3-
export const AllTypesProps: Record<string,any> = {
3+
export const AllTypesProps: Record<string, any> = {};
44

5-
}
6-
7-
export const ReturnTypes: Record<string,any> = {
8-
Query:{
9-
pipe:"Query",
10-
passSource:"Query"
11-
}
12-
}
5+
export const ReturnTypes: Record<string, any> = {
6+
Query: {
7+
pipe: 'Query',
8+
passSource: 'Query',
9+
passSourceWithArgs: 'Query',
10+
},
11+
};
1312

1413
export const Ops = {
15-
query: "Query" as const
16-
}
14+
query: 'Query' as const,
15+
};

packages/integrations/gei-basic/src/zeus/index.ts

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
/* eslint-disable */
22

3-
43
import { AllTypesProps, ReturnTypes, Ops } from './const.js';
54
import fetch, { Response } from 'node-fetch';
65
import WebSocket from 'ws';
7-
export const HOST = "http://localhost:8080/"
8-
6+
export const HOST = 'http://localhost:8080/';
97

10-
export const HEADERS = {}
8+
export const HEADERS = {};
119
export const apiSubscription = (options: chainOptions) => (query: string) => {
1210
try {
1311
const queryString = options[0] + '?query=' + encodeURIComponent(query);
@@ -405,7 +403,7 @@ export class GraphQLError extends Error {
405403
return 'GraphQL Response Error';
406404
}
407405
}
408-
export type GenericOperation<O> = O extends keyof typeof Ops ? typeof Ops[O] : never;
406+
export type GenericOperation<O> = O extends keyof typeof Ops ? (typeof Ops)[O] : never;
409407
export type ThunderGraphQLOptions<SCLR extends ScalarDefinition> = {
410408
scalars?: SCLR | ScalarCoders;
411409
};
@@ -827,41 +825,43 @@ export const GRAPHQL_TYPE_SEPARATOR = `__$GRAPHQL__`;
827825
export const $ = <Type extends GraphQLVariableType, Name extends string>(name: Name, graphqlType: Type) => {
828826
return (START_VAR_NAME + name + GRAPHQL_TYPE_SEPARATOR + graphqlType) as unknown as Variable<Type, Name>;
829827
};
830-
type ZEUS_INTERFACES = never
831-
export type ScalarCoders = {
832-
}
833-
type ZEUS_UNIONS = never
828+
type ZEUS_INTERFACES = never;
829+
export type ScalarCoders = {};
830+
type ZEUS_UNIONS = never;
834831

835832
export type ValueTypes = {
836-
["Query"]: AliasType<{
837-
pipe?:ValueTypes["Query"],
838-
passSource?:ValueTypes["Query"],
839-
__typename?: boolean | `@${string}`
840-
}>
841-
}
833+
['Query']: AliasType<{
834+
pipe?: ValueTypes['Query'];
835+
passSource?: ValueTypes['Query'];
836+
passSourceWithArgs?: ValueTypes['Query'];
837+
__typename?: boolean | `@${string}`;
838+
}>;
839+
};
842840

843841
export type ResolverInputTypes = {
844-
["Query"]: AliasType<{
845-
pipe?:ResolverInputTypes["Query"],
846-
passSource?:ResolverInputTypes["Query"],
847-
__typename?: boolean | `@${string}`
848-
}>
849-
}
842+
['Query']: AliasType<{
843+
pipe?: ResolverInputTypes['Query'];
844+
passSource?: ResolverInputTypes['Query'];
845+
passSourceWithArgs?: ResolverInputTypes['Query'];
846+
__typename?: boolean | `@${string}`;
847+
}>;
848+
};
850849

851850
export type ModelTypes = {
852-
["Query"]: {
853-
pipe?: ModelTypes["Query"] | undefined,
854-
passSource?: ModelTypes["Query"] | undefined
855-
}
856-
}
851+
['Query']: {
852+
pipe?: ModelTypes['Query'] | undefined;
853+
passSource?: ModelTypes['Query'] | undefined;
854+
passSourceWithArgs?: ModelTypes['Query'] | undefined;
855+
};
856+
};
857857

858858
export type GraphQLTypes = {
859-
["Query"]: {
860-
__typename: "Query",
861-
pipe?: GraphQLTypes["Query"] | undefined,
862-
passSource?: GraphQLTypes["Query"] | undefined
863-
}
864-
}
865-
859+
['Query']: {
860+
__typename: 'Query';
861+
pipe?: GraphQLTypes['Query'] | undefined;
862+
passSourceWithArgs?: GraphQLTypes['Query'] | undefined;
863+
passSource?: ModelTypes['Query'] | undefined;
864+
};
865+
};
866866

867-
type ZEUS_VARIABLES = {}
867+
type ZEUS_VARIABLES = {};
Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,25 @@
11
{
2-
"resolvers": {
3-
"Query.pipe": {
4-
"name": "Pipe resolver",
5-
"description": "Pass the resolver and go furhter",
6-
"resolve": {
7-
"name": "Query.pipe.handler"
8-
}
9-
},
10-
"Query.passSource": {
11-
"name": "Pass the source resolver",
12-
"description": "Pass the resolver and go furhter. Pass the source to the next resolver",
13-
"resolve": {
14-
"name": "Query.passSource.handler"
15-
}
16-
}
2+
"resolvers": {
3+
"Query.pipe": {
4+
"name": "Pipe resolver",
5+
"description": "Pass the resolver and go furhter",
6+
"resolve": {
7+
"name": "Query.pipe.handler"
8+
}
9+
},
10+
"Query.passSource": {
11+
"name": "Pass the source resolver",
12+
"description": "Pass the resolver and go furhter. Pass the source to the next resolver",
13+
"resolve": {
14+
"name": "Query.passSource.handler"
15+
}
16+
},
17+
"Query.passSourceWithArgs": {
18+
"name": "Pass the source resolver",
19+
"description": "Pass the resolver and go furhter. Pass the source and arguments to the next resolver",
20+
"resolve": {
21+
"name": "Query.passSourceWithArgs.handler"
22+
}
1723
}
18-
}
24+
}
25+
}

0 commit comments

Comments
 (0)