Skip to content

Commit

Permalink
FixPathAndAddPassSourceWithArgs
Browse files Browse the repository at this point in the history
  • Loading branch information
pavelbrui committed Aug 28, 2023
1 parent ca54425 commit 92a7892
Show file tree
Hide file tree
Showing 10 changed files with 209 additions and 85 deletions.
107 changes: 103 additions & 4 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion packages/integrations/gei-basic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "gei-basic",
"version": "0.1.0",
"description": "Automatically generated by graphql-editor-cli",
"main": "index.js",
"main": "lib/index.js",
"scripts": {
"start": "gecli dev",
"build": "tsc",
Expand Down
1 change: 1 addition & 0 deletions packages/integrations/gei-basic/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
type Query{
pipe: Query
passSource: Query
passSourceWithArgs: Query
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { FieldResolveInput } from 'stucco-js';
import { resolverFor } from '../zeus/index.js';

export const handler = async (input: FieldResolveInput) =>
resolverFor('Query', 'passSourceWithArgs', async (args, src) => {
return { ...args, ...src };
})(input.arguments, input.source);
6 changes: 6 additions & 0 deletions packages/integrations/gei-basic/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { NewIntegration } from 'graphql-editor-cli';

import { handler as pipe } from './Query/pipe.js';
import { handler as passSource } from './Query/passSource.js';
import { handler as passSourceWithArgs } from './Query/passSourceWithArgs.js';

export const integration = NewIntegration({
Query: {
Expand All @@ -15,6 +16,11 @@ export const integration = NewIntegration({
description: 'Pass the resolver and go furhter. Pass the source to the next resolver',
handler: passSource,
},
passSourceWithArgs: {
name: 'Pass the source resolver',
description: 'Pass the resolver and go furhter. Pass the source and arguments to the next resolver',
handler: passSourceWithArgs,
},
},
});

Expand Down
8 changes: 8 additions & 0 deletions packages/integrations/gei-basic/src/integration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@ const integration: IntegrationSpecification = {
name: 'lib/Query/passSource',
},
},
['Query.passSourceWithArgs']: {
data: {},
description: 'Pass the resolver and go furhter. Pass the source and arguments to the next resolver',
name: 'Pass the source and arguments resolver',
resolve: {
name: 'lib/Query/passSource',
},
},
};

export default integration;
21 changes: 10 additions & 11 deletions packages/integrations/gei-basic/src/zeus/const.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
/* eslint-disable */

export const AllTypesProps: Record<string,any> = {
export const AllTypesProps: Record<string, any> = {};

}

export const ReturnTypes: Record<string,any> = {
Query:{
pipe:"Query",
passSource:"Query"
}
}
export const ReturnTypes: Record<string, any> = {
Query: {
pipe: 'Query',
passSource: 'Query',
passSourceWithArgs: 'Query',
},
};

export const Ops = {
query: "Query" as const
}
query: 'Query' as const,
};
68 changes: 34 additions & 34 deletions packages/integrations/gei-basic/src/zeus/index.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
/* eslint-disable */


import { AllTypesProps, ReturnTypes, Ops } from './const.js';
import fetch, { Response } from 'node-fetch';
import WebSocket from 'ws';
export const HOST = "http://localhost:8080/"

export const HOST = 'http://localhost:8080/';

export const HEADERS = {}
export const HEADERS = {};
export const apiSubscription = (options: chainOptions) => (query: string) => {
try {
const queryString = options[0] + '?query=' + encodeURIComponent(query);
Expand Down Expand Up @@ -405,7 +403,7 @@ export class GraphQLError extends Error {
return 'GraphQL Response Error';
}
}
export type GenericOperation<O> = O extends keyof typeof Ops ? typeof Ops[O] : never;
export type GenericOperation<O> = O extends keyof typeof Ops ? (typeof Ops)[O] : never;
export type ThunderGraphQLOptions<SCLR extends ScalarDefinition> = {
scalars?: SCLR | ScalarCoders;
};
Expand Down Expand Up @@ -827,41 +825,43 @@ export const GRAPHQL_TYPE_SEPARATOR = `__$GRAPHQL__`;
export const $ = <Type extends GraphQLVariableType, Name extends string>(name: Name, graphqlType: Type) => {
return (START_VAR_NAME + name + GRAPHQL_TYPE_SEPARATOR + graphqlType) as unknown as Variable<Type, Name>;
};
type ZEUS_INTERFACES = never
export type ScalarCoders = {
}
type ZEUS_UNIONS = never
type ZEUS_INTERFACES = never;
export type ScalarCoders = {};
type ZEUS_UNIONS = never;

export type ValueTypes = {
["Query"]: AliasType<{
pipe?:ValueTypes["Query"],
passSource?:ValueTypes["Query"],
__typename?: boolean | `@${string}`
}>
}
['Query']: AliasType<{
pipe?: ValueTypes['Query'];
passSource?: ValueTypes['Query'];
passSourceWithArgs?: ValueTypes['Query'];
__typename?: boolean | `@${string}`;
}>;
};

export type ResolverInputTypes = {
["Query"]: AliasType<{
pipe?:ResolverInputTypes["Query"],
passSource?:ResolverInputTypes["Query"],
__typename?: boolean | `@${string}`
}>
}
['Query']: AliasType<{
pipe?: ResolverInputTypes['Query'];
passSource?: ResolverInputTypes['Query'];
passSourceWithArgs?: ResolverInputTypes['Query'];
__typename?: boolean | `@${string}`;
}>;
};

export type ModelTypes = {
["Query"]: {
pipe?: ModelTypes["Query"] | undefined,
passSource?: ModelTypes["Query"] | undefined
}
}
['Query']: {
pipe?: ModelTypes['Query'] | undefined;
passSource?: ModelTypes['Query'] | undefined;
passSourceWithArgs?: ModelTypes['Query'] | undefined;
};
};

export type GraphQLTypes = {
["Query"]: {
__typename: "Query",
pipe?: GraphQLTypes["Query"] | undefined,
passSource?: GraphQLTypes["Query"] | undefined
}
}

['Query']: {
__typename: 'Query';
pipe?: GraphQLTypes['Query'] | undefined;
passSourceWithArgs?: GraphQLTypes['Query'] | undefined;
passSource?: ModelTypes['Query'] | undefined;
};
};

type ZEUS_VARIABLES = {}
type ZEUS_VARIABLES = {};
39 changes: 23 additions & 16 deletions packages/integrations/gei-basic/stucco.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,25 @@
{
"resolvers": {
"Query.pipe": {
"name": "Pipe resolver",
"description": "Pass the resolver and go furhter",
"resolve": {
"name": "Query.pipe.handler"
}
},
"Query.passSource": {
"name": "Pass the source resolver",
"description": "Pass the resolver and go furhter. Pass the source to the next resolver",
"resolve": {
"name": "Query.passSource.handler"
}
}
"resolvers": {
"Query.pipe": {
"name": "Pipe resolver",
"description": "Pass the resolver and go furhter",
"resolve": {
"name": "Query.pipe.handler"
}
},
"Query.passSource": {
"name": "Pass the source resolver",
"description": "Pass the resolver and go furhter. Pass the source to the next resolver",
"resolve": {
"name": "Query.passSource.handler"
}
},
"Query.passSourceWithArgs": {
"name": "Pass the source resolver",
"description": "Pass the resolver and go furhter. Pass the source and arguments to the next resolver",
"resolve": {
"name": "Query.passSourceWithArgs.handler"
}
}
}
}
}
Loading

0 comments on commit 92a7892

Please sign in to comment.