Skip to content

Commit

Permalink
Merge: Bump GraphQL to v16 (HoudiniGraphql#1348)
Browse files Browse the repository at this point in the history
Co-authored-by: Alec Aivazis <alec@aivazis.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Ewen Le Bihan <hey@ewen.works>

Squashed commit of the following:

commit 81d1ebb
Author: radiden <gabriel@rai.cx>
Date:   Fri Sep 6 14:55:45 2024 +0200

    change ternary back to if

commit 6f9eadc
Author: radiden <gabriel2012688@gmail.com>
Date:   Wed Sep 4 18:22:46 2024 +0200

    add changeset

commit 3a64eae
Author: radiden <gabriel@rai.cx>
Date:   Wed Sep 4 17:46:53 2024 +0200

    remove sourcemap generation

commit 63f1464
Author: radiden <gabriel@rai.cx>
Date:   Fri Aug 30 12:58:33 2024 +0200

    fix react test bug

commit e65de35
Author: radiden <gabriel@rai.cx>
Date:   Fri Aug 30 12:58:15 2024 +0200

    update deps

commit 2a33542
Author: radiden <gabriel@rai.cx>
Date:   Thu Aug 29 01:57:55 2024 +0200

    remove debug console log

commit 5ac2b4f
Author: radiden <gabriel@rai.cx>
Date:   Thu Aug 29 01:50:04 2024 +0200

    fix default value handling

commit f854a19
Author: radiden <gabriel2012688@gmail.com>
Date:   Thu Aug 29 01:30:52 2024 +0200

    fix schema generation

commit b221176
Author: radiden <gabriel2012688@gmail.com>
Date:   Tue Aug 27 19:46:34 2024 +0200

    fix build errors

commit a822574
Author: radiden <gabriel2012688@gmail.com>
Date:   Tue Aug 27 17:11:50 2024 +0200

    update deps

commit eac0756
Author: radiden <gabriel2012688@gmail.com>
Date:   Tue Aug 27 17:10:31 2024 +0200

    remove vite-plugin-watch-and-run dependency

commit 6fb88f5
Author: radiden <gabriel@rai.cx>
Date:   Wed Aug 14 23:41:37 2024 +0200

    wip

commit 0d0dbdb
Author: radiden <gabriel@rai.cx>
Date:   Wed Jul 24 20:28:41 2024 +0200

    [wip] update graphql to 16.9.0
  • Loading branch information
Gonzalo Ruiz committed Sep 17, 2024
1 parent 824cee1 commit ee7e869
Show file tree
Hide file tree
Showing 24 changed files with 554 additions and 283 deletions.
9 changes: 9 additions & 0 deletions .changeset/loud-turtles-study.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
'houdini': major
'scripts': minor
'houdini-adapter-node': minor
'houdini-react': minor
'houdini-svelte': minor
---

Bump GraphQL to v16
2 changes: 1 addition & 1 deletion e2e/_api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"@envelop/core": "^3.0.6",
"@kitql/helpers": "^0.8.2",
"fs-extra": "^10.1.0",
"graphql": "^15.8.0",
"graphql": "^16.9.0",
"graphql-relay": "^0.10.0",
"graphql-ws": "^5.8.2",
"graphql-yoga": "^5.7.0",
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"@types/react": "^18.2.22",
"@vitest/ui": "^1.6.0",
"eslint-plugin-unused-imports": "^4.1.4",
"graphql": "^15.8.0",
"graphql": "^16.9.0",
"lint-staged": "^12.3.4",
"prettier": "^3.3.3",
"turbo": "^1.8.8",
Expand All @@ -58,6 +58,6 @@
"*.json": "prettier -w "
},
"resolutions": {
"graphql": "15.5.0"
"graphql": "16.9.0"
}
}
1 change: 1 addition & 0 deletions packages/adapter-node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"build:build": "pnpm build: && pnpm build"
},
"devDependencies": {
"@types/node": "^22.5.1",
"scripts": "workspace:^",
"tsup": "^7.2.0"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"react": "19.0.0-rc-eb259b5d3b-20240605",
"react-dom": "19.0.0-rc-eb259b5d3b-20240605",
"graphql-yoga": "4.0.4",
"graphql": "15.8.0",
"graphql": "^16.9.0",
"@whatwg-node/server": "^0.9.49"
},
"devDependencies": {
Expand All @@ -26,7 +26,7 @@
"vite": "^5.4.5"
},
"resolutions": {
"graphql": "15.8.0",
"graphql": "16.9.0",
"react": "19.0.0-rc-eb259b5d3b-20240605",
"react-dom": "19.0.0-rc-eb259b5d3b-20240605"
}
Expand Down
4 changes: 2 additions & 2 deletions packages/create-houdini/templates/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
"react": "19.0.0-rc-eb259b5d3b-20240605",
"react-dom": "19.0.0-rc-eb259b5d3b-20240605",
"graphql-yoga": "4.0.4",
"graphql": "15.8.0",
"graphql": "^16.9.0",
"@whatwg-node/server": "^0.9.49"
},
"devDependencies": {
"@vitejs/plugin-react": "^4.3.1",
"vite": "^5.4.5"
},
"resolutions": {
"graphql": "15.8.0",
"graphql": "16.9.0",
"react": "19.0.0-rc-eb259b5d3b-20240605",
"react-dom": "19.0.0-rc-eb259b5d3b-20240605"
}
Expand Down
2 changes: 1 addition & 1 deletion packages/houdini-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"cookies": "^0.8.0",
"estraverse": "^5.3.0",
"express": "^4.18.2",
"graphql": "^15.8.0",
"graphql": "^16.9.0",
"graphql-yoga": "^5.7.0",
"houdini": "workspace:^",
"react": "19.0.0-rc-eb259b5d3b-20240605",
Expand Down
2 changes: 1 addition & 1 deletion packages/houdini-svelte/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"@sveltejs/kit": "^2.5.27",
"ast-types": "^0.16.1",
"estree-walker": "^3.0.1",
"graphql": "^15.8.0",
"graphql": "^16.9.0",
"houdini": "workspace:^",
"recast": "^0.23.1",
"rollup": "^4.21.3",
Expand Down
17 changes: 8 additions & 9 deletions packages/houdini/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"typedefs": "scripts typedefs"
},
"devDependencies": {
"@babel/types": "^7.21.5",
"@babel/types": "^7.25.4",
"@ianvs/prettier-plugin-sort-imports": "^4.3.1",
"@types/minimatch": "^5.1.2",
"@types/node": "^22.5.5",
Expand All @@ -33,11 +33,11 @@
"vitest": "^1.6.0"
},
"dependencies": {
"@babel/parser": "^7.23.9",
"@babel/parser": "^7.25.4",
"@clack/prompts": "^0.6.3",
"@graphql-tools/merge": "^9.0.0",
"@graphql-tools/merge": "^9.0.6",
"@graphql-tools/schema": "^9.0.4",
"@kitql/helpers": "^0.8.2",
"@kitql/helpers": "^0.8.10",
"@types/estree": "^1.0.0",
"@types/fs-extra": "^9.0.13",
"@types/micromatch": "^4.0.2",
Expand All @@ -46,18 +46,17 @@
"ast-types": "^0.16.1",
"commander": "^9.4.0",
"deepmerge": "^4.2.2",
"estree-walker": "^3.0.1",
"estree-walker": "3.0.1",
"fs-extra": "^10.1.0",
"glob": "^10.4.5",
"graphql": "^15.8.0",
"graphql": "^16.9.0",
"graphql-yoga": "^5.7.0",
"memfs": "^3.4.7",
"micromatch": "^4.0.5",
"micromatch": "^4.0.8",
"minimatch": "^5.1.0",
"node-fetch": "^3.2.10",
"npx-import": "^1.1.3",
"recast": "^0.23.1",
"vite-plugin-watch-and-run": "^1.3.2"
"recast": "^0.23.1"
},
"files": [
"build"
Expand Down
12 changes: 6 additions & 6 deletions packages/houdini/src/codegen/transforms/componentFields.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,19 +46,19 @@ export default async function componentFields(
const args: graphql.ArgumentNode[] = []
for (const arg of node.arguments ?? []) {
args.push({
kind: 'Argument',
kind: graphql.Kind.ARGUMENT,
name: {
kind: 'Name',
kind: graphql.Kind.NAME,
value: arg.name.value,
},
value: arg.value,
})
}
if (args.length > 0) {
directives.push({
kind: 'Directive',
kind: graphql.Kind.DIRECTIVE,
name: {
kind: 'Name',
kind: graphql.Kind.NAME,
value: config.withDirective,
},
arguments: args,
Expand All @@ -67,9 +67,9 @@ export default async function componentFields(

// replace the field with a fragment spread
return {
kind: 'FragmentSpread',
kind: graphql.Kind.FRAGMENT_SPREAD,
name: {
kind: 'Name',
kind: graphql.Kind.NAME,
value: fragment,
},
directives,
Expand Down
19 changes: 10 additions & 9 deletions packages/houdini/src/codegen/transforms/fragmentVariables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ export type FragmentArgument = {
name: string
type: graphql.TypeNode
required: boolean
defaultValue: graphql.ValueNode | null
defaultValue: graphql.ConstValueNode | null
}

export function fragmentArguments(
Expand Down Expand Up @@ -369,7 +369,8 @@ export function fragmentArguments(

let type = parseArgumentTypeString(typeArg.value)
let defaultValue =
arg.value.fields?.find((arg) => arg.name.value === 'default')?.value || null
(arg.value.fields?.find((arg) => arg.name.value === 'default')
?.value as graphql.ConstValueNode) || null

return [
{
Expand All @@ -396,7 +397,7 @@ export function parseArgumentTypeString(input: string): graphql.TypeNode {
}

return {
kind: 'NonNullType',
kind: graphql.Kind.NON_NULL_TYPE,
type: inner,
}
}
Expand All @@ -406,16 +407,16 @@ export function parseArgumentTypeString(input: string): graphql.TypeNode {
const inner = parseArgumentTypeString(input.substring(1, input.length - 1))

return {
kind: 'ListType',
kind: graphql.Kind.LIST_TYPE,
type: inner,
}
}

// we are dealing with a name
return {
kind: 'NamedType',
kind: graphql.Kind.NAMED_TYPE,
name: {
kind: 'Name',
kind: graphql.Kind.NAME,
value: input,
},
}
Expand Down Expand Up @@ -521,12 +522,12 @@ export function fragmentArgumentsDefinitions(
// we have a list of the arguments
return args.map<graphql.VariableDefinitionNode>((arg) => {
return {
kind: 'VariableDefinition',
kind: graphql.Kind.VARIABLE_DEFINITION,
type: arg.type,
variable: {
kind: 'Variable',
kind: graphql.Kind.VARIABLE,
name: {
kind: 'Name',
kind: graphql.Kind.NAME,
value: arg.name,
},
},
Expand Down
8 changes: 5 additions & 3 deletions packages/houdini/src/codegen/transforms/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -353,11 +353,11 @@ export default async function addListFragments(
export function connectionSelection(
config: Config,
field: graphql.GraphQLField<any, any>,
type: graphql.GraphQLObjectType,
type: graphql.GraphQLObjectType | graphql.GraphQLInterfaceType,
selection: graphql.SelectionSetNode | undefined
): {
selection: graphql.SelectionSetNode | undefined
type: graphql.GraphQLObjectType
type: graphql.GraphQLObjectType | graphql.GraphQLInterfaceType
connection: boolean
error: string | null
} {
Expand Down Expand Up @@ -419,7 +419,9 @@ export function connectionSelection(

return {
selection: nodeSelection.selectionSet,
type: unwrapType(config, nodeField.type).type as graphql.GraphQLObjectType,
type: unwrapType(config, nodeField.type).type as
| graphql.GraphQLObjectType
| graphql.GraphQLInterfaceType,
connection: true,
error: null,
}
Expand Down
32 changes: 17 additions & 15 deletions packages/houdini/src/codegen/transforms/paginate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ export default async function paginate(config: Config, documents: Document[]): P
kind: graphql.Kind.NAME,
value: refetchQueryName,
},
operation: 'query',
operation: graphql.OperationTypeNode.QUERY,
variableDefinitions: requiredArgs
.map(
(arg) =>
Expand Down Expand Up @@ -698,7 +698,20 @@ function objectNode([type, defaultValue]: [
string,
number | string | undefined
]): graphql.ObjectValueNode {
const node = {
let defaultValueNode: graphql.ObjectFieldNode[] = []
if (defaultValue) {
defaultValueNode = [
{
kind: graphql.Kind.OBJECT_FIELD,
name: { kind: graphql.Kind.NAME, value: 'default' },
value: {
kind: typeof defaultValue === 'number' ? graphql.Kind.INT : graphql.Kind.STRING,
value: defaultValue.toString(),
},
},
]
}
const node: graphql.ObjectValueNode = {
kind: graphql.Kind.OBJECT,
fields: [
{
Expand All @@ -712,19 +725,8 @@ function objectNode([type, defaultValue]: [
value: type,
},
},
] as graphql.ObjectFieldNode[],
}

// if there's a default value, add it
if (defaultValue) {
node.fields.push({
kind: graphql.Kind.OBJECT_FIELD,
name: { kind: graphql.Kind.NAME, value: 'default' } as graphql.NameNode,
value: {
kind: typeof defaultValue === 'number' ? 'IntValue' : 'StringValue',
value: defaultValue.toString(),
},
} as graphql.ObjectFieldNode)
...defaultValueNode,
],
}

return node
Expand Down
16 changes: 8 additions & 8 deletions packages/houdini/src/codegen/utils/flattenSelections.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type * as graphql from 'graphql'
import * as graphql from 'graphql'

import type { Config } from '../../lib/index.js'
import { HoudiniError } from '../../lib/index.js'
Expand Down Expand Up @@ -172,16 +172,16 @@ class FieldCollection {
if (this.applyFragments || include) {
this.add({
selection: {
kind: 'InlineFragment',
kind: graphql.Kind.INLINE_FRAGMENT,
typeCondition: {
kind: 'NamedType',
kind: graphql.Kind.NAMED_TYPE,
name: {
kind: 'Name',
kind: graphql.Kind.NAME,
value: definition.typeCondition.name.value,
},
},
selectionSet: {
kind: 'SelectionSet',
kind: graphql.Kind.SELECTION_SET,
selections: [...definition.selectionSet.selections],
},
},
Expand Down Expand Up @@ -250,7 +250,7 @@ class FieldCollection {
...field.astNode,
selectionSet: field.astNode.selectionSet
? {
kind: 'SelectionSet',
kind: graphql.Kind.SELECTION_SET,
selections: field.selection.toSelectionSet(),
}
: undefined,
Expand All @@ -260,9 +260,9 @@ class FieldCollection {
.concat(
Object.values(this.fragmentSpreads).map<graphql.FragmentSpreadNode>((spread) => {
return {
kind: 'FragmentSpread',
kind: graphql.Kind.FRAGMENT_SPREAD,
name: {
kind: 'Name',
kind: graphql.Kind.NAME,
value: spread.name.value,
},
directives: spread.directives,
Expand Down
Loading

0 comments on commit ee7e869

Please sign in to comment.