Skip to content

Commit

Permalink
fix: "with" method config merging (#1287)
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonkuhrt authored Dec 22, 2024
1 parent 301488d commit 5b936db
Show file tree
Hide file tree
Showing 48 changed files with 6,162 additions and 5,087 deletions.
2 changes: 1 addition & 1 deletion examples/$/graffle/modules/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import * as $$SchemaDrivenDataMap from './schema-driven-data-map.js'

const context = $$Utilities.useReducer(
{
...$$Utilities.Context.States.contextEmpty,
...$$Utilities.Context.States.empty,
name: $$Data.Name,
schemaMap: $$SchemaDrivenDataMap.schemaDrivenDataMap,
scalars: $$Scalar.$registry,
Expand Down
6 changes: 3 additions & 3 deletions examples/60_extension/extension_throws__throws.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ const pokemon = Graffle
const result1 = await pokemon.query.pokemons({ name: true })
show(result1)

const result2 = await pokemon.throws().query.pokemons({ name: true })
// ^^^^^^^
result2 // This line will never be reached because of thrown error.
await pokemon.throws().query.pokemons({ name: true })
// ^^^^^^
show(`This line will never be reached because of thrown error.`)
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
headers: Headers {
accept: 'application/graphql-response+json; charset=utf-8, application/json; charset=utf-8',
'content-type': 'application/json',
'x-sent-at-time': '1734313683348'
'x-sent-at-time': '1734835236654'
},
method: 'post',
url: 'http://localhost:3000/graphql',
Expand Down
2 changes: 1 addition & 1 deletion examples/__outputs__/20_output/output_envelope.output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
headers: Headers {
'content-type': 'application/graphql-response+json; charset=utf-8',
'content-length': '142',
date: 'Mon, 16 Dec 2024 01:48:03 GMT',
date: 'Sun, 22 Dec 2024 02:40:37 GMT',
connection: 'keep-alive',
'keep-alive': 'timeout=5'
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
}
},
instrumentationScope: { name: 'graffle', version: undefined, schemaUrl: undefined },
traceId: '9f1dd3465bee320e11285dab4fd18c0a',
parentId: 'fff65363c3906c5f',
traceId: 'e8d5df13d914fbbd4ccbdcfacd957ab0',
parentId: '8e35291fef6405ac',
traceState: undefined,
name: 'encode',
id: '0932a4af7db7f676',
id: '57064bac33995f52',
kind: 0,
timestamp: 1734313684255000,
duration: 886.584,
timestamp: 1734835237807000,
duration: 985.375,
attributes: {},
status: { code: 0 },
events: [],
Expand All @@ -33,14 +33,14 @@
}
},
instrumentationScope: { name: 'graffle', version: undefined, schemaUrl: undefined },
traceId: '9f1dd3465bee320e11285dab4fd18c0a',
parentId: 'fff65363c3906c5f',
traceId: 'e8d5df13d914fbbd4ccbdcfacd957ab0',
parentId: '8e35291fef6405ac',
traceState: undefined,
name: 'pack',
id: '2dac90b2b7dae9cf',
id: '4160ec4bd017e345',
kind: 0,
timestamp: 1734313684257000,
duration: 9667.791,
timestamp: 1734835237808000,
duration: 12389.166,
attributes: {},
status: { code: 0 },
events: [],
Expand All @@ -57,14 +57,14 @@
}
},
instrumentationScope: { name: 'graffle', version: undefined, schemaUrl: undefined },
traceId: '9f1dd3465bee320e11285dab4fd18c0a',
parentId: 'fff65363c3906c5f',
traceId: 'e8d5df13d914fbbd4ccbdcfacd957ab0',
parentId: '8e35291fef6405ac',
traceState: undefined,
name: 'exchange',
id: 'c9162ca6e544cf37',
id: 'b605384e7351522a',
kind: 0,
timestamp: 1734313684267000,
duration: 15232.833,
timestamp: 1734835237821000,
duration: 21988.041,
attributes: {},
status: { code: 0 },
events: [],
Expand All @@ -81,14 +81,14 @@
}
},
instrumentationScope: { name: 'graffle', version: undefined, schemaUrl: undefined },
traceId: '9f1dd3465bee320e11285dab4fd18c0a',
parentId: 'fff65363c3906c5f',
traceId: 'e8d5df13d914fbbd4ccbdcfacd957ab0',
parentId: '8e35291fef6405ac',
traceState: undefined,
name: 'unpack',
id: 'c360e1de02b2f249',
id: '3dc693f1496eb20f',
kind: 0,
timestamp: 1734313684283000,
duration: 773.625,
timestamp: 1734835237844000,
duration: 1031.333,
attributes: {},
status: { code: 0 },
events: [],
Expand All @@ -105,14 +105,14 @@
}
},
instrumentationScope: { name: 'graffle', version: undefined, schemaUrl: undefined },
traceId: '9f1dd3465bee320e11285dab4fd18c0a',
parentId: 'fff65363c3906c5f',
traceId: 'e8d5df13d914fbbd4ccbdcfacd957ab0',
parentId: '8e35291fef6405ac',
traceState: undefined,
name: 'decode',
id: '6f38295d85844fd0',
id: '41886c6abbbe3566',
kind: 0,
timestamp: 1734313684283000,
duration: 400.083,
timestamp: 1734835237845000,
duration: 457.25,
attributes: {},
status: { code: 0 },
events: [],
Expand All @@ -129,14 +129,14 @@
}
},
instrumentationScope: { name: 'graffle', version: undefined, schemaUrl: undefined },
traceId: '9f1dd3465bee320e11285dab4fd18c0a',
traceId: 'e8d5df13d914fbbd4ccbdcfacd957ab0',
parentId: undefined,
traceState: undefined,
name: 'request',
id: 'fff65363c3906c5f',
id: '8e35291fef6405ac',
kind: 0,
timestamp: 1734313684255000,
duration: 29236.834,
timestamp: 1734835237806000,
duration: 39409.5,
attributes: {},
status: { code: 0 },
events: [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,23 @@ ContextualError: There was an error in the interceptor "anonymous" (use named fu
cause: Error: Something went wrong.
at <anonymous> (/some/path/to/extension_throws__throws.ts:XX:XX:11)
at applyBody (/some/path/to/runner.ts:XX:XX:28)
}
---------------------------------------- SHOW ----------------------------------------
UNCAUGHT EXCEPTION:

ContextualError: There was an error in the interceptor "anonymous" (use named functions to improve this error message) while running hook "encode".
at runPipeline (/some/path/to/runPipeline.ts:XX:XX:18)
at async <anonymous> (/some/path/to/runner.ts:XX:XX:20)
at async Module.run (/some/path/to/run.ts:XX:XX:10)
at async executeDocument (/some/path/to/requestMethods.ts:XX:XX:18)
at async executeRootField (/some/path/to/requestMethods.ts:XX:XX:18)
at async <anonymous> (/some/path/to/extension_throws__throws.ts:XX:XX:1) {
context: {
hookName: 'encode',
source: 'extension',
interceptorName: 'anonymous'
},
cause: Error: Something went wrong.
at <anonymous> (/some/path/to/extension_throws__throws.ts:XX:XX:11)
at applyBody (/some/path/to/runner.ts:XX:XX:28)
}
22 changes: 22 additions & 0 deletions examples/dprint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"typescript": {
"quoteStyle": "preferSingle",
"semiColons": "asi"
},
"json": {
},
"markdown": {
},
"excludes": [
"**/node_modules",
"**/*-lock.json",
"website/pokemon",
"website/graffle",
"website/.vitepress/dist"
],
"plugins": [
"https://plugins.dprint.dev/typescript-0.93.0.wasm",
"https://plugins.dprint.dev/json-0.19.1.wasm",
"https://plugins.dprint.dev/markdown-0.16.3.wasm"
]
}
3 changes: 2 additions & 1 deletion examples/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"private": true,
"type": "module",
"scripts": {
"check:types": "tsc --noEmit"
"check:types": "tsc --noEmit",
"gen:graffle": "pnpm graffle --defaultSchemaUrl http://localhost:3000/graphql --schema ../tests/_/schemas/pokemon/schema.graphql --output ./$/graffle"
},
"dependencies": {
"@opentelemetry/sdk-trace-base": "^1.29.0",
Expand Down
38 changes: 19 additions & 19 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,9 @@
"serve:pokemon": "tsx tests/_/services/pokemonManual.ts",
"gen:graffle": "pnpm gen:graffle:tests && pnpm build && cd website && pnpm gen:graffle",
"gen:graffle:tests": "tsx tests/_/schemas/generate.ts && pnpm graffle --project src/extensions/SchemaErrors/tests/fixture",
"gen:graffle:examples": "tsx tests/_/schemas/generate.ts && pnpm graffle --defaultSchemaUrl http://localhost:3000/graphql --schema ./tests/_/schemas/pokemon/schema.graphql --output ./examples/$/graffle",
"graffle": "tsx ./src/generator/cli/generate.ts",
"gen:examples": "tsx scripts/generate-examples-derivatives/generate.ts && pnpm format",
"gen:examples:outputs": "tsx scripts/generate-examples-derivatives/generate.ts --outputs",
"dev": "rm -rf dist && tsc --watch",
"format": "pnpm build:docs && dprint fmt",
"lint": "eslint . --fix --ignore-pattern 'website' --ignore-pattern 'build'",
Expand All @@ -121,10 +121,10 @@
"release:pr": "dripip pr"
},
"dependencies": {
"@0no-co/graphql.web": "^1.0.11",
"@0no-co/graphql.web": "^1.0.12",
"@graphql-typed-document-node/core": "^3.2.0",
"@molt/command": "^0.9.0",
"es-toolkit": "^1.29.0",
"es-toolkit": "^1.30.1",
"is-plain-obj": "^4.1.0"
},
"peerDependencies": {
Expand All @@ -149,54 +149,54 @@
}
},
"devDependencies": {
"@arethetypeswrong/cli": "^0.17.0",
"@arethetypeswrong/cli": "^0.17.2",
"@dprint/formatter": "^0.4.1",
"@dprint/typescript": "^0.93.3",
"@opentelemetry/api": "^1.9.0",
"@opentelemetry/sdk-trace-base": "^1.28.0",
"@opentelemetry/sdk-trace-node": "^1.28.0",
"@opentelemetry/sdk-trace-base": "^1.30.0",
"@opentelemetry/sdk-trace-node": "^1.30.0",
"@pothos/core": "^4.3.0",
"@pothos/plugin-simple-objects": "^4.1.0",
"@pothos/plugin-zod": "^4.1.0",
"@tsconfig/node20": "^20.1.4",
"@tsconfig/strictest": "^2.0.5",
"@types/body-parser": "^1.19.5",
"@types/express": "^5.0.0",
"@types/node": "^22.10.1",
"@typescript-eslint/eslint-plugin": "^8.17.0",
"@typescript-eslint/parser": "^8.17.0",
"@types/node": "^22.10.2",
"@typescript-eslint/eslint-plugin": "^8.18.1",
"@typescript-eslint/parser": "^8.18.1",
"async-cleanup": "^1.0.0",
"doctoc": "^2.2.1",
"dprint": "^0.47.6",
"dprint": "^0.48.0",
"dripip": "^0.10.0",
"eslint": "^9.16.0",
"eslint": "^9.17.0",
"eslint-config-prisma": "^0.6.0",
"eslint-plugin-deprecation": "^3.0.0",
"eslint-plugin-only-warn": "^1.1.0",
"eslint-plugin-prefer-arrow": "^1.2.3",
"eslint-plugin-simple-import-sort": "^12.1.1",
"eslint-plugin-tsdoc": "^0.4.0",
"eslint-typescript": "^1.1.0",
"execa": "^9.5.1",
"execa": "^9.5.2",
"fs-jetpack": "^5.1.0",
"get-port": "^7.1.0",
"globby": "^14.0.2",
"graphql": "^16.9.0",
"graphql": "^16.10.0",
"graphql-scalars": "^1.24.0",
"graphql-tag": "^2.12.6",
"graphql-upload-minimal": "^1.6.1",
"graphql-yoga": "^5.10.4",
"graphql-yoga": "^5.10.6",
"jsdom": "^25.0.1",
"memfs": "^4.14.1",
"prettier": "^3.4.1",
"memfs": "^4.15.1",
"prettier": "^3.4.2",
"publint": "^0.2.12",
"strip-ansi": "^7.1.0",
"tsx": "^4.19.2",
"type-fest": "^4.30.0",
"type-fest": "^4.30.2",
"typescript": "^5.7.2",
"typescript-eslint": "^8.17.0",
"typescript-eslint": "^8.18.1",
"vitepress": "^1.5.0",
"vitest": "^2.1.8",
"zod": "^3.23.8"
"zod": "^3.24.1"
}
}
Loading

0 comments on commit 5b936db

Please sign in to comment.