diff --git a/.changeset/lemon-chefs-smash.md b/.changeset/lemon-chefs-smash.md new file mode 100644 index 0000000000..480aa394eb --- /dev/null +++ b/.changeset/lemon-chefs-smash.md @@ -0,0 +1,5 @@ +--- +'houdini': patch +--- + +schemaPollHeaders requires env: prefix to reference environment variable diff --git a/example/api.mjs b/example/api.mjs index d7b3c174b4..05a09b0a57 100644 --- a/example/api.mjs +++ b/example/api.mjs @@ -1,8 +1,8 @@ import { createServer } from '@graphql-yoga/node' import { useServer } from 'graphql-ws/lib/use/ws' -import ws from 'ws' +import { WebSocketServer } from 'ws' + import { resolvers, typeDefs } from './schema/index.mjs' -const WebSocketServer = ws.Server async function main() { const yogaApp = createServer({ @@ -41,7 +41,7 @@ subscription SubToNewItem { text } } -} +} `, }, }) diff --git a/example/houdini.config.js b/example/houdini.config.js index beec53ee6e..8e78877195 100644 --- a/example/houdini.config.js +++ b/example/houdini.config.js @@ -1,9 +1,6 @@ /** @type {import('houdini').ConfigFile} */ const config = { - schemaPath: './schema/schema.gql', - sourceGlob: 'src/**/*.{svelte,gql,graphql}', - framework: 'kit', - module: 'esm', + client: './src/client.ts', apiUrl: 'http://localhost:4000/graphql', scalars: { DateTime: { diff --git a/example/package.json b/example/package.json index 2f1ad6b69c..81f10279c4 100644 --- a/example/package.json +++ b/example/package.json @@ -1,29 +1,30 @@ { "name": "example-kit", "version": "0.13.0", + "private": true, "scripts": { - "prepare": "svelte-kit sync", "generate": "houdini generate", "web": "vite dev", "api": "node api.mjs", - "dev": "npm run prepare && npm run generate && concurrently \"npm run web\" \"npm run api\" -n \"web,api\" -c \"green,magenta\"", + "dev": "concurrently \"npm run web\" \"npm run api\" -n \"web,api\" -c \"green,magenta\"", "build": "vite build", "start": "vite preview" }, "devDependencies": { + "@graphql-yoga/node": "2.8.0", "@kitql/vite-plugin-watch-and-run": "^0.4.0", - "@sveltejs/kit": "1.0.0-next.370", + "@sveltejs/kit": "1.0.0-next.435", "concurrently": "^6.2.1", "graphql": "15.5.0", - "houdini": "0.15.5", + "houdini": "workspace:^", "svelte": "^3.38.2", "svelte-preprocess": "^4.0.0", "tslib": "^2.2.0", "typescript": "^4.0.0", - "vite": "^2.9.14" + "vite": "^3.0.0", + "ws": "^8.8.1" }, "dependencies": { - "@graphql-yoga/node": "2.8.0", "graphql-relay": "0.8.0", "graphql-tag": "2.12.6", "graphql-ws": "5.8.2" diff --git a/example/schema/schema.gql b/example/schema.graphql similarity index 82% rename from example/schema/schema.gql rename to example/schema.graphql index 52e79d0404..6b7118fd68 100644 --- a/example/schema/schema.gql +++ b/example/schema.graphql @@ -1,8 +1,3 @@ -directive @cacheControl( - maxAge: Int - scope: CacheControlScope -) on FIELD_DEFINITION | INTERFACE | OBJECT - input AddItemInput { text: String! } @@ -12,11 +7,6 @@ type AddItemOutput { item: TodoItem } -enum CacheControlScope { - PRIVATE - PUBLIC -} - """ Date custom scalar type """ @@ -81,8 +71,3 @@ type UpdateItemOutput { error: Error item: TodoItem } - -""" -The `Upload` scalar type represents a file upload. -""" -scalar Upload diff --git a/example/src/client.ts b/example/src/client.ts index f165e42c3c..77360532ad 100644 --- a/example/src/client.ts +++ b/example/src/client.ts @@ -4,13 +4,7 @@ import { HoudiniClient } from '$houdini' import { createClient as createWSClient } from 'graphql-ws' // For Query & Mutation -async function fetchQuery({ - fetch, - text = '', - variables = {}, - session, - metadata, -}: RequestHandlerArgs) { +async function fetchQuery({ fetch, text = '', variables = {} }: RequestHandlerArgs) { const result = await fetch('http://localhost:4000/graphql', { method: 'POST', headers: { @@ -28,10 +22,11 @@ async function fetchQuery({ // For subscription (client only) let socketClient: SubscriptionHandler | null = null if (browser) { + // @ts-ignore socketClient = createWSClient({ url: 'ws://localhost:4000/graphql', }) } // Export the Houdini client -export const houdiniClient = new HoudiniClient(fetchQuery, socketClient) +export default new HoudiniClient(fetchQuery, socketClient) diff --git a/example/src/lib/ItemEntry.svelte b/example/src/lib/ItemEntry.svelte index 26f3685e2a..50ef3f3d2d 100755 --- a/example/src/lib/ItemEntry.svelte +++ b/example/src/lib/ItemEntry.svelte @@ -1,17 +1,8 @@ - @@ -105,7 +92,7 @@ {$data.createdAt.toLocaleDateString('en-US')} -