diff --git a/package-lock.json b/package-lock.json index 4dc2d6a..facfab6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,7 +13,8 @@ "packages/integrations/gei-users", "packages/integrations/gei-s3", "packages/integrations/gei-stripe", - "packages/integrations/gei-crud" + "packages/integrations/gei-crud", + "packages/integrations/gei-basic" ], "dependencies": { "@types/jest": "^27.4.1", @@ -4586,6 +4587,10 @@ "node": ">=12" } }, + "node_modules/gei-basic": { + "resolved": "packages/integrations/gei-basic", + "link": true + }, "node_modules/gei-crud": { "resolved": "packages/integrations/gei-crud", "link": true @@ -10027,8 +10032,102 @@ "node": ">= 10" } }, + "packages/integrations/gei-basic": { + "version": "0.1.0", + "license": "ISC", + "dependencies": { + "graphql-editor-cli": "^0.7.6", + "node-fetch": "^3.2.10", + "stucco-js": "^0.10.18", + "ws": "^8.12.0" + }, + "devDependencies": { + "@types/node": "^18.7.18", + "@types/node-fetch": "^2.6.2", + "@types/ws": "^8.5.4", + "@typescript-eslint/eslint-plugin": "^5.38.0", + "@typescript-eslint/parser": "^5.38.0", + "eslint": "^8.23.1", + "eslint-config-prettier": "^8.5.0", + "eslint-plugin-prettier": "^4.2.1", + "prettier": "^2.7.1", + "ts-node": "^10.9.1", + "typescript": "^4.8.3" + } + }, + "packages/integrations/gei-basic/node_modules/chalk": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.3.0.tgz", + "integrity": "sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w==", + "engines": { + "node": "^12.17.0 || ^14.13 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "packages/integrations/gei-basic/node_modules/graphql-editor-cli": { + "version": "0.7.9", + "resolved": "https://registry.npmjs.org/graphql-editor-cli/-/graphql-editor-cli-0.7.9.tgz", + "integrity": "sha512-Jix+MTurv1PRJXuC/tvRkRkpfude7WNbLpuLrlzzvfricCSezvdhtuad8UO92QqnUPupveu2KKB9kndzXb4kcQ==", + "dependencies": { + "adm-zip": "^0.5.9", + "archiver": "^5.3.1", + "chalk": "^5.0.1", + "clipboardy": "^3.0.0", + "conf": "^10.2.0", + "dotenv": "^16.0.3", + "execa": "^6.1.0", + "express": "^4.18.1", + "fast-glob": "^3.2.12", + "figures": "^5.0.0", + "graphql-js-tree": "^0.1.7", + "graphql-zeus": "^5.2.8", + "graphql-zeus-core": "^5.2.8", + "inquirer": "^9.1.2", + "mime": "^3.0.0", + "node-fetch": "^3.2.10", + "open": "^8.4.0", + "ora": "^6.1.2", + "picocolors": "^1.0.0", + "pkg-install": "^1.0.0", + "pusher-js": "^7.4.0", + "qs": "^6.11.0", + "run-async": "^2.4.1", + "stucco-js": "^0.10.17", + "ts-node": "^10.9.1", + "yargs": "^17.5.1" + }, + "bin": { + "gecli": "lib/index.js", + "graphql-editor-cli": "lib/index.js" + }, + "peerDependencies": { + "typescript": "^4.8.3" + } + }, + "packages/integrations/gei-basic/node_modules/ws": { + "version": "8.13.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.13.0.tgz", + "integrity": "sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA==", + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, "packages/integrations/gei-crud": { - "version": "0.7.2", + "version": "0.8.4", "license": "ISC", "dependencies": { "graphql-editor-cli": "^0.8.6", @@ -10398,7 +10497,7 @@ } }, "packages/integrations/gei-stripe": { - "version": "0.3.0", + "version": "0.4.6", "license": "ISC", "dependencies": { "@azure/functions": "^3.5.0", @@ -10452,7 +10551,7 @@ } }, "packages/integrations/gei-users": { - "version": "0.7.1", + "version": "0.7.7", "license": "ISC", "dependencies": { "@azure/functions": "^3.5.0", diff --git a/packages/integrations/gei-basic/package.json b/packages/integrations/gei-basic/package.json index 439ed8a..cf2f888 100644 --- a/packages/integrations/gei-basic/package.json +++ b/packages/integrations/gei-basic/package.json @@ -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", diff --git a/packages/integrations/gei-basic/schema.graphql b/packages/integrations/gei-basic/schema.graphql index bd55cb3..4d604e2 100644 --- a/packages/integrations/gei-basic/schema.graphql +++ b/packages/integrations/gei-basic/schema.graphql @@ -3,4 +3,5 @@ type Query{ pipe: Query passSource: Query + passSourceWithArgs: Query } diff --git a/packages/integrations/gei-basic/src/Query/passSourceWithArgs.ts b/packages/integrations/gei-basic/src/Query/passSourceWithArgs.ts new file mode 100644 index 0000000..37ace02 --- /dev/null +++ b/packages/integrations/gei-basic/src/Query/passSourceWithArgs.ts @@ -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); diff --git a/packages/integrations/gei-basic/src/index.ts b/packages/integrations/gei-basic/src/index.ts index 15d71f6..b9da41d 100644 --- a/packages/integrations/gei-basic/src/index.ts +++ b/packages/integrations/gei-basic/src/index.ts @@ -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: { @@ -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, + }, }, }); diff --git a/packages/integrations/gei-basic/src/integration.ts b/packages/integrations/gei-basic/src/integration.ts index 8c5f8b6..a2acb3d 100644 --- a/packages/integrations/gei-basic/src/integration.ts +++ b/packages/integrations/gei-basic/src/integration.ts @@ -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; diff --git a/packages/integrations/gei-basic/src/zeus/const.ts b/packages/integrations/gei-basic/src/zeus/const.ts index 6d5ec29..6f9287d 100644 --- a/packages/integrations/gei-basic/src/zeus/const.ts +++ b/packages/integrations/gei-basic/src/zeus/const.ts @@ -1,16 +1,15 @@ /* eslint-disable */ -export const AllTypesProps: Record = { +export const AllTypesProps: Record = {}; -} - -export const ReturnTypes: Record = { - Query:{ - pipe:"Query", - passSource:"Query" - } -} +export const ReturnTypes: Record = { + Query: { + pipe: 'Query', + passSource: 'Query', + passSourceWithArgs: 'Query', + }, +}; export const Ops = { -query: "Query" as const -} \ No newline at end of file + query: 'Query' as const, +}; diff --git a/packages/integrations/gei-basic/src/zeus/index.ts b/packages/integrations/gei-basic/src/zeus/index.ts index be3e052..992b610 100644 --- a/packages/integrations/gei-basic/src/zeus/index.ts +++ b/packages/integrations/gei-basic/src/zeus/index.ts @@ -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); @@ -405,7 +403,7 @@ export class GraphQLError extends Error { return 'GraphQL Response Error'; } } -export type GenericOperation = O extends keyof typeof Ops ? typeof Ops[O] : never; +export type GenericOperation = O extends keyof typeof Ops ? (typeof Ops)[O] : never; export type ThunderGraphQLOptions = { scalars?: SCLR | ScalarCoders; }; @@ -827,41 +825,43 @@ export const GRAPHQL_TYPE_SEPARATOR = `__$GRAPHQL__`; export const $ = (name: Name, graphqlType: Type) => { return (START_VAR_NAME + name + GRAPHQL_TYPE_SEPARATOR + graphqlType) as unknown as Variable; }; -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 = {} \ No newline at end of file +type ZEUS_VARIABLES = {}; diff --git a/packages/integrations/gei-basic/stucco.json b/packages/integrations/gei-basic/stucco.json index 296257a..bbc0e89 100644 --- a/packages/integrations/gei-basic/stucco.json +++ b/packages/integrations/gei-basic/stucco.json @@ -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" + } } -} \ No newline at end of file + } +} diff --git a/packages/integrations/gei-basic/tsconfig.json b/packages/integrations/gei-basic/tsconfig.json index 6014bd9..6c74814 100644 --- a/packages/integrations/gei-basic/tsconfig.json +++ b/packages/integrations/gei-basic/tsconfig.json @@ -1,20 +1,17 @@ { - "compilerOptions": { - "skipLibCheck": true, - "moduleResolution": "node", - "target": "es2020", - "module": "es2020", - "declaration": true, - "outDir": "./lib", - "rootDir": "./src", - "strict": true, - "strictNullChecks": true, - "esModuleInterop": true - }, - "include": [ - "./src/**/*" - ], - "exclude": [ - "node_modules" - ] -} \ No newline at end of file + "compilerOptions": { + "skipLibCheck": true, + "moduleResolution": "node", + "target": "ESNext", + "module": "ESNext", + "declaration": true, + "outDir": "lib", + "rootDir": "src", + "strict": true, + "strictNullChecks": true, + "composite": true, + "esModuleInterop": true + }, + "include": ["src/**/*"], + "exclude": ["node_modules"] +}