-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
431 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { CreateApp } from '@graphql-ez/nuxt'; | ||
import { ezCodegen } from '@graphql-ez/plugin-codegen'; | ||
import { ezSchema, gql } from '@graphql-ez/plugin-schema'; | ||
|
||
const { buildApp } = CreateApp({ | ||
ez: { | ||
plugins: [ | ||
ezSchema({ | ||
schema: { | ||
typeDefs: gql` | ||
type Query { | ||
hello: String! | ||
} | ||
`, | ||
resolvers: { | ||
Query: { | ||
hello() { | ||
return 'Hello World!'; | ||
}, | ||
}, | ||
}, | ||
}, | ||
}), | ||
ezCodegen(), | ||
], | ||
}, | ||
}); | ||
|
||
const { apiHandler } = buildApp(); | ||
|
||
export default apiHandler; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
import type { GraphQLResolveInfo } from 'graphql'; | ||
import type { EZContext } from 'graphql-ez'; | ||
export type Maybe<T> = T | null; | ||
export type Exact<T extends { [key: string]: unknown }> = { [K in keyof T]: T[K] }; | ||
export type MakeOptional<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]?: Maybe<T[SubKey]> }; | ||
export type MakeMaybe<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]: Maybe<T[SubKey]> }; | ||
export type ResolverFn<TResult, TParent, TContext, TArgs> = ( | ||
parent: TParent, | ||
args: TArgs, | ||
context: TContext, | ||
info: GraphQLResolveInfo | ||
) => Promise<import('graphql-ez').DeepPartial<TResult>> | import('graphql-ez').DeepPartial<TResult>; | ||
/** All built-in and custom scalars, mapped to their actual values */ | ||
export type Scalars = { | ||
ID: string; | ||
String: string; | ||
Boolean: boolean; | ||
Int: number; | ||
Float: number; | ||
}; | ||
|
||
export type Query = { | ||
__typename?: 'Query'; | ||
hello: Scalars['String']; | ||
}; | ||
|
||
export type ResolverTypeWrapper<T> = Promise<T> | T; | ||
|
||
export type ResolverWithResolve<TResult, TParent, TContext, TArgs> = { | ||
resolve: ResolverFn<TResult, TParent, TContext, TArgs>; | ||
}; | ||
export type Resolver<TResult, TParent = {}, TContext = {}, TArgs = {}> = | ||
| ResolverFn<TResult, TParent, TContext, TArgs> | ||
| ResolverWithResolve<TResult, TParent, TContext, TArgs>; | ||
|
||
export type SubscriptionSubscribeFn<TResult, TParent, TContext, TArgs> = ( | ||
parent: TParent, | ||
args: TArgs, | ||
context: TContext, | ||
info: GraphQLResolveInfo | ||
) => AsyncIterator<TResult> | Promise<AsyncIterator<TResult>>; | ||
|
||
export type SubscriptionResolveFn<TResult, TParent, TContext, TArgs> = ( | ||
parent: TParent, | ||
args: TArgs, | ||
context: TContext, | ||
info: GraphQLResolveInfo | ||
) => TResult | Promise<TResult>; | ||
|
||
export interface SubscriptionSubscriberObject<TResult, TKey extends string, TParent, TContext, TArgs> { | ||
subscribe: SubscriptionSubscribeFn<{ [key in TKey]: TResult }, TParent, TContext, TArgs>; | ||
resolve?: SubscriptionResolveFn<TResult, { [key in TKey]: TResult }, TContext, TArgs>; | ||
} | ||
|
||
export interface SubscriptionResolverObject<TResult, TParent, TContext, TArgs> { | ||
subscribe: SubscriptionSubscribeFn<any, TParent, TContext, TArgs>; | ||
resolve: SubscriptionResolveFn<TResult, any, TContext, TArgs>; | ||
} | ||
|
||
export type SubscriptionObject<TResult, TKey extends string, TParent, TContext, TArgs> = | ||
| SubscriptionSubscriberObject<TResult, TKey, TParent, TContext, TArgs> | ||
| SubscriptionResolverObject<TResult, TParent, TContext, TArgs>; | ||
|
||
export type SubscriptionResolver<TResult, TKey extends string, TParent = {}, TContext = {}, TArgs = {}> = | ||
| ((...args: any[]) => SubscriptionObject<TResult, TKey, TParent, TContext, TArgs>) | ||
| SubscriptionObject<TResult, TKey, TParent, TContext, TArgs>; | ||
|
||
export type TypeResolveFn<TTypes, TParent = {}, TContext = {}> = ( | ||
parent: TParent, | ||
context: TContext, | ||
info: GraphQLResolveInfo | ||
) => Maybe<TTypes> | Promise<Maybe<TTypes>>; | ||
|
||
export type IsTypeOfResolverFn<T = {}, TContext = {}> = ( | ||
obj: T, | ||
context: TContext, | ||
info: GraphQLResolveInfo | ||
) => boolean | Promise<boolean>; | ||
|
||
export type NextResolverFn<T> = () => Promise<T>; | ||
|
||
export type DirectiveResolverFn<TResult = {}, TParent = {}, TContext = {}, TArgs = {}> = ( | ||
next: NextResolverFn<TResult>, | ||
parent: TParent, | ||
args: TArgs, | ||
context: TContext, | ||
info: GraphQLResolveInfo | ||
) => TResult | Promise<TResult>; | ||
|
||
/** Mapping between all available schema types and the resolvers types */ | ||
export type ResolversTypes = { | ||
Query: ResolverTypeWrapper<{}>; | ||
String: ResolverTypeWrapper<Scalars['String']>; | ||
Boolean: ResolverTypeWrapper<Scalars['Boolean']>; | ||
Int: ResolverTypeWrapper<Scalars['Int']>; | ||
}; | ||
|
||
/** Mapping between all available schema types and the resolvers parents */ | ||
export type ResolversParentTypes = { | ||
Query: {}; | ||
String: Scalars['String']; | ||
Boolean: Scalars['Boolean']; | ||
Int: Scalars['Int']; | ||
}; | ||
|
||
export type QueryResolvers< | ||
ContextType = EZContext, | ||
ParentType extends ResolversParentTypes['Query'] = ResolversParentTypes['Query'] | ||
> = { | ||
hello?: Resolver<ResolversTypes['String'], ParentType, ContextType>; | ||
}; | ||
|
||
export type Resolvers<ContextType = EZContext> = { | ||
Query?: QueryResolvers<ContextType>; | ||
}; | ||
|
||
declare module 'graphql-ez' { | ||
interface EZResolvers extends Resolvers<import('graphql-ez').EZContext> {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
{ | ||
"name": "@graphql-ez/nuxt", | ||
"version": "0.1.0", | ||
"homepage": "https://www.graphql-ez.com", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/PabloSzx/graphql-ez", | ||
"directory": "packages/nuxt" | ||
}, | ||
"license": "MIT", | ||
"author": "PabloSz <[email protected]>", | ||
"sideEffects": false, | ||
"exports": { | ||
".": { | ||
"require": "./dist/index.js", | ||
"import": "./dist/index.mjs" | ||
}, | ||
"./*": { | ||
"require": "./dist/*.js", | ||
"import": "./dist/*.mjs" | ||
} | ||
}, | ||
"main": "dist/index.js", | ||
"module": "dist/index.mjs", | ||
"types": "dist/index.d.ts", | ||
"scripts": { | ||
"dev": "bob-esbuild watch", | ||
"prepack": "bob-esbuild build", | ||
"postpublish": "gh-release" | ||
}, | ||
"dependencies": { | ||
"@graphql-ez/utils": "workspace:^0.1.2", | ||
"h3": "^0.3.3" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^16.11.3", | ||
"changesets-github-release": "^0.0.4", | ||
"graphql": "15.4.0-experimental-stream-defer.1", | ||
"graphql-ez": "workspace:^0.13.2", | ||
"jest": "^27.3.1", | ||
"nuxt3": "^3.0.0-27254511.41ff3b8", | ||
"typescript": "^4.4.4" | ||
}, | ||
"peerDependencies": { | ||
"@types/node": "*", | ||
"graphql": "*", | ||
"graphql-ez": "workspace:^0.13.2", | ||
"nuxt3": "*" | ||
}, | ||
"peerDependenciesMeta": { | ||
"graphql": { | ||
"optional": true | ||
}, | ||
"nuxt3": { | ||
"optional": true | ||
} | ||
}, | ||
"engines": { | ||
"node": "^12.20.0 || >=14.13.0" | ||
}, | ||
"publishConfig": { | ||
"directory": "dist" | ||
} | ||
} |
Oops, something went wrong.