Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 🚸 UPDATE: dep * 🚧 UPDATE: demo 2 * 👌 FIX: lint
- Loading branch information
Showing
20 changed files
with
1,413 additions
and
811 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@kitql/all-in': patch | ||
--- | ||
|
||
update the way @kitql/helper is used in all-in |
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,40 @@ | ||
import { dev } from '$app/environment'; | ||
import { kitqlServer, type IKitQLContext } from '$lib/graphql/kitQLServer'; | ||
import { handleGraphiql } from '@kitql/all-in'; | ||
import { handleGraphql } from '@kitql/all-in'; | ||
import { sequence } from '@sveltejs/kit/hooks'; | ||
|
||
/** | ||
* 1/ With all default options | ||
*/ | ||
export const handle = sequence( | ||
// create the graphql endpoint | ||
handleGraphql<IKitQLContext>(kitqlServer), | ||
|
||
// enable graphiql in dev mode | ||
handleGraphiql({ | ||
enabled: dev | ||
}) | ||
); | ||
|
||
/** | ||
* 2/ With custom options | ||
*/ | ||
// const endpoint = '/graphql' | ||
// const graphiQLPath = '/graphiql' | ||
|
||
// export const handle = sequence( | ||
// // create the graphql endpoint | ||
// handleGraphql<IKitQLContext>({ | ||
// endpoint, | ||
// graphiQLPath, | ||
// ...kitqlServer, | ||
// }), | ||
|
||
// // enable graphiql in dev mode | ||
// handleGraphiql({ | ||
// enabled: dev, | ||
// endpoint, | ||
// graphiQLPath, | ||
// }) | ||
// ) |
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,39 @@ | ||
import type { RequestEvent } from '@sveltejs/kit'; | ||
import { kitQLModules } from '@kitql/all-in'; | ||
import { modules } from './_kitql/_appModules'; | ||
|
||
const plugins = []; | ||
plugins.push(kitQLModules(modules)); | ||
|
||
function getContext({ request }: RequestEvent) { | ||
// get the cookie or the token... | ||
const coolInfo = request.headers.get('Authorization'); | ||
|
||
// get the user from the coolInfo (redis or db) | ||
const user = { id: 1, name: 'John' }; | ||
|
||
return { | ||
request, | ||
user | ||
}; | ||
} | ||
|
||
// Option 1 => explicitly set the context type | ||
// export type IKitQLContext = { | ||
// request: Request | ||
// user?: { | ||
// id: number | ||
// name: string | ||
// } | ||
// } | ||
// Option 2 => build IKitQLContext from getContext return | ||
export type IKitQLContext = ReturnType<typeof getContext>; | ||
|
||
// then, make use of "IKitQLContext" in code gen, generate resolvers fully typed! | ||
// config: | ||
// contextType: $graphql/kitQLServer#IKitQLContext | ||
|
||
export const kitqlServer = { | ||
plugins, | ||
getContext | ||
}; |
This file was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
examples/demo2/src/lib/modules/__init/graphql/QUERY.Version.gql
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
query Version { | ||
query ExampleQueryVersion { | ||
version { | ||
releaseCreatedAtUtc | ||
} | ||
|
6 changes: 0 additions & 6 deletions
6
examples/demo2/src/routes/__layout.svelte → examples/demo2/src/routes/+layout.svelte
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,5 @@ | ||
query Version { | ||
version { | ||
releaseCreatedAtUtc | ||
} | ||
} |
File renamed without changes.
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 was deleted.
Oops, something went wrong.
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,20 @@ | ||
import { sveltekit } from '@sveltejs/kit/vite'; | ||
import houdini from 'houdini/vite'; | ||
// import watchAndRun from '@kitql/vite-plugin-watch-and-run'; | ||
|
||
import type { UserConfig } from 'vite'; | ||
|
||
const config: UserConfig = { | ||
plugins: [ | ||
houdini(), | ||
sveltekit() | ||
// watchAndRun([ | ||
// { | ||
// watch: '**/*.(gql|graphql)', | ||
// run: 'npm run gen' | ||
// } | ||
// ]) | ||
] | ||
}; | ||
|
||
export default config; |
Oops, something went wrong.
470d87b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
kitql – ./
kitql-git-main-jycouet.vercel.app
kitql-jycouet.vercel.app
kitql.vercel.app
www.kitql.dev
kitql.dev