diff --git a/examples/10_transport-http/transport-http_abort.ts b/examples/10_transport-http/transport-http_abort.ts index de3eed28..ee57a33c 100644 --- a/examples/10_transport-http/transport-http_abort.ts +++ b/examples/10_transport-http/transport-http_abort.ts @@ -15,15 +15,14 @@ const graffle = Graffle.create({ const resultPromise = graffle .with({ transport: { signal: abortController.signal } }) // ^^^^^^^^^^^^^^^ - .rawString({ - document: ` - { - pokemon { - name - } + .gql` + { + pokemon { + name } - `, - }) + } + ` + .send() abortController.abort() // ^^^^^ diff --git a/examples/10_transport-http/transport-http_extension_fetch__custom-fetch.ts b/examples/10_transport-http/transport-http_extension_fetch__custom-fetch.ts index de9e8729..1cb710e4 100644 --- a/examples/10_transport-http/transport-http_extension_fetch__custom-fetch.ts +++ b/examples/10_transport-http/transport-http_extension_fetch__custom-fetch.ts @@ -19,6 +19,6 @@ const graffle = Graffle }) ) -const data = await graffle.rawString({ document: `{ pokemon { name } }` }) +const data = await graffle.gql`{ pokemon { name } }`.send() showJson(data) diff --git a/examples/10_transport-http/transport-http_extension_headers__dynamicHeaders.ts b/examples/10_transport-http/transport-http_extension_headers__dynamicHeaders.ts index 0c352cf9..e5c0952a 100644 --- a/examples/10_transport-http/transport-http_extension_headers__dynamicHeaders.ts +++ b/examples/10_transport-http/transport-http_extension_headers__dynamicHeaders.ts @@ -25,4 +25,4 @@ const graffle = Graffle return exchange() }) -await graffle.rawString({ document: `{ pokemons { name } }` }) +await graffle.gql`{ pokemons { name } }`.send() diff --git a/examples/10_transport-http/transport-http_headers_raw__headers.ts b/examples/10_transport-http/transport-http_headers_raw__headers.ts index 9f128d15..b3de4b9d 100644 --- a/examples/10_transport-http/transport-http_headers_raw__headers.ts +++ b/examples/10_transport-http/transport-http_headers_raw__headers.ts @@ -29,4 +29,4 @@ const graffle = Graffle return exchange() }) -await graffle.rawString({ document: `{ pokemons { name } }` }) +await graffle.gql`{ pokemons { name } }`.send() diff --git a/examples/10_transport-http/transport-http_method-get.ts b/examples/10_transport-http/transport-http_method-get.ts index 60900daa..984a752b 100644 --- a/examples/10_transport-http/transport-http_method-get.ts +++ b/examples/10_transport-http/transport-http_method-get.ts @@ -20,10 +20,8 @@ const graffle = Pokemon // The following request will use an HTTP POST method because it is // using a "mutation" type of operation. -await graffle.rawString({ - document: `mutation { addPokemon(attack:0, defense:0, hp:1, name:"Nano", type: grass) { name } }`, -}) +await graffle.gql`mutation { addPokemon(attack:0, defense:0, hp:1, name:"Nano", type: grass) { name } }`.send() // The following request will use an HTTP GET method because it // is using a "query" type of operation. -await graffle.rawString({ document: `query { pokemonByName(name: "Nano") { hp } }` }) +await graffle.gql`query { pokemonByName(name: "Nano") { hp } }`.send() diff --git a/examples/10_transport-http/transport-http_raw.ts b/examples/10_transport-http/transport-http_raw.ts index b76cdb83..e7e7b428 100644 --- a/examples/10_transport-http/transport-http_raw.ts +++ b/examples/10_transport-http/transport-http_raw.ts @@ -20,4 +20,4 @@ const graffle = Graffle return exchange() }) -await graffle.rawString({ document: `{ pokemons { name } }` }) +await graffle.gql`{ pokemons { name } }`.send() diff --git a/examples/20_output/output_preset__standard-graphql.ts b/examples/20_output/output_preset__standard-graphql.ts index 837350dc..f0489775 100644 --- a/examples/20_output/output_preset__standard-graphql.ts +++ b/examples/20_output/output_preset__standard-graphql.ts @@ -10,6 +10,6 @@ const graffle = Graffle.create({ output: Preset.traditionalGraphqlOutput, }) -const result = await graffle.rawString({ document: `{ query { thisWillError } }` }) +const result = await graffle.gql(`{ query { thisWillError } }`).send() show(result) diff --git a/examples/30_raw/raw_rawDocumentNode__raw-document-node.ts b/examples/30_gql/gql_gql-document-node.ts similarity index 60% rename from examples/30_raw/raw_rawDocumentNode__raw-document-node.ts rename to examples/30_gql/gql_gql-document-node.ts index a2f61c91..30b7edf7 100644 --- a/examples/30_raw/raw_rawDocumentNode__raw-document-node.ts +++ b/examples/30_gql/gql_gql-document-node.ts @@ -2,8 +2,9 @@ * This example shows how to send a request using a Document instance for the GraphQL document. */ +import { parse } from 'graphql' import { Opentelemetry, Throws } from '../../src/entrypoints/extensions.js' -import { gql, Graffle } from '../../src/entrypoints/main.js' +import { Graffle } from '../../src/entrypoints/main.js' import { publicGraphQLSchemaEndpoints, show } from '../$/helpers.js' const graffle = Graffle.create({ @@ -12,18 +13,15 @@ const graffle = Graffle.create({ .use(Throws()) .use(Opentelemetry()) -const data = await graffle.raw({ - document: gql` - query pokemonByName ($Name: String!) { - pokemonByName (name: $Name) { +const data = await graffle.gql(parse(` + query pokemonByName ($name: String!) { + pokemonByName (name: $name) { + name + trainer { name - continent { - name - } } } - `, - variables: { name: `Pikachu` }, -}) + } +`)).send({ name: `Pikachu` }) show(data) diff --git a/examples/30_gql/gql_gql-document-node_gql-typed_gql-document-node-typed__gql-document-node-typed.ts b/examples/30_gql/gql_gql-document-node_gql-typed_gql-document-node-typed__gql-document-node-typed.ts new file mode 100644 index 00000000..0332c8c4 --- /dev/null +++ b/examples/30_gql/gql_gql-document-node_gql-typed_gql-document-node-typed__gql-document-node-typed.ts @@ -0,0 +1,44 @@ +/** + * This example shows how to use the TypeScript type "TypedQueryDocumentNode" from the + * package `graphql` to make a type safe request with gql method. + */ + +import { parse, type TypedQueryDocumentNode } from 'graphql' +import { Graffle } from '../../src/entrypoints/main.js' +import { publicGraphQLSchemaEndpoints, show } from '../$/helpers.js' + +const graffle = Graffle.create({ + schema: publicGraphQLSchemaEndpoints.Pokemon, +}) + +type Document = TypedQueryDocumentNode< + { + pokemonByName: { + id: string + name: string + hp: number + attack: number + defense: number + trainer: { name: string } + } + }, + { name: string } +> + +const document = parse(` + query ($name: String!) { + pokemonByName (name: $name) { + name + hp + attack + defense + trainer { + name + } + } + } + `) as Document + +const data = await graffle.gql(document).send({ name: `Pikachu` }) + +show(data?.pokemonByName) diff --git a/examples/30_raw/raw_rawString__rawString.ts b/examples/30_gql/gql_gql-string.ts similarity index 88% rename from examples/30_raw/raw_rawString__rawString.ts rename to examples/30_gql/gql_gql-string.ts index 24e1addc..3af60eb0 100644 --- a/examples/30_raw/raw_rawString__rawString.ts +++ b/examples/30_gql/gql_gql-string.ts @@ -17,6 +17,6 @@ const document = /* gql */ ` } ` -const data = await graffle.rawString({ document }) +const data = await graffle.gql(document).send() show(data) diff --git a/examples/30_raw/raw_rawString_rawTyped__rawString-typed.ts b/examples/30_gql/gql_gql-string_gql-typed__gql-string-typed.ts similarity index 85% rename from examples/30_raw/raw_rawString_rawTyped__rawString-typed.ts rename to examples/30_gql/gql_gql-string_gql-typed__gql-string-typed.ts index 575be0a2..d6a51074 100644 --- a/examples/30_raw/raw_rawString_rawTyped__rawString-typed.ts +++ b/examples/30_gql/gql_gql-string_gql-typed__gql-string-typed.ts @@ -4,7 +4,7 @@ * of automation would generate the types for you. */ -import { Graffle, type TypedDocumentString } from '../../src/entrypoints/main.js' +import { Graffle, type TypedDocument } from '../../src/entrypoints/main.js' import { publicGraphQLSchemaEndpoints, show } from '../$/helpers.js' const graffle = Graffle.create({ @@ -17,7 +17,7 @@ const graffle = Graffle.create({ * @see https://the-guild.dev/graphql/codegen/plugins/presets/preset-client#documentmode * @see https://github.com/jasonkuhrt/graffle/issues/997 */ -type Document = TypedDocumentString< +type Document = TypedDocument.String< { pokemonByName: { id: string @@ -47,9 +47,6 @@ const document: Document = /* gql */ ` } ` -const data = await graffle.rawString({ - document, - variables: { name: `Pikachu` }, -}) +const data = await graffle.gql(document).send({ name: `Pikachu` }) show(data?.pokemonByName) diff --git a/examples/30_raw/raw_rawDocumentNode_rawTyped__raw-document-node-typed.ts b/examples/30_raw/raw_rawDocumentNode_rawTyped__raw-document-node-typed.ts deleted file mode 100644 index 3432e4bd..00000000 --- a/examples/30_raw/raw_rawDocumentNode_rawTyped__raw-document-node-typed.ts +++ /dev/null @@ -1,93 +0,0 @@ -/** - * This example shows how to send a request using a Document instance for the GraphQL document while also being typesafe in regards to the passed variables and return type. - */ - -import type { TypedQueryDocumentNode } from 'graphql' -import { gql, Graffle } from '../../src/entrypoints/main.js' -import { publicGraphQLSchemaEndpoints, show } from '../$/helpers.js' - -const graffle = Graffle.create({ - schema: publicGraphQLSchemaEndpoints.Pokemon, -}) - -/*************************************** Variation 1 *************************************** - * - - * - - * - - * You can pass type variables to the `gql` template tag. - * - - */ - -{ - const document = gql< - { - pokemonByName: { - id: string - name: string - hp: number - attack: number - defense: number - trainer: { name: string } - } - }, - { name: string } - >` - query ($name: String!) { - pokemonByName (name: $name) { - name - hp - attack - defense - trainer { - name - } - } - } - ` - - const data = await graffle.raw({ document, variables: { name: `Pikachu` } }) - - show(data?.pokemonByName) -} - -/*************************************** Variation 2 *************************************** - * - - * - - * - - * You can also cast the type if you have a reference to a pre constructed type. - * - - */ - -{ - type Document = TypedQueryDocumentNode< - { - pokemonByName: { - id: string - name: string - hp: number - attack: number - defense: number - trainer: { name: string } - } - }, - { name: string } - > - - const document: Document = gql` - query ($name: String!) { - pokemonByName (name: $name) { - name - hp - attack - defense - trainer { - name - } - } - } - ` - - const data = await graffle.raw({ document, variables: { name: `Pikachu` } }) - - show(data?.pokemonByName) -} diff --git a/examples/40_other/transport-memory.ts b/examples/40_other/transport-memory.ts index 6ee7cfce..e5d12e6c 100644 --- a/examples/40_other/transport-memory.ts +++ b/examples/40_other/transport-memory.ts @@ -20,6 +20,10 @@ const schema = new GraphQLSchema({ const graffle = Graffle.create({ schema }) -const data = await graffle.rawString({ document: `{ foo }` }) +const data = await graffle.gql` + { + foo + } +`.send() showJson(data) diff --git a/examples/50_anyware/anyware_slot_slot-body__slot-body.ts b/examples/50_anyware/anyware_slot_slot-body__slot-body.ts index 96d8e786..e4912885 100644 --- a/examples/50_anyware/anyware_slot_slot-body__slot-body.ts +++ b/examples/50_anyware/anyware_slot_slot-body__slot-body.ts @@ -19,16 +19,13 @@ const graffle = Graffle }) }) -const result = await graffle.rawString({ - document: ` +const result = await graffle.gql` query pokemon { trainers { name } } query trainers { pokemon { name } } - `, - operationName: `pokemon`, -}) + `.send(`pokemon`) show(result) diff --git a/examples/50_anyware/anyware_slot_slot-body__slot-search-params.ts b/examples/50_anyware/anyware_slot_slot-body__slot-search-params.ts index d4e112b2..1b77d35e 100644 --- a/examples/50_anyware/anyware_slot_slot-body__slot-search-params.ts +++ b/examples/50_anyware/anyware_slot_slot-body__slot-search-params.ts @@ -19,16 +19,14 @@ const graffle = Graffle }) }) -const result = await graffle.rawString({ - document: ` +const result = await graffle.gql` query trainers { pokemon { name } } query pokemon { trainers { name } } - `, - operationName: `queryCountries`, -}) + ` + .send(`queryCountries`) show(result) diff --git a/examples/50_anyware/anyware_slot_slot-fetch__slot-fetch.ts b/examples/50_anyware/anyware_slot_slot-fetch__slot-fetch.ts index 87913a1c..1f1e80eb 100644 --- a/examples/50_anyware/anyware_slot_slot-fetch__slot-fetch.ts +++ b/examples/50_anyware/anyware_slot_slot-fetch__slot-fetch.ts @@ -10,14 +10,18 @@ const graffle = Graffle return await exchange({ using: { fetch: () => { - return new Response(JSON.stringify({ data: { continents: [{ name: `Earthsea` }] } })) + return new Response(JSON.stringify({ data: { trainers: [{ name: `Jason` }] } })) }, }, }) }) -const result = await graffle.rawString({ - document: `query { continents { name } }`, -}) +const result = await graffle.gql` + query { + trainers { + name + } + } +`.send() show(result) diff --git a/examples/60_extension/extension_opentelemetry__opentelemetry.ts b/examples/60_extension/extension_opentelemetry__opentelemetry.ts index 7e9a73d0..b976b10a 100644 --- a/examples/60_extension/extension_opentelemetry__opentelemetry.ts +++ b/examples/60_extension/extension_opentelemetry__opentelemetry.ts @@ -16,5 +16,5 @@ provider.addSpanProcessor(processor) provider.register() const graffle = Pokemon.create().use(Opentelemetry()) -const data = await graffle.rawString({ document: `query { pokemons { name } }` }) +const data = await graffle.gql`query { pokemons { name } }`.send() show(data) diff --git a/examples/__outputs__/10_transport-http/transport-http_extension_headers__dynamicHeaders.output.txt b/examples/__outputs__/10_transport-http/transport-http_extension_headers__dynamicHeaders.output.txt index 1f57fafe..7635113d 100644 --- a/examples/__outputs__/10_transport-http/transport-http_extension_headers__dynamicHeaders.output.txt +++ b/examples/__outputs__/10_transport-http/transport-http_extension_headers__dynamicHeaders.output.txt @@ -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': '1727803644880' + 'x-sent-at-time': '1728318376823' }, signal: undefined, method: 'post', diff --git a/examples/__outputs__/20_output/output_envelope.output.txt b/examples/__outputs__/20_output/output_envelope.output.txt index 87b8501a..ac58b41f 100644 --- a/examples/__outputs__/20_output/output_envelope.output.txt +++ b/examples/__outputs__/20_output/output_envelope.output.txt @@ -18,7 +18,7 @@ headers: Headers { 'content-type': 'application/graphql-response+json; charset=utf-8', 'content-length': '142', - date: 'Tue, 01 Oct 2024 17:27:25 GMT', + date: 'Mon, 07 Oct 2024 16:26:17 GMT', connection: 'keep-alive', 'keep-alive': 'timeout=5' }, diff --git a/examples/__outputs__/20_output/output_envelope_envelope-error__envelope-error.output.txt b/examples/__outputs__/20_output/output_envelope_envelope-error__envelope-error.output.txt index 202ffbda..143379df 100644 --- a/examples/__outputs__/20_output/output_envelope_envelope-error__envelope-error.output.txt +++ b/examples/__outputs__/20_output/output_envelope_envelope-error__envelope-error.output.txt @@ -4,9 +4,8 @@ ContextualError: There was an error in the extension "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 Object.run (/some/path/to/main.ts:XX:XX:22) - at async run (/some/path/to/client.ts:XX:XX:20) - at async executeDocument (/some/path/to/client.ts:XX:XX:12) - at async executeRootTypeField (/some/path/to/client.ts:XX:XX:20) + at async executeDocument (/some/path/to/requestMethods.ts:XX:XX:18) + at async executeRootTypeField (/some/path/to/requestMethods.ts:XX:XX:18) at async (/some/path/to/output_envelope_envelope-error__envelope-error.ts:XX:XX:16) { context: { hookName: 'encode', diff --git a/examples/__outputs__/20_output/output_envelope_envelope_error-throw__envelope-error-throw.output.txt b/examples/__outputs__/20_output/output_envelope_envelope_error-throw__envelope-error-throw.output.txt index 07e0bdd3..cc41ef40 100644 --- a/examples/__outputs__/20_output/output_envelope_envelope_error-throw__envelope-error-throw.output.txt +++ b/examples/__outputs__/20_output/output_envelope_envelope_error-throw__envelope-error-throw.output.txt @@ -6,9 +6,8 @@ ContextualError: There was an error in the extension "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 Object.run (/some/path/to/main.ts:XX:XX:22) - at async run (/some/path/to/client.ts:XX:XX:20) - at async executeDocument (/some/path/to/client.ts:XX:XX:12) - at async executeRootTypeField (/some/path/to/client.ts:XX:XX:20) + at async executeDocument (/some/path/to/requestMethods.ts:XX:XX:18) + at async executeRootTypeField (/some/path/to/requestMethods.ts:XX:XX:18) at async (/some/path/to/output_envelope_envelope_error-throw__envelope-error-throw.ts:XX:XX:1) { context: { hookName: 'encode', diff --git a/examples/__outputs__/20_output/output_preset__standard-graphql.output.txt b/examples/__outputs__/20_output/output_preset__standard-graphql.output.txt index 5513762f..5a3306ff 100644 --- a/examples/__outputs__/20_output/output_preset__standard-graphql.output.txt +++ b/examples/__outputs__/20_output/output_preset__standard-graphql.output.txt @@ -7,17 +7,14 @@ ContextualError: There was an error in the core implementation of hook "exchange at runPipeline (/some/path/to/runPipeline.ts:XX:XX:18) at async runPipeline (/some/path/to/runPipeline.ts:XX:XX:14) at async runPipeline (/some/path/to/runPipeline.ts:XX:XX:14) - ... 3 lines matching cause stack trace ... - at async Object.raw (/some/path/to/client.ts:XX:XX:14) - at async Proxy.rawString (/some/path/to/client.ts:XX:XX:14) + ... 2 lines matching cause stack trace ... at async (/some/path/to/output_preset__standard-graphql.ts:XX:XX:16) { context: { hookName: 'exchange', source: 'implementation' }, [cause]: TypeError: Failed to parse URL from ... at new Request (node:internal/deps/undici/undici:XX:XX) at Object.run (/some/path/to/core.ts:XX:XX:29) ... 6 lines matching cause stack trace ... - at async runRaw (/some/path/to/client.ts:XX:XX:12) - at async Object.raw (/some/path/to/client.ts:XX:XX:14) { + at async (/some/path/to/output_preset__standard-graphql.ts:XX:XX:16) { [cause]: TypeError: Invalid URL at new URL (node:internal/url:XX:XX) at new Request (node:internal/deps/undici/undici:XX:XX) @@ -27,8 +24,8 @@ ContextualError: There was an error in the core implementation of hook "exchange at runPipeline (/some/path/to/runPipeline.ts:XX:XX:20) at async runPipeline (/some/path/to/runPipeline.ts:XX:XX:14) at async Object.run (/some/path/to/main.ts:XX:XX:22) - at async run (/some/path/to/client.ts:XX:XX:20) - at async runRaw (/some/path/to/client.ts:XX:XX:12) { + at async Object.send (/some/path/to/gql.ts:XX:XX:26) + at async (/some/path/to/output_preset__standard-graphql.ts:XX:XX:16) { code: 'ERR_INVALID_URL', input: '...' } diff --git a/examples/__outputs__/20_output/output_return-error.output.txt b/examples/__outputs__/20_output/output_return-error.output.txt index 75405dc3..ff2c67ae 100644 --- a/examples/__outputs__/20_output/output_return-error.output.txt +++ b/examples/__outputs__/20_output/output_return-error.output.txt @@ -2,9 +2,8 @@ ContextualError: There was an error in the extension "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 Object.run (/some/path/to/main.ts:XX:XX:22) - at async run (/some/path/to/client.ts:XX:XX:20) - at async executeDocument (/some/path/to/client.ts:XX:XX:12) - at async executeRootTypeField (/some/path/to/client.ts:XX:XX:20) + at async executeDocument (/some/path/to/requestMethods.ts:XX:XX:18) + at async executeRootTypeField (/some/path/to/requestMethods.ts:XX:XX:18) at async (/some/path/to/output_return-error.ts:XX:XX:18) { context: { hookName: 'encode', diff --git a/examples/__outputs__/20_output/output_return-error_return-error-execution__return-error-execution.output.txt b/examples/__outputs__/20_output/output_return-error_return-error-execution__return-error-execution.output.txt index 7544a138..d7470d59 100644 --- a/examples/__outputs__/20_output/output_return-error_return-error-execution__return-error-execution.output.txt +++ b/examples/__outputs__/20_output/output_return-error_return-error-execution__return-error-execution.output.txt @@ -1,10 +1,9 @@ ---------------------------------------- SHOW ---------------------------------------- ContextualAggregateError: One or more errors in the execution result. at handleOutput (/some/path/to/handleOutput.ts:XX:XX:19) - at run (/some/path/to/client.ts:XX:XX:12) + at executeDocument (/some/path/to/requestMethods.ts:XX:XX:10) at process.processTicksAndRejections (node:internal/process/task_queues:XX:XX) - at async executeDocument (/some/path/to/client.ts:XX:XX:12) - at async executeRootTypeField (/some/path/to/client.ts:XX:XX:20) + at async executeRootTypeField (/some/path/to/requestMethods.ts:XX:XX:18) at async (/some/path/to/output_return-error_return-error-execution__return-error-execution.ts:XX:XX:16) { context: {}, cause: undefined, @@ -39,9 +38,8 @@ ContextualError: There was an error in the extension "anonymous" (use named func at runPipeline (/some/path/to/runPipeline.ts:XX:XX:18) at process.processTicksAndRejections (node:internal/process/task_queues:XX:XX) at async Object.run (/some/path/to/main.ts:XX:XX:22) - at async run (/some/path/to/client.ts:XX:XX:20) - at async executeDocument (/some/path/to/client.ts:XX:XX:12) - at async executeRootTypeField (/some/path/to/client.ts:XX:XX:20) + at async executeDocument (/some/path/to/requestMethods.ts:XX:XX:18) + at async executeRootTypeField (/some/path/to/requestMethods.ts:XX:XX:18) at async (/some/path/to/output_return-error_return-error-execution__return-error-execution.ts:XX:XX:3) { context: { hookName: 'encode', diff --git a/examples/__outputs__/30_gql/gql_gql-document-node.output.txt b/examples/__outputs__/30_gql/gql_gql-document-node.output.txt new file mode 100644 index 00000000..fed5cefe --- /dev/null +++ b/examples/__outputs__/30_gql/gql_gql-document-node.output.txt @@ -0,0 +1,4 @@ +---------------------------------------- SHOW ---------------------------------------- +{ + pokemonByName: [ { name: 'Pikachu', trainer: { name: 'Ash' } } ] +} \ No newline at end of file diff --git a/examples/__outputs__/30_raw/raw_rawString_rawTyped__rawString-typed.output.txt b/examples/__outputs__/30_gql/gql_gql-document-node_gql-typed_gql-document-node-typed__gql-document-node-typed.output.txt similarity index 100% rename from examples/__outputs__/30_raw/raw_rawString_rawTyped__rawString-typed.output.txt rename to examples/__outputs__/30_gql/gql_gql-document-node_gql-typed_gql-document-node-typed__gql-document-node-typed.output.txt diff --git a/examples/__outputs__/30_raw/raw_rawString__rawString.output.txt b/examples/__outputs__/30_gql/gql_gql-string.output.txt similarity index 100% rename from examples/__outputs__/30_raw/raw_rawString__rawString.output.txt rename to examples/__outputs__/30_gql/gql_gql-string.output.txt diff --git a/examples/__outputs__/30_gql/gql_gql-string_gql-typed__gql-string-typed.output.txt b/examples/__outputs__/30_gql/gql_gql-string_gql-typed__gql-string-typed.output.txt new file mode 100644 index 00000000..496c7eaf --- /dev/null +++ b/examples/__outputs__/30_gql/gql_gql-string_gql-typed__gql-string-typed.output.txt @@ -0,0 +1,10 @@ +---------------------------------------- SHOW ---------------------------------------- +[ + { + name: 'Pikachu', + hp: 35, + attack: 55, + defense: 40, + trainer: { name: 'Ash' } + } +] \ No newline at end of file diff --git a/examples/__outputs__/30_raw/raw_rawDocumentNode__raw-document-node.output.txt b/examples/__outputs__/30_raw/raw_rawDocumentNode__raw-document-node.output.txt deleted file mode 100644 index 447197dd..00000000 --- a/examples/__outputs__/30_raw/raw_rawDocumentNode__raw-document-node.output.txt +++ /dev/null @@ -1,30 +0,0 @@ -/some/path/to/handleOutput.ts:XX:XX - const error = new Errors.ContextualAggregateError( - ^ - - -ContextualAggregateError: One or more errors in the execution result. - at handleOutput (/some/path/to/handleOutput.ts:XX:XX:19) - at run (/some/path/to/client.ts:XX:XX:12) - at process.processTicksAndRejections (node:internal/process/task_queues:XX:XX) - at async runRaw (/some/path/to/client.ts:XX:XX:12) - at async Proxy.raw (/some/path/to/client.ts:XX:XX:14) - at async (/some/path/to/raw_rawDocumentNode__raw-document-node.ts:XX:XX:14) { - context: {}, - cause: undefined, - errors: [ - GraphQLError: Cannot query field "continent" on type "Pokemon". - at (/some/path/to/graphqlHTTP.ts:XX:XX:47) - at Array.map () - at parseExecutionResult (/some/path/to/graphqlHTTP.ts:XX:XX:28) - at Object.unpack (/some/path/to/core.ts:XX:XX:26) - at process.processTicksAndRejections (node:internal/process/task_queues:XX:XX) - at async runHook (/some/path/to/runHook.ts:XX:XX:16) { - path: undefined, - locations: undefined, - extensions: [Object: null prototype] {} - } - ] -} - -Node.js vXX.XX.XX \ No newline at end of file diff --git a/examples/__outputs__/30_raw/raw_rawDocumentNode_rawTyped__raw-document-node-typed.output.txt b/examples/__outputs__/30_raw/raw_rawDocumentNode_rawTyped__raw-document-node-typed.output.txt deleted file mode 100644 index 167e26cd..00000000 --- a/examples/__outputs__/30_raw/raw_rawDocumentNode_rawTyped__raw-document-node-typed.output.txt +++ /dev/null @@ -1,20 +0,0 @@ ----------------------------------------- SHOW ---------------------------------------- -[ - { - name: 'Pikachu', - hp: 35, - attack: 55, - defense: 40, - trainer: { name: 'Ash' } - } -] ----------------------------------------- SHOW ---------------------------------------- -[ - { - name: 'Pikachu', - hp: 35, - attack: 55, - defense: 40, - trainer: { name: 'Ash' } - } -] \ No newline at end of file diff --git a/examples/__outputs__/50_anyware/anyware_slot_slot-body__slot-search-params.output.txt b/examples/__outputs__/50_anyware/anyware_slot_slot-body__slot-search-params.output.txt index cea0de9c..102c598a 100644 --- a/examples/__outputs__/50_anyware/anyware_slot_slot-body__slot-search-params.output.txt +++ b/examples/__outputs__/50_anyware/anyware_slot_slot-body__slot-search-params.output.txt @@ -7,10 +7,7 @@ ContextualError: There was an error in the core implementation of hook "pack". at runPipeline (/some/path/to/runPipeline.ts:XX:XX:18) at async runPipeline (/some/path/to/runPipeline.ts:XX:XX:14) at async Object.run (/some/path/to/main.ts:XX:XX:22) - at async run (/some/path/to/client.ts:XX:XX:20) - at async runRaw (/some/path/to/client.ts:XX:XX:12) - at async Object.raw (/some/path/to/client.ts:XX:XX:14) - at async Proxy.rawString (/some/path/to/client.ts:XX:XX:14) + at async Object.send (/some/path/to/gql.ts:XX:XX:26) at async (/some/path/to/anyware_slot_slot-body__slot-search-params.ts:XX:XX:16) { context: { hookName: 'pack', source: 'implementation' }, cause: Error: Unexpected null value. diff --git a/examples/__outputs__/50_anyware/anyware_slot_slot-fetch__slot-fetch.output.txt b/examples/__outputs__/50_anyware/anyware_slot_slot-fetch__slot-fetch.output.txt index 9b6a8e26..004a2e76 100644 --- a/examples/__outputs__/50_anyware/anyware_slot_slot-fetch__slot-fetch.output.txt +++ b/examples/__outputs__/50_anyware/anyware_slot_slot-fetch__slot-fetch.output.txt @@ -1,2 +1,2 @@ ---------------------------------------- SHOW ---------------------------------------- -{ continents: [ { name: 'Earthsea' } ] } \ No newline at end of file +{ trainers: [ { name: 'Jason' } ] } \ No newline at end of file diff --git a/examples/__outputs__/60_extension/extension_opentelemetry__opentelemetry.output.txt b/examples/__outputs__/60_extension/extension_opentelemetry__opentelemetry.output.txt index b76404a6..43839f64 100644 --- a/examples/__outputs__/60_extension/extension_opentelemetry__opentelemetry.output.txt +++ b/examples/__outputs__/60_extension/extension_opentelemetry__opentelemetry.output.txt @@ -9,14 +9,14 @@ } }, instrumentationScope: { name: 'graffle', version: undefined, schemaUrl: undefined }, - traceId: 'd7f120898ea4e086c016a9328aeb4588', - parentId: '8977b7ec1a73aa42', + traceId: '1a56566cbf32cac1ab51f61c2296386d', + parentId: 'e9e71e5ac59a4abf', traceState: undefined, name: 'encode', - id: '5c86f62c08b7f3bd', + id: '5dd0dda86a63442a', kind: 0, - timestamp: 1727803645728000, - duration: 748.709, + timestamp: 1728318378110000, + duration: 592.375, attributes: {}, status: { code: 0 }, events: [], @@ -33,14 +33,14 @@ } }, instrumentationScope: { name: 'graffle', version: undefined, schemaUrl: undefined }, - traceId: 'd7f120898ea4e086c016a9328aeb4588', - parentId: '8977b7ec1a73aa42', + traceId: '1a56566cbf32cac1ab51f61c2296386d', + parentId: 'e9e71e5ac59a4abf', traceState: undefined, name: 'pack', - id: 'ac44e7f088223e59', + id: 'c6a933e2385f4f29', kind: 0, - timestamp: 1727803645732000, - duration: 12910.625, + timestamp: 1728318378112000, + duration: 263004.291, attributes: {}, status: { code: 0 }, events: [], @@ -57,14 +57,14 @@ } }, instrumentationScope: { name: 'graffle', version: undefined, schemaUrl: undefined }, - traceId: 'd7f120898ea4e086c016a9328aeb4588', - parentId: '8977b7ec1a73aa42', + traceId: '1a56566cbf32cac1ab51f61c2296386d', + parentId: 'e9e71e5ac59a4abf', traceState: undefined, name: 'exchange', - id: '07c6d24729766b4d', + id: '99259acfe1a55e81', kind: 0, - timestamp: 1727803645745000, - duration: 21332.375, + timestamp: 1728318378377000, + duration: 46421.75, attributes: {}, status: { code: 0 }, events: [], @@ -81,14 +81,14 @@ } }, instrumentationScope: { name: 'graffle', version: undefined, schemaUrl: undefined }, - traceId: 'd7f120898ea4e086c016a9328aeb4588', - parentId: '8977b7ec1a73aa42', + traceId: '1a56566cbf32cac1ab51f61c2296386d', + parentId: 'e9e71e5ac59a4abf', traceState: undefined, name: 'unpack', - id: '14366c75d72eb1d4', + id: '0cef5ce8392b53a8', kind: 0, - timestamp: 1727803645767000, - duration: 1140.625, + timestamp: 1728318378424000, + duration: 1580.666, attributes: {}, status: { code: 0 }, events: [], @@ -105,14 +105,14 @@ } }, instrumentationScope: { name: 'graffle', version: undefined, schemaUrl: undefined }, - traceId: 'd7f120898ea4e086c016a9328aeb4588', - parentId: '8977b7ec1a73aa42', + traceId: '1a56566cbf32cac1ab51f61c2296386d', + parentId: 'e9e71e5ac59a4abf', traceState: undefined, name: 'decode', - id: 'e89206579d516345', + id: '8e7ed7776dfe35b5', kind: 0, - timestamp: 1727803645768000, - duration: 192.958, + timestamp: 1728318378426000, + duration: 207.167, attributes: {}, status: { code: 0 }, events: [], @@ -129,14 +129,14 @@ } }, instrumentationScope: { name: 'graffle', version: undefined, schemaUrl: undefined }, - traceId: 'd7f120898ea4e086c016a9328aeb4588', + traceId: '1a56566cbf32cac1ab51f61c2296386d', parentId: undefined, traceState: undefined, name: 'request', - id: '8977b7ec1a73aa42', + id: 'e9e71e5ac59a4abf', kind: 0, - timestamp: 1727803645728000, - duration: 40803.792, + timestamp: 1728318378109000, + duration: 316401.583, attributes: {}, status: { code: 0 }, events: [], diff --git a/package.json b/package.json index 90a7732d..bb54703b 100644 --- a/package.json +++ b/package.json @@ -124,7 +124,7 @@ }, "devDependencies": { "@arethetypeswrong/cli": "^0.16.4", - "@ark/attest": "^0.21.0", + "@ark/attest": "^0.22.0", "@opentelemetry/api": "^1.9.0", "@opentelemetry/sdk-trace-base": "^1.26.0", "@opentelemetry/sdk-trace-node": "^1.26.0", @@ -141,8 +141,8 @@ "async-cleanup": "^1.0.0", "doctoc": "^2.2.1", "dripip": "^0.10.0", - "es-toolkit": "^1.23.0", - "eslint": "^9.11.1", + "es-toolkit": "^1.24.0", + "eslint": "^9.12.0", "eslint-config-prisma": "^0.6.0", "eslint-plugin-deprecation": "^3.0.0", "eslint-plugin-only-warn": "^1.1.0", @@ -165,8 +165,8 @@ "type-fest": "^4.26.1", "typescript": "^5.6.2", "typescript-eslint": "^8.8.0", - "vitepress": "^1.3.4", - "vitest": "^2.1.1", + "vitepress": "^1.4.0", + "vitest": "^2.1.2", "zod": "^3.23.8" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index dded5522..3e83fef1 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -31,8 +31,8 @@ importers: specifier: ^0.16.4 version: 0.16.4 '@ark/attest': - specifier: ^0.21.0 - version: 0.21.0(typescript@5.6.2) + specifier: ^0.22.0 + version: 0.22.0(typescript@5.6.2) '@opentelemetry/api': specifier: ^1.9.0 version: 1.9.0 @@ -68,10 +68,10 @@ importers: version: 22.7.4 '@typescript-eslint/eslint-plugin': specifier: ^8.8.0 - version: 8.8.0(@typescript-eslint/parser@8.8.0(eslint@9.11.1)(typescript@5.6.2))(eslint@9.11.1)(typescript@5.6.2) + version: 8.8.0(@typescript-eslint/parser@8.8.0(eslint@9.12.0)(typescript@5.6.2))(eslint@9.12.0)(typescript@5.6.2) '@typescript-eslint/parser': specifier: ^8.8.0 - version: 8.8.0(eslint@9.11.1)(typescript@5.6.2) + version: 8.8.0(eslint@9.12.0)(typescript@5.6.2) async-cleanup: specifier: ^1.0.0 version: 1.0.0 @@ -82,32 +82,32 @@ importers: specifier: ^0.10.0 version: 0.10.0 es-toolkit: - specifier: ^1.23.0 - version: 1.23.0 + specifier: ^1.24.0 + version: 1.24.0 eslint: - specifier: ^9.11.1 - version: 9.11.1 + specifier: ^9.12.0 + version: 9.12.0 eslint-config-prisma: specifier: ^0.6.0 - version: 0.6.0(@typescript-eslint/eslint-plugin@8.8.0(@typescript-eslint/parser@8.8.0(eslint@9.11.1)(typescript@5.6.2))(eslint@9.11.1)(typescript@5.6.2))(@typescript-eslint/parser@8.8.0(eslint@9.11.1)(typescript@5.6.2))(eslint-plugin-deprecation@3.0.0(eslint@9.11.1)(typescript@5.6.2))(eslint-plugin-only-warn@1.1.0)(eslint-plugin-prefer-arrow@1.2.3(eslint@9.11.1))(eslint-plugin-tsdoc@0.3.0)(eslint@9.11.1)(typescript@5.6.2) + version: 0.6.0(@typescript-eslint/eslint-plugin@8.8.0(@typescript-eslint/parser@8.8.0(eslint@9.12.0)(typescript@5.6.2))(eslint@9.12.0)(typescript@5.6.2))(@typescript-eslint/parser@8.8.0(eslint@9.12.0)(typescript@5.6.2))(eslint-plugin-deprecation@3.0.0(eslint@9.12.0)(typescript@5.6.2))(eslint-plugin-only-warn@1.1.0)(eslint-plugin-prefer-arrow@1.2.3(eslint@9.12.0))(eslint-plugin-tsdoc@0.3.0)(eslint@9.12.0)(typescript@5.6.2) eslint-plugin-deprecation: specifier: ^3.0.0 - version: 3.0.0(eslint@9.11.1)(typescript@5.6.2) + version: 3.0.0(eslint@9.12.0)(typescript@5.6.2) eslint-plugin-only-warn: specifier: ^1.1.0 version: 1.1.0 eslint-plugin-prefer-arrow: specifier: ^1.2.3 - version: 1.2.3(eslint@9.11.1) + version: 1.2.3(eslint@9.12.0) eslint-plugin-simple-import-sort: specifier: ^12.1.1 - version: 12.1.1(eslint@9.11.1) + version: 12.1.1(eslint@9.12.0) eslint-plugin-tsdoc: specifier: ^0.3.0 version: 0.3.0 eslint-typescript: specifier: ^1.1.0 - version: 1.1.0(eslint@9.11.1)(prettier@3.3.3) + version: 1.1.0(eslint@9.12.0)(prettier@3.3.3) execa: specifier: ^9.4.0 version: 9.4.0 @@ -152,12 +152,12 @@ importers: version: 5.6.2 typescript-eslint: specifier: ^8.8.0 - version: 8.8.0(eslint@9.11.1)(typescript@5.6.2) + version: 8.8.0(eslint@9.12.0)(typescript@5.6.2) vitepress: - specifier: ^1.3.4 - version: 1.3.4(@algolia/client-search@5.7.0)(@types/node@22.7.4)(postcss@8.4.47)(search-insights@2.17.2)(typescript@5.6.2) + specifier: ^1.4.0 + version: 1.4.0(@algolia/client-search@5.7.0)(@types/node@22.7.4)(postcss@8.4.47)(search-insights@2.17.2)(typescript@5.6.2) vitest: - specifier: ^2.1.1 + specifier: ^2.1.2 version: 2.1.2(@types/node@22.7.4)(happy-dom@15.7.4)(jsdom@25.0.1) zod: specifier: ^3.23.8 @@ -262,36 +262,36 @@ packages: resolution: {integrity: sha512-RI3HXgSuKTfcBf1hSEg1P9/cOvmI0flsMm6/QL3L3wju4AlHDqd55JFPfXs4pzgEAgy5L9pul4/HPPz99x2GvA==} engines: {node: '>=18'} - '@ark/attest@0.21.0': - resolution: {integrity: sha512-xzK08wPs7DO7KSa2bDHqg1q0Phpv8/9hjKrRQv4hy6IVksPKavMHLRHsOHADkiWQjLfOoj8flS7FBCpWWy5osQ==} + '@ark/attest@0.22.0': + resolution: {integrity: sha512-CghFKQ8GKQ+YL/pN6YfW4c/YAEYJqLIiy/zRMaTurU0zwwYWlVg8jlCD5g4Kcjjrs75aja24oiTIP8beuNTyLw==} hasBin: true peerDependencies: typescript: '*' - '@ark/fs@0.16.0': - resolution: {integrity: sha512-yuuD6FyZd5Z4V8o5SYfbKtcp/wtgX+A/gJZD5DwCME1tWOJlGbck1USCqNH7bpu3/vkJs5+VHk1cWQK+tJKlWw==} + '@ark/fs@0.17.0': + resolution: {integrity: sha512-1gsiqLICP2VatBKQ1BqCqbJT42Jjhwzdlcf7xYFr86JKWkyATqdXaLYGbqhYDgJQsfoFWFs4M2do4Y+BgqF6Tw==} - '@ark/schema@0.16.0': - resolution: {integrity: sha512-Zn+zaMdteyQF73pSVw9OU1M3fMmhSemCAdwYGhxJ302DqnqvVEeEDlB03plSKTCV98zYAMA6gYcEvqxDTpfIDg==} + '@ark/schema@0.17.0': + resolution: {integrity: sha512-k8HhF35UlUjNfyBrYna4YTMTjufu3Ez2mPQ5CMHpEt5Qi15Zze6g5HHlOC79gDAWJ+u2qcp2QY55L+GYY7CLVQ==} - '@ark/util@0.16.0': - resolution: {integrity: sha512-CnNzu0vLO3/y1Kml4mDNFnhk9r9uulfXDjYhrLNyOMpC4oUHeTL1ZLBuuevPTN0UovOMZA9uG9aMXLm7YWQ/4A==} + '@ark/util@0.17.0': + resolution: {integrity: sha512-bp17dQitBvkvtiVmb2XeSposr098nZx70h3/tlpfjElbkFeFwkGu6sSUS+jP/FZSIydNby+KBETiKnb235Ua0A==} - '@babel/helper-string-parser@7.24.8': - resolution: {integrity: sha512-pO9KhhRcuUyGnJWwyEgnRJTSIZHiT+vMD0kPeD+so0l7mxkMT19g3pjY9GTnHySck/hDzq+dtW/4VgnMkippsQ==} + '@babel/helper-string-parser@7.25.7': + resolution: {integrity: sha512-CbkjYdsJNHFk8uqpEkpCvRs3YRp9tY6FmFY7wLMSYuGYkrdUi7r2lc4/wqsvlHoMznX3WJ9IP8giGPq68T/Y6g==} engines: {node: '>=6.9.0'} - '@babel/helper-validator-identifier@7.24.7': - resolution: {integrity: sha512-rR+PBcQ1SMQDDyF6X0wxtG8QyLCgUB0eRAGguqRLfkCA87l7yAP7ehq8SNj96OOGTO8OBV70KhuFYcIkHXOg0w==} + '@babel/helper-validator-identifier@7.25.7': + resolution: {integrity: sha512-AM6TzwYqGChO45oiuPqwL2t20/HdMC1rTPAesnBCgPCSF1x3oN9MVUwQV2iyz4xqWrctwK5RNC8LV22kaQCNYg==} engines: {node: '>=6.9.0'} - '@babel/parser@7.25.6': - resolution: {integrity: sha512-trGdfBdbD0l1ZPmcJ83eNxB9rbEax4ALFTF7fN386TMYbeCQbyme5cOEXQhbGXKebwGaB/J52w1mrklMcbgy6Q==} + '@babel/parser@7.25.7': + resolution: {integrity: sha512-aZn7ETtQsjjGG5HruveUK06cU3Hljuhd9Iojm4M8WWv3wLE6OkE5PWbDUkItmMgegmccaITudyuW5RPYrYlgWw==} engines: {node: '>=6.0.0'} hasBin: true - '@babel/types@7.25.6': - resolution: {integrity: sha512-/l42B1qxpG6RdfYf343Uw1vmDjeNhneUXtzhojE7pDgfpEypmRhI6j1kr17XCVv4Cgl9HdAiQY2x0GwKm7rWCw==} + '@babel/types@7.25.7': + resolution: {integrity: sha512-vwIVdXG+j+FOpkwqHRcBgHLYNL7XMkufrlaFvL9o6Ai9sJn9+PdyIL5qa0XzTZw084c+u9LOls53eoZWP/W5WQ==} engines: {node: '>=6.9.0'} '@colors/colors@1.5.0': @@ -678,8 +678,8 @@ packages: resolution: {integrity: sha512-4Bfj15dVJdoy3RfZmmo86RK1Fwzn6SstsvK9JS+BaVKqC6QQQQyXekNaC+g+LKNgkQ+2VhGAzm6hO40AhMR3zQ==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - '@eslint/js@9.11.1': - resolution: {integrity: sha512-/qu+TWz8WwPWc7/HcIJKi+c+MOm46GdVaSlTTQcaqaL53+GsoA6MxWp5PtTx48qbSP7ylM1Kn7nhvkugfJvRSA==} + '@eslint/js@9.12.0': + resolution: {integrity: sha512-eohesHH8WFRUprDNyEREgqP6beG6htMeUYeCpkEgBCieCMme5r9zFWjzAJp//9S+Kub4rqE+jXe9Cp1a7IYIIA==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} '@eslint/object-schema@2.1.4': @@ -731,12 +731,20 @@ packages: resolution: {integrity: sha512-w+liuBySifrstuHbFrHoHAEyVnDFVib+073q8AeAJ/qqJfvFvAwUPLLtNohR/WDVRgSasfXtl3dcNuVJWN+rjg==} engines: {node: '>=18.0.0'} + '@humanfs/core@0.19.0': + resolution: {integrity: sha512-2cbWIHbZVEweE853g8jymffCA+NCMiuqeECeBBLm8dg2oFdjuGJhgN4UAbI+6v0CKbbhvtXA4qV8YR5Ji86nmw==} + engines: {node: '>=18.18.0'} + + '@humanfs/node@0.16.5': + resolution: {integrity: sha512-KSPA4umqSG4LHYRodq31VDwKAvaTF4xmVlzM8Aeh4PlU1JQ3IG0wiA8C25d3RQ9nJyM3mBHyI53K06VVL/oFFg==} + engines: {node: '>=18.18.0'} + '@humanwhocodes/module-importer@1.0.1': resolution: {integrity: sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==} engines: {node: '>=12.22'} - '@humanwhocodes/retry@0.3.0': - resolution: {integrity: sha512-d2CGZR2o7fS6sWB7DG/3a95bGKQyHMACZ5aW8qGkkqQpUoZV6C0X7Pc7l4ZNMZkfNBf4VWNe9E1jRsf0G146Ew==} + '@humanwhocodes/retry@0.3.1': + resolution: {integrity: sha512-JBxkERygn7Bv/GbN5Rv8Ul6LVknS+5Bp6RgDC/O8gEBU/yeH5Ui5C/OlWrTb6qct7LjjfT6Re2NxB0ln0yYybA==} engines: {node: '>=18.18'} '@jridgewell/sourcemap-codec@1.5.0': @@ -1025,23 +1033,23 @@ packages: '@sec-ant/readable-stream@0.4.1': resolution: {integrity: sha512-831qok9r2t8AlxLko40y2ebgSDhenenCatLVeW/uBtnHPyhHOvG0C7TvfgecV+wHzIm5KUICgzmVpWS+IMEAeg==} - '@shikijs/core@1.21.0': - resolution: {integrity: sha512-zAPMJdiGuqXpZQ+pWNezQAk5xhzRXBNiECFPcJLtUdsFM3f//G95Z15EHTnHchYycU8kIIysqGgxp8OVSj1SPQ==} + '@shikijs/core@1.22.0': + resolution: {integrity: sha512-S8sMe4q71TJAW+qG93s5VaiihujRK6rqDFqBnxqvga/3LvqHEnxqBIOPkt//IdXVtHkQWKu4nOQNk0uBGicU7Q==} - '@shikijs/engine-javascript@1.21.0': - resolution: {integrity: sha512-jxQHNtVP17edFW4/0vICqAVLDAxmyV31MQJL4U/Kg+heQALeKYVOWo0sMmEZ18FqBt+9UCdyqGKYE7bLRtk9mg==} + '@shikijs/engine-javascript@1.22.0': + resolution: {integrity: sha512-AeEtF4Gcck2dwBqCFUKYfsCq0s+eEbCEbkUuFou53NZ0sTGnJnJ/05KHQFZxpii5HMXbocV9URYVowOP2wH5kw==} - '@shikijs/engine-oniguruma@1.21.0': - resolution: {integrity: sha512-AIZ76XocENCrtYzVU7S4GY/HL+tgHGbVU+qhiDyNw1qgCA5OSi4B4+HY4BtAoJSMGuD/L5hfTzoRVbzEm2WTvg==} + '@shikijs/engine-oniguruma@1.22.0': + resolution: {integrity: sha512-5iBVjhu/DYs1HB0BKsRRFipRrD7rqjxlWTj4F2Pf+nQSPqc3kcyqFFeZXnBMzDf0HdqaFVvhDRAGiYNvyLP+Mw==} - '@shikijs/transformers@1.21.0': - resolution: {integrity: sha512-aA+XGGSzipcvqdsOYL8l6Q2RYiMuJNdhdt9eZnkJmW+wjSOixN/I7dBq3fISwvEMDlawrtuXM3eybLCEC+Fjlg==} + '@shikijs/transformers@1.22.0': + resolution: {integrity: sha512-k7iMOYuGQA62KwAuJOQBgH2IQb5vP8uiB3lMvAMGUgAMMurePOx3Z7oNqJdcpxqZP6I9cc7nc4DNqSKduCxmdg==} - '@shikijs/types@1.21.0': - resolution: {integrity: sha512-tzndANDhi5DUndBtpojEq/42+dpUF2wS7wdCDQaFtIXm3Rd1QkrcVgSSRLOvEwexekihOXfbYJINW37g96tJRw==} + '@shikijs/types@1.22.0': + resolution: {integrity: sha512-Fw/Nr7FGFhlQqHfxzZY8Cwtwk5E9nKDUgeLjZgt3UuhcM3yJR9xj3ZGNravZZok8XmEZMiYkSMTPlPkULB8nww==} - '@shikijs/vscode-textmate@9.2.2': - resolution: {integrity: sha512-TMp15K+GGYrWlZM8+Lnj9EaHEFmOen0WJBrfa17hF7taDOYthuPPV0GWzfd/9iMij0akS/8Yw2ikquH7uVi/fg==} + '@shikijs/vscode-textmate@9.3.0': + resolution: {integrity: sha512-jn7/7ky30idSkd/O5yDBfAnVt+JJpepofP/POZ1iMOxK59cOfqIgg/Dj0eFsjOTMw+4ycJN0uhZH/Eb0bs/EUA==} '@sindresorhus/is@4.6.0': resolution: {integrity: sha512-t09vSN3MdfsyCHoFcTRCH/iUtG7OJ0CsjzB8cjAmKc/va/kIgeDI/TxsigdncE/4be734m0cvIYwNaV4i2XqAw==} @@ -1369,17 +1377,17 @@ packages: '@vitest/utils@2.1.2': resolution: {integrity: sha512-zMO2KdYy6mx56btx9JvAqAZ6EyS3g49krMPPrgOp1yxGZiA93HumGk+bZ5jIZtOg5/VBYl5eBmGRQHqq4FG6uQ==} - '@vue/compiler-core@3.5.10': - resolution: {integrity: sha512-iXWlk+Cg/ag7gLvY0SfVucU8Kh2CjysYZjhhP70w9qI4MvSox4frrP+vDGvtQuzIcgD8+sxM6lZvCtdxGunTAA==} + '@vue/compiler-core@3.5.11': + resolution: {integrity: sha512-PwAdxs7/9Hc3ieBO12tXzmTD+Ln4qhT/56S+8DvrrZ4kLDn4Z/AMUr8tXJD0axiJBS0RKIoNaR0yMuQB9v9Udg==} - '@vue/compiler-dom@3.5.10': - resolution: {integrity: sha512-DyxHC6qPcktwYGKOIy3XqnHRrrXyWR2u91AjP+nLkADko380srsC2DC3s7Y1Rk6YfOlxOlvEQKa9XXmLI+W4ZA==} + '@vue/compiler-dom@3.5.11': + resolution: {integrity: sha512-pyGf8zdbDDRkBrEzf8p7BQlMKNNF5Fk/Cf/fQ6PiUz9at4OaUfyXW0dGJTo2Vl1f5U9jSLCNf0EZJEogLXoeew==} - '@vue/compiler-sfc@3.5.10': - resolution: {integrity: sha512-to8E1BgpakV7224ZCm8gz1ZRSyjNCAWEplwFMWKlzCdP9DkMKhRRwt0WkCjY7jkzi/Vz3xgbpeig5Pnbly4Tow==} + '@vue/compiler-sfc@3.5.11': + resolution: {integrity: sha512-gsbBtT4N9ANXXepprle+X9YLg2htQk1sqH/qGJ/EApl+dgpUBdTv3yP7YlR535uHZY3n6XaR0/bKo0BgwwDniw==} - '@vue/compiler-ssr@3.5.10': - resolution: {integrity: sha512-hxP4Y3KImqdtyUKXDRSxKSRkSm1H9fCvhojEYrnaoWhE4w/y8vwWhnosJoPPe2AXm5sU7CSbYYAgkt2ZPhDz+A==} + '@vue/compiler-ssr@3.5.11': + resolution: {integrity: sha512-P4+GPjOuC2aFTk1Z4WANvEhyOykcvEd5bIj2KVNGKGfM745LaXGr++5njpdBTzVz5pZifdlR1kpYSJJpIlSePA==} '@vue/devtools-api@7.4.6': resolution: {integrity: sha512-XipBV5k0/IfTr0sNBDTg7OBUCp51cYMMXyPxLXJZ4K/wmUeMqt8cVdr2ZZGOFq+si/jTyCYnNxeKoyev5DOUUA==} @@ -1390,22 +1398,22 @@ packages: '@vue/devtools-shared@7.4.6': resolution: {integrity: sha512-rPeSBzElnHYMB05Cc056BQiJpgocQjY8XVulgni+O9a9Gr9tNXgPteSzFFD+fT/iWMxNuUgGKs9CuW5DZewfIg==} - '@vue/reactivity@3.5.10': - resolution: {integrity: sha512-kW08v06F6xPSHhid9DJ9YjOGmwNDOsJJQk0ax21wKaUYzzuJGEuoKNU2Ujux8FLMrP7CFJJKsHhXN9l2WOVi2g==} + '@vue/reactivity@3.5.11': + resolution: {integrity: sha512-Nqo5VZEn8MJWlCce8XoyVqHZbd5P2NH+yuAaFzuNSR96I+y1cnuUiq7xfSG+kyvLSiWmaHTKP1r3OZY4mMD50w==} - '@vue/runtime-core@3.5.10': - resolution: {integrity: sha512-9Q86I5Qq3swSkFfzrZ+iqEy7Vla325M7S7xc1NwKnRm/qoi1Dauz0rT6mTMmscqx4qz0EDJ1wjB+A36k7rl8mA==} + '@vue/runtime-core@3.5.11': + resolution: {integrity: sha512-7PsxFGqwfDhfhh0OcDWBG1DaIQIVOLgkwA5q6MtkPiDFjp5gohVnJEahSktwSFLq7R5PtxDKy6WKURVN1UDbzA==} - '@vue/runtime-dom@3.5.10': - resolution: {integrity: sha512-t3x7ht5qF8ZRi1H4fZqFzyY2j+GTMTDxRheT+i8M9Ph0oepUxoadmbwlFwMoW7RYCpNQLpP2Yx3feKs+fyBdpA==} + '@vue/runtime-dom@3.5.11': + resolution: {integrity: sha512-GNghjecT6IrGf0UhuYmpgaOlN7kxzQBhxWEn08c/SQDxv1yy4IXI1bn81JgEpQ4IXjRxWtPyI8x0/7TF5rPfYQ==} - '@vue/server-renderer@3.5.10': - resolution: {integrity: sha512-IVE97tt2kGKwHNq9yVO0xdh1IvYfZCShvDSy46JIh5OQxP1/EXSpoDqetVmyIzL7CYOWnnmMkVqd7YK2QSWkdw==} + '@vue/server-renderer@3.5.11': + resolution: {integrity: sha512-cVOwYBxR7Wb1B1FoxYvtjJD8X/9E5nlH4VSkJy2uMA1MzYNdzAAB//l8nrmN9py/4aP+3NjWukf9PZ3TeWULaA==} peerDependencies: - vue: 3.5.10 + vue: 3.5.11 - '@vue/shared@3.5.10': - resolution: {integrity: sha512-VkkBhU97Ki+XJ0xvl4C9YJsIZ2uIlQ7HqPpZOS3m9VCvmROPaChZU6DexdMJqvz9tbgG+4EtFVrSuailUq5KGQ==} + '@vue/shared@3.5.11': + resolution: {integrity: sha512-W8GgysJVnFo81FthhzurdRAWP/byq3q2qIw70e0JWblzVhjgOMiC2GyovXrZTFQJnFVryYaKGP3Tc9vYzYm6PQ==} '@vueuse/core@11.1.0': resolution: {integrity: sha512-P6dk79QYA6sKQnghrUz/1tHi0n9mrb/iO1WTMk/ElLmTyNqgDeSZ3wcDf6fRBGzRJbeG1dxzEOvLENMjr+E3fg==} @@ -1524,8 +1532,8 @@ packages: argparse@2.0.1: resolution: {integrity: sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==} - arktype@2.0.0-rc.14: - resolution: {integrity: sha512-kvXsdfNs9r+QFs2iXvdJ4lsymi62JysWoMyE7DxtNq1ojgDgRecn6FEkMh8tHUxlgru5lIm0Qsia3h1xv7uUzg==} + arktype@2.0.0-rc.15: + resolution: {integrity: sha512-jHASe4HqZIzAgwvf7F4u1K9EQE08Ml6m+YGNEkDz4BAkxjSEZxEIev2IBSlMKy3ghN1q6mb8dLUfNaQ4GmgQJg==} array-buffer-byte-length@1.0.1: resolution: {integrity: sha512-ahC5W1xgou+KTXix4sAO8Ki12Q+jf4i0+tmk3sC+zgcynshkHxzpXdImBehiUYKKKDwvfFiJl1tZt6ewscS1Mg==} @@ -1918,8 +1926,8 @@ packages: resolution: {integrity: sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==} engines: {node: '>= 0.4'} - es-toolkit@1.23.0: - resolution: {integrity: sha512-1Caq9T90fX973dnm8BIEBN9l9pffbxxbZYZYwIy/B4g8oFwNTMcbbqzvIWV4XVZlHY6A8RLZvI/3agxF0CmOPA==} + es-toolkit@1.24.0: + resolution: {integrity: sha512-nZM+MRSGhKjCdjvqWEFr5Jns6vxoXtBcsl4/cEsGMgsMx8Z2ato4vBTGMUSIQBZJgEdKyNcgGh42yu9xiuNYtQ==} esbuild@0.21.5: resolution: {integrity: sha512-mg3OPMV4hXywwpoDxu3Qda5xCKQi+vCTZq8S9J/EpkhB2HzKXq4SNFZE3+NK93JYxc8VMSep+lOUSC/RVKaBqw==} @@ -2115,8 +2123,8 @@ packages: resolution: {integrity: sha512-Q7lok0mqMUSf5a/AdAZkA5a/gHcO6snwQClVNNvFKCAVlxXucdU8pKydU5ZVZjBx5xr37vGbFFWtLQYreLzrZg==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - eslint@9.11.1: - resolution: {integrity: sha512-MobhYKIoAO1s1e4VUrgx1l1Sk2JBR/Gqjjgw8+mfgoLE2xwsHur4gdfTxyTgShrhvdVFTaJSgMiQBl1jv/AWxg==} + eslint@9.12.0: + resolution: {integrity: sha512-UVIOlTEWxwIopRL1wgSQYdnVDcEvs2wyaO6DGo5mXqe3r16IoCNWkR29iHhyaP4cICWjbgbmFUGAhh0GJRuGZw==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} hasBin: true peerDependencies: @@ -2281,9 +2289,6 @@ packages: resolution: {integrity: sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==} engines: {node: 6.* || 8.* || >= 10.*} - get-func-name@2.0.2: - resolution: {integrity: sha512-8vXOvuE167CtIc3OyItco7N/dpRtBbYOsPsXCz7X/PMnlGjYjSGuZJgM1Y7mmew7BKf9BqvLX2tnOVy1BBUsxQ==} - get-intrinsic@1.2.4: resolution: {integrity: sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ==} engines: {node: '>= 0.4'} @@ -2581,10 +2586,6 @@ packages: resolution: {integrity: sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==} engines: {node: '>=0.12.0'} - is-path-inside@3.0.3: - resolution: {integrity: sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==} - engines: {node: '>=8'} - is-plain-obj@2.1.0: resolution: {integrity: sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==} engines: {node: '>=8'} @@ -2758,8 +2759,8 @@ packages: longest-streak@2.0.4: resolution: {integrity: sha512-vM6rUVCVUJJt33bnmHiZEvr7wPT78ztX7rojL+LW51bHtLh6HTjx84LA5W4+oa6aKEJA7jJu5LR6vQRBpA5DVg==} - loupe@3.1.1: - resolution: {integrity: sha512-edNu/8D5MKVfGVFRhFf8aAxiTM6Wumfz5XsaatSxlD3w4R1d/WEKUTydCdPGbl9K7QG/Ca3GnDV2sIKIpXRQcw==} + loupe@3.1.2: + resolution: {integrity: sha512-23I4pFZHmAemUnz8WZXbYRSKYj801VDaNv9ETuMh7IrMc7VuVVSo+Z9iLE3ni30+U48iDWfi30d3twAXBYmnCg==} lru-cache@10.4.3: resolution: {integrity: sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==} @@ -3132,8 +3133,8 @@ packages: resolution: {integrity: sha512-56rxCq7G/XfB4EkXq9Egn5GCqugWvDFjafDOThIdMBsI15iqPqR5r15TfSr1YPYeEI19YeaXMCbY6u88Y76GLQ==} engines: {node: ^10 || ^12 || >=14} - preact@10.24.1: - resolution: {integrity: sha512-PnBAwFI3Yjxxcxw75n6VId/5TFxNW/81zexzWD9jn1+eSrOP84NdsS38H5IkF/UH3frqRPT+MvuCoVHjTDTnDw==} + preact@10.24.2: + resolution: {integrity: sha512-1cSoF0aCC8uaARATfrlz4VCBqE8LwZwRfLgkxJOQwAlQt6ayTmi0D9OF7nXid1POI5SZidFuG9CnlXbDfLqY/Q==} prelude-ls@1.2.1: resolution: {integrity: sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==} @@ -3193,11 +3194,11 @@ packages: resolution: {integrity: sha512-gNva8/6UAe8QYepIQH/jQ2qn91Qj0B9sYjMBBs3QOB8F2CXcKgLxQaJRP76sWVRQt+QU+8fAkCbCvjjMFu7Ycw==} engines: {node: '>= 0.8.0'} - regex@4.3.2: - resolution: {integrity: sha512-kK/AA3A9K6q2js89+VMymcboLOlF5lZRCYJv3gzszXFHBr6kO6qLGzbm+UIugBEV8SMMKCTR59txoY6ctRHYVw==} + regex@4.3.3: + resolution: {integrity: sha512-r/AadFO7owAq1QJVeZ/nq9jNS1vyZt+6t1p/E59B56Rn2GCya+gr1KSyOzNL/er+r+B7phv5jG2xU2Nz1YkmJg==} - regexp.prototype.flags@1.5.2: - resolution: {integrity: sha512-NcDiDkTLuPR+++OCKB0nWafEmhg/Da8aUPLPMQbK+bxKKCm1/S5he+AqYa4PlMCVBalb4/yxIRub6qkEx5yJbw==} + regexp.prototype.flags@1.5.3: + resolution: {integrity: sha512-vqlC04+RQoFalODCbCumG2xIOvapzVMHwsyIGM/SIE8fRhFFsXeH8/QQ+s0T0kDAhKc4k30s73/0ydkHQz6HlQ==} engines: {node: '>= 0.4'} regexpp@3.2.0: @@ -3332,8 +3333,8 @@ packages: resolution: {integrity: sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==} engines: {node: '>=8'} - shiki@1.21.0: - resolution: {integrity: sha512-apCH5BoWTrmHDPGgg3RF8+HAAbEL/CdbYr8rMw7eIrdhCkZHdVGat5mMNlRtd1erNG01VPMIKHNQ0Pj2HMAiog==} + shiki@1.22.0: + resolution: {integrity: sha512-/t5LlhNs+UOKQCYBtl5ZsH/Vclz73GIqT2yQsCBygr8L/ppTdmpL4w3kPLoZJbMKVWtoG77Ue1feOjZfDxvMkw==} side-channel@1.0.6: resolution: {integrity: sha512-fDW/EZ6Q9RiO8eFG8Hj+7u/oW+XrPTIChwCOM2+th2A6OblDtYYIpve9m+KvI9Z4C9qSEXlaGR6bTEYHReuglA==} @@ -3506,11 +3507,11 @@ packages: resolution: {integrity: sha512-n1cw8k1k0x4pgA2+9XrOkFydTerNcJ1zWCO5Nn9scWHTD+5tp8dghT2x1uduQePZTZgd3Tupf+x9BxJjeJi77Q==} engines: {node: '>=14.0.0'} - tldts-core@6.1.48: - resolution: {integrity: sha512-3gD9iKn/n2UuFH1uilBviK9gvTNT6iYwdqrj1Vr5mh8FuelvpRNaYVH4pNYqUgOGU4aAdL9X35eLuuj0gRsx+A==} + tldts-core@6.1.50: + resolution: {integrity: sha512-na2EcZqmdA2iV9zHV7OHQDxxdciEpxrjbkp+aHmZgnZKHzoElLajP59np5/4+sare9fQBfixgvXKx8ev1d7ytw==} - tldts@6.1.48: - resolution: {integrity: sha512-SPbnh1zaSzi/OsmHb1vrPNnYuwJbdWjwo5TbBYYMlTtH3/1DSb41t8bcSxkwDmmbG2q6VLPVvQc7Yf23T+1EEw==} + tldts@6.1.50: + resolution: {integrity: sha512-q9GOap6q3KCsLMdOjXhWU5jVZ8/1dIib898JBRLsN+tBhENpBDcAVQbE0epADOjw11FhQQy9AcbqKGBQPUfTQA==} hasBin: true to-fast-properties@2.0.0: @@ -3782,8 +3783,8 @@ packages: terser: optional: true - vitepress@1.3.4: - resolution: {integrity: sha512-I1/F6OW1xl3kW4PaIMC6snxjWgf3qfziq2aqsDoFc/Gt41WbcRv++z8zjw8qGRIJ+I4bUW7ZcKFDHHN/jkH9DQ==} + vitepress@1.4.0: + resolution: {integrity: sha512-JXCv4EsKTDyAFb6C/UjZr7nsGAzZ6mafVk2rx7rG5o8N+B/4QstIk+iEOe/9dKoU6V624UIC6g1pZ+K63rxhlw==} hasBin: true peerDependencies: markdown-it-mathjax3: ^4 @@ -3830,8 +3831,8 @@ packages: '@vue/composition-api': optional: true - vue@3.5.10: - resolution: {integrity: sha512-Vy2kmJwHPlouC/tSnIgXVg03SG+9wSqT1xu1Vehc+ChsXsRd7jLkKgMltVEFOzUdBr3uFwBCG+41LJtfAcBRng==} + vue@3.5.11: + resolution: {integrity: sha512-/8Wurrd9J3lb72FTQS7gRMNQD4nztTtKPmuDuPuhqXmmpD6+skVjAeahNpVzsuky6Sy9gy7wn8UadqPtt9SQIg==} peerDependencies: typescript: '*' peerDependenciesMeta: @@ -4101,39 +4102,39 @@ snapshots: typescript: 5.6.1-rc validate-npm-package-name: 5.0.1 - '@ark/attest@0.21.0(typescript@5.6.2)': + '@ark/attest@0.22.0(typescript@5.6.2)': dependencies: - '@ark/fs': 0.16.0 - '@ark/util': 0.16.0 + '@ark/fs': 0.17.0 + '@ark/util': 0.17.0 '@prettier/sync': 0.5.2(prettier@3.3.3) '@typescript/analyze-trace': 0.10.1 '@typescript/vfs': 1.6.0(typescript@5.6.2) - arktype: 2.0.0-rc.14 + arktype: 2.0.0-rc.15 prettier: 3.3.3 typescript: 5.6.2 transitivePeerDependencies: - supports-color - '@ark/fs@0.16.0': {} + '@ark/fs@0.17.0': {} - '@ark/schema@0.16.0': + '@ark/schema@0.17.0': dependencies: - '@ark/util': 0.16.0 + '@ark/util': 0.17.0 - '@ark/util@0.16.0': {} + '@ark/util@0.17.0': {} - '@babel/helper-string-parser@7.24.8': {} + '@babel/helper-string-parser@7.25.7': {} - '@babel/helper-validator-identifier@7.24.7': {} + '@babel/helper-validator-identifier@7.25.7': {} - '@babel/parser@7.25.6': + '@babel/parser@7.25.7': dependencies: - '@babel/types': 7.25.6 + '@babel/types': 7.25.7 - '@babel/types@7.25.6': + '@babel/types@7.25.7': dependencies: - '@babel/helper-string-parser': 7.24.8 - '@babel/helper-validator-identifier': 7.24.7 + '@babel/helper-string-parser': 7.25.7 + '@babel/helper-validator-identifier': 7.25.7 to-fast-properties: 2.0.0 '@colors/colors@1.5.0': @@ -4144,7 +4145,7 @@ snapshots: '@docsearch/js@3.6.2(@algolia/client-search@5.7.0)(search-insights@2.17.2)': dependencies: '@docsearch/react': 3.6.2(@algolia/client-search@5.7.0)(search-insights@2.17.2) - preact: 10.24.1 + preact: 10.24.2 transitivePeerDependencies: - '@algolia/client-search' - '@types/react' @@ -4344,9 +4345,9 @@ snapshots: '@esbuild/win32-x64@0.23.1': optional: true - '@eslint-community/eslint-utils@4.4.0(eslint@9.11.1)': + '@eslint-community/eslint-utils@4.4.0(eslint@9.12.0)': dependencies: - eslint: 9.11.1 + eslint: 9.12.0 eslint-visitor-keys: 3.4.3 '@eslint-community/regexpp@4.11.1': {} @@ -4375,7 +4376,7 @@ snapshots: transitivePeerDependencies: - supports-color - '@eslint/js@9.11.1': {} + '@eslint/js@9.12.0': {} '@eslint/object-schema@2.1.4': {} @@ -4434,9 +4435,16 @@ snapshots: '@repeaterjs/repeater': 3.0.6 tslib: 2.7.0 + '@humanfs/core@0.19.0': {} + + '@humanfs/node@0.16.5': + dependencies: + '@humanfs/core': 0.19.0 + '@humanwhocodes/retry': 0.3.1 + '@humanwhocodes/module-importer@1.0.1': {} - '@humanwhocodes/retry@0.3.0': {} + '@humanwhocodes/retry@0.3.1': {} '@jridgewell/sourcemap-codec@1.5.0': {} @@ -4794,36 +4802,36 @@ snapshots: '@sec-ant/readable-stream@0.4.1': {} - '@shikijs/core@1.21.0': + '@shikijs/core@1.22.0': dependencies: - '@shikijs/engine-javascript': 1.21.0 - '@shikijs/engine-oniguruma': 1.21.0 - '@shikijs/types': 1.21.0 - '@shikijs/vscode-textmate': 9.2.2 + '@shikijs/engine-javascript': 1.22.0 + '@shikijs/engine-oniguruma': 1.22.0 + '@shikijs/types': 1.22.0 + '@shikijs/vscode-textmate': 9.3.0 '@types/hast': 3.0.4 hast-util-to-html: 9.0.3 - '@shikijs/engine-javascript@1.21.0': + '@shikijs/engine-javascript@1.22.0': dependencies: - '@shikijs/types': 1.21.0 - '@shikijs/vscode-textmate': 9.2.2 + '@shikijs/types': 1.22.0 + '@shikijs/vscode-textmate': 9.3.0 oniguruma-to-js: 0.4.3 - '@shikijs/engine-oniguruma@1.21.0': + '@shikijs/engine-oniguruma@1.22.0': dependencies: - '@shikijs/types': 1.21.0 - '@shikijs/vscode-textmate': 9.2.2 + '@shikijs/types': 1.22.0 + '@shikijs/vscode-textmate': 9.3.0 - '@shikijs/transformers@1.21.0': + '@shikijs/transformers@1.22.0': dependencies: - shiki: 1.21.0 + shiki: 1.22.0 - '@shikijs/types@1.21.0': + '@shikijs/types@1.22.0': dependencies: - '@shikijs/vscode-textmate': 9.2.2 + '@shikijs/vscode-textmate': 9.3.0 '@types/hast': 3.0.4 - '@shikijs/vscode-textmate@9.2.2': {} + '@shikijs/vscode-textmate@9.3.0': {} '@sindresorhus/is@4.6.0': {} @@ -4953,13 +4961,13 @@ snapshots: '@types/web-bluetooth@0.0.20': {} - '@typescript-eslint/eslint-plugin@5.0.0(@typescript-eslint/parser@5.0.0(eslint@9.11.1)(typescript@4.4.3))(eslint@9.11.1)(typescript@4.4.3)': + '@typescript-eslint/eslint-plugin@5.0.0(@typescript-eslint/parser@5.0.0(eslint@9.12.0)(typescript@4.4.3))(eslint@9.12.0)(typescript@4.4.3)': dependencies: - '@typescript-eslint/experimental-utils': 5.0.0(eslint@9.11.1)(typescript@4.4.3) - '@typescript-eslint/parser': 5.0.0(eslint@9.11.1)(typescript@4.4.3) + '@typescript-eslint/experimental-utils': 5.0.0(eslint@9.12.0)(typescript@4.4.3) + '@typescript-eslint/parser': 5.0.0(eslint@9.12.0)(typescript@4.4.3) '@typescript-eslint/scope-manager': 5.0.0 debug: 4.3.7 - eslint: 9.11.1 + eslint: 9.12.0 functional-red-black-tree: 1.0.1 ignore: 5.3.2 regexpp: 3.2.0 @@ -4970,15 +4978,15 @@ snapshots: transitivePeerDependencies: - supports-color - '@typescript-eslint/eslint-plugin@7.18.0(@typescript-eslint/parser@7.18.0(eslint@9.11.1)(typescript@5.6.2))(eslint@9.11.1)(typescript@5.6.2)': + '@typescript-eslint/eslint-plugin@7.18.0(@typescript-eslint/parser@7.18.0(eslint@9.12.0)(typescript@5.6.2))(eslint@9.12.0)(typescript@5.6.2)': dependencies: '@eslint-community/regexpp': 4.11.1 - '@typescript-eslint/parser': 7.18.0(eslint@9.11.1)(typescript@5.6.2) + '@typescript-eslint/parser': 7.18.0(eslint@9.12.0)(typescript@5.6.2) '@typescript-eslint/scope-manager': 7.18.0 - '@typescript-eslint/type-utils': 7.18.0(eslint@9.11.1)(typescript@5.6.2) - '@typescript-eslint/utils': 7.18.0(eslint@9.11.1)(typescript@5.6.2) + '@typescript-eslint/type-utils': 7.18.0(eslint@9.12.0)(typescript@5.6.2) + '@typescript-eslint/utils': 7.18.0(eslint@9.12.0)(typescript@5.6.2) '@typescript-eslint/visitor-keys': 7.18.0 - eslint: 9.11.1 + eslint: 9.12.0 graphemer: 1.4.0 ignore: 5.3.2 natural-compare: 1.4.0 @@ -4988,15 +4996,15 @@ snapshots: transitivePeerDependencies: - supports-color - '@typescript-eslint/eslint-plugin@8.8.0(@typescript-eslint/parser@8.8.0(eslint@9.11.1)(typescript@5.6.2))(eslint@9.11.1)(typescript@5.6.2)': + '@typescript-eslint/eslint-plugin@8.8.0(@typescript-eslint/parser@8.8.0(eslint@9.12.0)(typescript@5.6.2))(eslint@9.12.0)(typescript@5.6.2)': dependencies: '@eslint-community/regexpp': 4.11.1 - '@typescript-eslint/parser': 8.8.0(eslint@9.11.1)(typescript@5.6.2) + '@typescript-eslint/parser': 8.8.0(eslint@9.12.0)(typescript@5.6.2) '@typescript-eslint/scope-manager': 8.8.0 - '@typescript-eslint/type-utils': 8.8.0(eslint@9.11.1)(typescript@5.6.2) - '@typescript-eslint/utils': 8.8.0(eslint@9.11.1)(typescript@5.6.2) + '@typescript-eslint/type-utils': 8.8.0(eslint@9.12.0)(typescript@5.6.2) + '@typescript-eslint/utils': 8.8.0(eslint@9.12.0)(typescript@5.6.2) '@typescript-eslint/visitor-keys': 8.8.0 - eslint: 9.11.1 + eslint: 9.12.0 graphemer: 1.4.0 ignore: 5.3.2 natural-compare: 1.4.0 @@ -5006,52 +5014,52 @@ snapshots: transitivePeerDependencies: - supports-color - '@typescript-eslint/experimental-utils@5.0.0(eslint@9.11.1)(typescript@4.4.3)': + '@typescript-eslint/experimental-utils@5.0.0(eslint@9.12.0)(typescript@4.4.3)': dependencies: '@types/json-schema': 7.0.15 '@typescript-eslint/scope-manager': 5.0.0 '@typescript-eslint/types': 5.0.0 '@typescript-eslint/typescript-estree': 5.0.0(typescript@4.4.3) - eslint: 9.11.1 + eslint: 9.12.0 eslint-scope: 5.1.1 - eslint-utils: 3.0.0(eslint@9.11.1) + eslint-utils: 3.0.0(eslint@9.12.0) transitivePeerDependencies: - supports-color - typescript - '@typescript-eslint/parser@5.0.0(eslint@9.11.1)(typescript@4.4.3)': + '@typescript-eslint/parser@5.0.0(eslint@9.12.0)(typescript@4.4.3)': dependencies: '@typescript-eslint/scope-manager': 5.0.0 '@typescript-eslint/types': 5.0.0 '@typescript-eslint/typescript-estree': 5.0.0(typescript@4.4.3) debug: 4.3.7 - eslint: 9.11.1 + eslint: 9.12.0 optionalDependencies: typescript: 4.4.3 transitivePeerDependencies: - supports-color - '@typescript-eslint/parser@7.18.0(eslint@9.11.1)(typescript@5.6.2)': + '@typescript-eslint/parser@7.18.0(eslint@9.12.0)(typescript@5.6.2)': dependencies: '@typescript-eslint/scope-manager': 7.18.0 '@typescript-eslint/types': 7.18.0 '@typescript-eslint/typescript-estree': 7.18.0(typescript@5.6.2) '@typescript-eslint/visitor-keys': 7.18.0 debug: 4.3.7 - eslint: 9.11.1 + eslint: 9.12.0 optionalDependencies: typescript: 5.6.2 transitivePeerDependencies: - supports-color - '@typescript-eslint/parser@8.8.0(eslint@9.11.1)(typescript@5.6.2)': + '@typescript-eslint/parser@8.8.0(eslint@9.12.0)(typescript@5.6.2)': dependencies: '@typescript-eslint/scope-manager': 8.8.0 '@typescript-eslint/types': 8.8.0 '@typescript-eslint/typescript-estree': 8.8.0(typescript@5.6.2) '@typescript-eslint/visitor-keys': 8.8.0 debug: 4.3.7 - eslint: 9.11.1 + eslint: 9.12.0 optionalDependencies: typescript: 5.6.2 transitivePeerDependencies: @@ -5072,22 +5080,22 @@ snapshots: '@typescript-eslint/types': 8.8.0 '@typescript-eslint/visitor-keys': 8.8.0 - '@typescript-eslint/type-utils@7.18.0(eslint@9.11.1)(typescript@5.6.2)': + '@typescript-eslint/type-utils@7.18.0(eslint@9.12.0)(typescript@5.6.2)': dependencies: '@typescript-eslint/typescript-estree': 7.18.0(typescript@5.6.2) - '@typescript-eslint/utils': 7.18.0(eslint@9.11.1)(typescript@5.6.2) + '@typescript-eslint/utils': 7.18.0(eslint@9.12.0)(typescript@5.6.2) debug: 4.3.7 - eslint: 9.11.1 + eslint: 9.12.0 ts-api-utils: 1.3.0(typescript@5.6.2) optionalDependencies: typescript: 5.6.2 transitivePeerDependencies: - supports-color - '@typescript-eslint/type-utils@8.8.0(eslint@9.11.1)(typescript@5.6.2)': + '@typescript-eslint/type-utils@8.8.0(eslint@9.12.0)(typescript@5.6.2)': dependencies: '@typescript-eslint/typescript-estree': 8.8.0(typescript@5.6.2) - '@typescript-eslint/utils': 8.8.0(eslint@9.11.1)(typescript@5.6.2) + '@typescript-eslint/utils': 8.8.0(eslint@9.12.0)(typescript@5.6.2) debug: 4.3.7 ts-api-utils: 1.3.0(typescript@5.6.2) optionalDependencies: @@ -5146,24 +5154,24 @@ snapshots: transitivePeerDependencies: - supports-color - '@typescript-eslint/utils@7.18.0(eslint@9.11.1)(typescript@5.6.2)': + '@typescript-eslint/utils@7.18.0(eslint@9.12.0)(typescript@5.6.2)': dependencies: - '@eslint-community/eslint-utils': 4.4.0(eslint@9.11.1) + '@eslint-community/eslint-utils': 4.4.0(eslint@9.12.0) '@typescript-eslint/scope-manager': 7.18.0 '@typescript-eslint/types': 7.18.0 '@typescript-eslint/typescript-estree': 7.18.0(typescript@5.6.2) - eslint: 9.11.1 + eslint: 9.12.0 transitivePeerDependencies: - supports-color - typescript - '@typescript-eslint/utils@8.8.0(eslint@9.11.1)(typescript@5.6.2)': + '@typescript-eslint/utils@8.8.0(eslint@9.12.0)(typescript@5.6.2)': dependencies: - '@eslint-community/eslint-utils': 4.4.0(eslint@9.11.1) + '@eslint-community/eslint-utils': 4.4.0(eslint@9.12.0) '@typescript-eslint/scope-manager': 8.8.0 '@typescript-eslint/types': 8.8.0 '@typescript-eslint/typescript-estree': 8.8.0(typescript@5.6.2) - eslint: 9.11.1 + eslint: 9.12.0 transitivePeerDependencies: - supports-color - typescript @@ -5203,10 +5211,10 @@ snapshots: '@ungap/structured-clone@1.2.0': {} - '@vitejs/plugin-vue@5.1.4(vite@5.4.8(@types/node@22.7.4))(vue@3.5.10(typescript@5.6.2))': + '@vitejs/plugin-vue@5.1.4(vite@5.4.8(@types/node@22.7.4))(vue@3.5.11(typescript@5.6.2))': dependencies: vite: 5.4.8(@types/node@22.7.4) - vue: 3.5.10(typescript@5.6.2) + vue: 3.5.11(typescript@5.6.2) '@vitest/expect@2.1.2': dependencies: @@ -5245,38 +5253,38 @@ snapshots: '@vitest/utils@2.1.2': dependencies: '@vitest/pretty-format': 2.1.2 - loupe: 3.1.1 + loupe: 3.1.2 tinyrainbow: 1.2.0 - '@vue/compiler-core@3.5.10': + '@vue/compiler-core@3.5.11': dependencies: - '@babel/parser': 7.25.6 - '@vue/shared': 3.5.10 + '@babel/parser': 7.25.7 + '@vue/shared': 3.5.11 entities: 4.5.0 estree-walker: 2.0.2 source-map-js: 1.2.1 - '@vue/compiler-dom@3.5.10': + '@vue/compiler-dom@3.5.11': dependencies: - '@vue/compiler-core': 3.5.10 - '@vue/shared': 3.5.10 + '@vue/compiler-core': 3.5.11 + '@vue/shared': 3.5.11 - '@vue/compiler-sfc@3.5.10': + '@vue/compiler-sfc@3.5.11': dependencies: - '@babel/parser': 7.25.6 - '@vue/compiler-core': 3.5.10 - '@vue/compiler-dom': 3.5.10 - '@vue/compiler-ssr': 3.5.10 - '@vue/shared': 3.5.10 + '@babel/parser': 7.25.7 + '@vue/compiler-core': 3.5.11 + '@vue/compiler-dom': 3.5.11 + '@vue/compiler-ssr': 3.5.11 + '@vue/shared': 3.5.11 estree-walker: 2.0.2 magic-string: 0.30.11 postcss: 8.4.47 source-map-js: 1.2.1 - '@vue/compiler-ssr@3.5.10': + '@vue/compiler-ssr@3.5.11': dependencies: - '@vue/compiler-dom': 3.5.10 - '@vue/shared': 3.5.10 + '@vue/compiler-dom': 3.5.11 + '@vue/shared': 3.5.11 '@vue/devtools-api@7.4.6': dependencies: @@ -5296,45 +5304,45 @@ snapshots: dependencies: rfdc: 1.4.1 - '@vue/reactivity@3.5.10': + '@vue/reactivity@3.5.11': dependencies: - '@vue/shared': 3.5.10 + '@vue/shared': 3.5.11 - '@vue/runtime-core@3.5.10': + '@vue/runtime-core@3.5.11': dependencies: - '@vue/reactivity': 3.5.10 - '@vue/shared': 3.5.10 + '@vue/reactivity': 3.5.11 + '@vue/shared': 3.5.11 - '@vue/runtime-dom@3.5.10': + '@vue/runtime-dom@3.5.11': dependencies: - '@vue/reactivity': 3.5.10 - '@vue/runtime-core': 3.5.10 - '@vue/shared': 3.5.10 + '@vue/reactivity': 3.5.11 + '@vue/runtime-core': 3.5.11 + '@vue/shared': 3.5.11 csstype: 3.1.3 - '@vue/server-renderer@3.5.10(vue@3.5.10(typescript@5.6.2))': + '@vue/server-renderer@3.5.11(vue@3.5.11(typescript@5.6.2))': dependencies: - '@vue/compiler-ssr': 3.5.10 - '@vue/shared': 3.5.10 - vue: 3.5.10(typescript@5.6.2) + '@vue/compiler-ssr': 3.5.11 + '@vue/shared': 3.5.11 + vue: 3.5.11(typescript@5.6.2) - '@vue/shared@3.5.10': {} + '@vue/shared@3.5.11': {} - '@vueuse/core@11.1.0(vue@3.5.10(typescript@5.6.2))': + '@vueuse/core@11.1.0(vue@3.5.11(typescript@5.6.2))': dependencies: '@types/web-bluetooth': 0.0.20 '@vueuse/metadata': 11.1.0 - '@vueuse/shared': 11.1.0(vue@3.5.10(typescript@5.6.2)) - vue-demi: 0.14.10(vue@3.5.10(typescript@5.6.2)) + '@vueuse/shared': 11.1.0(vue@3.5.11(typescript@5.6.2)) + vue-demi: 0.14.10(vue@3.5.11(typescript@5.6.2)) transitivePeerDependencies: - '@vue/composition-api' - vue - '@vueuse/integrations@11.1.0(focus-trap@7.6.0)(vue@3.5.10(typescript@5.6.2))': + '@vueuse/integrations@11.1.0(focus-trap@7.6.0)(vue@3.5.11(typescript@5.6.2))': dependencies: - '@vueuse/core': 11.1.0(vue@3.5.10(typescript@5.6.2)) - '@vueuse/shared': 11.1.0(vue@3.5.10(typescript@5.6.2)) - vue-demi: 0.14.10(vue@3.5.10(typescript@5.6.2)) + '@vueuse/core': 11.1.0(vue@3.5.11(typescript@5.6.2)) + '@vueuse/shared': 11.1.0(vue@3.5.11(typescript@5.6.2)) + vue-demi: 0.14.10(vue@3.5.11(typescript@5.6.2)) optionalDependencies: focus-trap: 7.6.0 transitivePeerDependencies: @@ -5343,9 +5351,9 @@ snapshots: '@vueuse/metadata@11.1.0': {} - '@vueuse/shared@11.1.0(vue@3.5.10(typescript@5.6.2))': + '@vueuse/shared@11.1.0(vue@3.5.11(typescript@5.6.2))': dependencies: - vue-demi: 0.14.10(vue@3.5.10(typescript@5.6.2)) + vue-demi: 0.14.10(vue@3.5.11(typescript@5.6.2)) transitivePeerDependencies: - '@vue/composition-api' - vue @@ -5442,10 +5450,10 @@ snapshots: argparse@2.0.1: {} - arktype@2.0.0-rc.14: + arktype@2.0.0-rc.15: dependencies: - '@ark/schema': 0.16.0 - '@ark/util': 0.16.0 + '@ark/schema': 0.17.0 + '@ark/util': 0.17.0 array-buffer-byte-length@1.0.1: dependencies: @@ -5555,7 +5563,7 @@ snapshots: assertion-error: 2.0.1 check-error: 2.1.1 deep-eql: 5.0.2 - loupe: 3.1.1 + loupe: 3.1.2 pathval: 2.0.0 chalk@4.1.2: @@ -5856,7 +5864,7 @@ snapshots: object-inspect: 1.13.2 object-keys: 1.1.1 object.assign: 4.1.5 - regexp.prototype.flags: 1.5.2 + regexp.prototype.flags: 1.5.3 safe-array-concat: 1.1.2 safe-regex-test: 1.0.3 string.prototype.trim: 1.2.9 @@ -5895,7 +5903,7 @@ snapshots: is-date-object: 1.0.5 is-symbol: 1.0.4 - es-toolkit@1.23.0: {} + es-toolkit@1.24.0: {} esbuild@0.21.5: optionalDependencies: @@ -5954,41 +5962,41 @@ snapshots: escape-string-regexp@4.0.0: {} - eslint-config-prettier@6.0.0(eslint@9.11.1): + eslint-config-prettier@6.0.0(eslint@9.12.0): dependencies: - eslint: 9.11.1 + eslint: 9.12.0 get-stdin: 6.0.0 - eslint-config-prettier@9.1.0(eslint@9.11.1): + eslint-config-prettier@9.1.0(eslint@9.12.0): dependencies: - eslint: 9.11.1 + eslint: 9.12.0 - eslint-config-prisma@0.6.0(@typescript-eslint/eslint-plugin@8.8.0(@typescript-eslint/parser@8.8.0(eslint@9.11.1)(typescript@5.6.2))(eslint@9.11.1)(typescript@5.6.2))(@typescript-eslint/parser@8.8.0(eslint@9.11.1)(typescript@5.6.2))(eslint-plugin-deprecation@3.0.0(eslint@9.11.1)(typescript@5.6.2))(eslint-plugin-only-warn@1.1.0)(eslint-plugin-prefer-arrow@1.2.3(eslint@9.11.1))(eslint-plugin-tsdoc@0.3.0)(eslint@9.11.1)(typescript@5.6.2): + eslint-config-prisma@0.6.0(@typescript-eslint/eslint-plugin@8.8.0(@typescript-eslint/parser@8.8.0(eslint@9.12.0)(typescript@5.6.2))(eslint@9.12.0)(typescript@5.6.2))(@typescript-eslint/parser@8.8.0(eslint@9.12.0)(typescript@5.6.2))(eslint-plugin-deprecation@3.0.0(eslint@9.12.0)(typescript@5.6.2))(eslint-plugin-only-warn@1.1.0)(eslint-plugin-prefer-arrow@1.2.3(eslint@9.12.0))(eslint-plugin-tsdoc@0.3.0)(eslint@9.12.0)(typescript@5.6.2): dependencies: - '@eslint/js': 9.11.1 + '@eslint/js': 9.12.0 '@types/eslint-config-prettier': 6.11.3 '@types/eslint__js': 8.42.3 - '@typescript-eslint/eslint-plugin': 8.8.0(@typescript-eslint/parser@8.8.0(eslint@9.11.1)(typescript@5.6.2))(eslint@9.11.1)(typescript@5.6.2) - '@typescript-eslint/parser': 8.8.0(eslint@9.11.1)(typescript@5.6.2) - '@typescript-eslint/utils': 7.18.0(eslint@9.11.1)(typescript@5.6.2) - eslint: 9.11.1 - eslint-config-prettier: 9.1.0(eslint@9.11.1) - eslint-plugin-deprecation: 3.0.0(eslint@9.11.1)(typescript@5.6.2) + '@typescript-eslint/eslint-plugin': 8.8.0(@typescript-eslint/parser@8.8.0(eslint@9.12.0)(typescript@5.6.2))(eslint@9.12.0)(typescript@5.6.2) + '@typescript-eslint/parser': 8.8.0(eslint@9.12.0)(typescript@5.6.2) + '@typescript-eslint/utils': 7.18.0(eslint@9.12.0)(typescript@5.6.2) + eslint: 9.12.0 + eslint-config-prettier: 9.1.0(eslint@9.12.0) + eslint-plugin-deprecation: 3.0.0(eslint@9.12.0)(typescript@5.6.2) eslint-plugin-only-warn: 1.1.0 - eslint-plugin-prefer-arrow: 1.2.3(eslint@9.11.1) + eslint-plugin-prefer-arrow: 1.2.3(eslint@9.12.0) eslint-plugin-tsdoc: 0.3.0 - typescript-eslint: 7.18.0(eslint@9.11.1)(typescript@5.6.2) + typescript-eslint: 7.18.0(eslint@9.12.0)(typescript@5.6.2) transitivePeerDependencies: - supports-color - typescript - eslint-config-standard@13.0.1(eslint-plugin-import@2.23.3)(eslint-plugin-node@11.1.0(eslint@9.11.1))(eslint-plugin-promise@4.2.1)(eslint-plugin-standard@4.0.0(eslint@9.11.1))(eslint@9.11.1): + eslint-config-standard@13.0.1(eslint-plugin-import@2.23.3)(eslint-plugin-node@11.1.0(eslint@9.12.0))(eslint-plugin-promise@4.2.1)(eslint-plugin-standard@4.0.0(eslint@9.12.0))(eslint@9.12.0): dependencies: - eslint: 9.11.1 - eslint-plugin-import: 2.23.3(@typescript-eslint/parser@8.8.0(eslint@9.11.1)(typescript@5.6.2))(eslint@9.11.1) - eslint-plugin-node: 11.1.0(eslint@9.11.1) + eslint: 9.12.0 + eslint-plugin-import: 2.23.3(@typescript-eslint/parser@8.8.0(eslint@9.12.0)(typescript@5.6.2))(eslint@9.12.0) + eslint-plugin-node: 11.1.0(eslint@9.12.0) eslint-plugin-promise: 4.2.1 - eslint-plugin-standard: 4.0.0(eslint@9.11.1) + eslint-plugin-standard: 4.0.0(eslint@9.12.0) eslint-import-resolver-node@0.3.9: dependencies: @@ -5998,11 +6006,11 @@ snapshots: transitivePeerDependencies: - supports-color - eslint-import-resolver-typescript@2.5.0(eslint-plugin-import@2.23.3)(eslint@9.11.1): + eslint-import-resolver-typescript@2.5.0(eslint-plugin-import@2.23.3)(eslint@9.12.0): dependencies: debug: 4.3.7 - eslint: 9.11.1 - eslint-plugin-import: 2.23.3(@typescript-eslint/parser@8.8.0(eslint@9.11.1)(typescript@5.6.2))(eslint@9.11.1) + eslint: 9.12.0 + eslint-plugin-import: 2.23.3(@typescript-eslint/parser@8.8.0(eslint@9.12.0)(typescript@5.6.2))(eslint@9.12.0) glob: 7.2.3 is-glob: 4.0.3 resolve: 1.22.8 @@ -6010,41 +6018,41 @@ snapshots: transitivePeerDependencies: - supports-color - eslint-module-utils@2.12.0(@typescript-eslint/parser@8.8.0(eslint@9.11.1)(typescript@5.6.2))(eslint-import-resolver-node@0.3.9)(eslint@9.11.1): + eslint-module-utils@2.12.0(@typescript-eslint/parser@8.8.0(eslint@9.12.0)(typescript@5.6.2))(eslint-import-resolver-node@0.3.9)(eslint@9.12.0): dependencies: debug: 3.2.7 optionalDependencies: - '@typescript-eslint/parser': 8.8.0(eslint@9.11.1)(typescript@5.6.2) - eslint: 9.11.1 + '@typescript-eslint/parser': 8.8.0(eslint@9.12.0)(typescript@5.6.2) + eslint: 9.12.0 eslint-import-resolver-node: 0.3.9 transitivePeerDependencies: - supports-color - eslint-plugin-deprecation@3.0.0(eslint@9.11.1)(typescript@5.6.2): + eslint-plugin-deprecation@3.0.0(eslint@9.12.0)(typescript@5.6.2): dependencies: - '@typescript-eslint/utils': 7.18.0(eslint@9.11.1)(typescript@5.6.2) - eslint: 9.11.1 + '@typescript-eslint/utils': 7.18.0(eslint@9.12.0)(typescript@5.6.2) + eslint: 9.12.0 ts-api-utils: 1.3.0(typescript@5.6.2) tslib: 2.7.0 typescript: 5.6.2 transitivePeerDependencies: - supports-color - eslint-plugin-es@3.0.1(eslint@9.11.1): + eslint-plugin-es@3.0.1(eslint@9.12.0): dependencies: - eslint: 9.11.1 + eslint: 9.12.0 eslint-utils: 2.1.0 regexpp: 3.2.0 - eslint-plugin-import@2.23.3(@typescript-eslint/parser@8.8.0(eslint@9.11.1)(typescript@5.6.2))(eslint@9.11.1): + eslint-plugin-import@2.23.3(@typescript-eslint/parser@8.8.0(eslint@9.12.0)(typescript@5.6.2))(eslint@9.12.0): dependencies: array-includes: 3.1.8 array.prototype.flat: 1.3.2 debug: 2.6.9 doctrine: 2.1.0 - eslint: 9.11.1 + eslint: 9.12.0 eslint-import-resolver-node: 0.3.9 - eslint-module-utils: 2.12.0(@typescript-eslint/parser@8.8.0(eslint@9.11.1)(typescript@5.6.2))(eslint-import-resolver-node@0.3.9)(eslint@9.11.1) + eslint-module-utils: 2.12.0(@typescript-eslint/parser@8.8.0(eslint@9.12.0)(typescript@5.6.2))(eslint-import-resolver-node@0.3.9)(eslint@9.12.0) find-up: 2.1.0 has: 1.0.4 is-core-module: 2.15.1 @@ -6055,18 +6063,18 @@ snapshots: resolve: 1.22.8 tsconfig-paths: 3.15.0 optionalDependencies: - '@typescript-eslint/parser': 8.8.0(eslint@9.11.1)(typescript@5.6.2) + '@typescript-eslint/parser': 8.8.0(eslint@9.12.0)(typescript@5.6.2) transitivePeerDependencies: - eslint-import-resolver-typescript - eslint-import-resolver-webpack - supports-color - eslint-plugin-jsdoc@33.1.1(eslint@9.11.1): + eslint-plugin-jsdoc@33.1.1(eslint@9.12.0): dependencies: '@es-joy/jsdoccomment': 0.4.4 comment-parser: 1.1.5 debug: 4.3.7 - eslint: 9.11.1 + eslint: 9.12.0 esquery: 1.6.0 jsdoctypeparser: 9.0.0 lodash: 4.17.21 @@ -6076,16 +6084,16 @@ snapshots: transitivePeerDependencies: - supports-color - eslint-plugin-mocha@8.1.0(eslint@9.11.1): + eslint-plugin-mocha@8.1.0(eslint@9.12.0): dependencies: - eslint: 9.11.1 + eslint: 9.12.0 eslint-utils: 2.1.0 ramda: 0.27.2 - eslint-plugin-node@11.1.0(eslint@9.11.1): + eslint-plugin-node@11.1.0(eslint@9.12.0): dependencies: - eslint: 9.11.1 - eslint-plugin-es: 3.0.1(eslint@9.11.1) + eslint: 9.12.0 + eslint-plugin-es: 3.0.1(eslint@9.12.0) eslint-utils: 2.1.0 ignore: 5.3.2 minimatch: 3.1.2 @@ -6094,25 +6102,25 @@ snapshots: eslint-plugin-only-warn@1.1.0: {} - eslint-plugin-prefer-arrow@1.2.3(eslint@9.11.1): + eslint-plugin-prefer-arrow@1.2.3(eslint@9.12.0): dependencies: - eslint: 9.11.1 + eslint: 9.12.0 - eslint-plugin-prettier@3.1.0(eslint@9.11.1)(prettier@3.3.3): + eslint-plugin-prettier@3.1.0(eslint@9.12.0)(prettier@3.3.3): dependencies: - eslint: 9.11.1 + eslint: 9.12.0 prettier: 3.3.3 prettier-linter-helpers: 1.0.0 eslint-plugin-promise@4.2.1: {} - eslint-plugin-simple-import-sort@12.1.1(eslint@9.11.1): + eslint-plugin-simple-import-sort@12.1.1(eslint@9.12.0): dependencies: - eslint: 9.11.1 + eslint: 9.12.0 - eslint-plugin-standard@4.0.0(eslint@9.11.1): + eslint-plugin-standard@4.0.0(eslint@9.12.0): dependencies: - eslint: 9.11.1 + eslint: 9.12.0 eslint-plugin-tsdoc@0.3.0: dependencies: @@ -6129,21 +6137,21 @@ snapshots: esrecurse: 4.3.0 estraverse: 5.3.0 - eslint-typescript@1.1.0(eslint@9.11.1)(prettier@3.3.3): - dependencies: - '@typescript-eslint/eslint-plugin': 5.0.0(@typescript-eslint/parser@5.0.0(eslint@9.11.1)(typescript@4.4.3))(eslint@9.11.1)(typescript@4.4.3) - '@typescript-eslint/parser': 5.0.0(eslint@9.11.1)(typescript@4.4.3) - eslint: 9.11.1 - eslint-config-prettier: 6.0.0(eslint@9.11.1) - eslint-config-standard: 13.0.1(eslint-plugin-import@2.23.3)(eslint-plugin-node@11.1.0(eslint@9.11.1))(eslint-plugin-promise@4.2.1)(eslint-plugin-standard@4.0.0(eslint@9.11.1))(eslint@9.11.1) - eslint-import-resolver-typescript: 2.5.0(eslint-plugin-import@2.23.3)(eslint@9.11.1) - eslint-plugin-import: 2.23.3(@typescript-eslint/parser@8.8.0(eslint@9.11.1)(typescript@5.6.2))(eslint@9.11.1) - eslint-plugin-jsdoc: 33.1.1(eslint@9.11.1) - eslint-plugin-mocha: 8.1.0(eslint@9.11.1) - eslint-plugin-node: 11.1.0(eslint@9.11.1) - eslint-plugin-prettier: 3.1.0(eslint@9.11.1)(prettier@3.3.3) + eslint-typescript@1.1.0(eslint@9.12.0)(prettier@3.3.3): + dependencies: + '@typescript-eslint/eslint-plugin': 5.0.0(@typescript-eslint/parser@5.0.0(eslint@9.12.0)(typescript@4.4.3))(eslint@9.12.0)(typescript@4.4.3) + '@typescript-eslint/parser': 5.0.0(eslint@9.12.0)(typescript@4.4.3) + eslint: 9.12.0 + eslint-config-prettier: 6.0.0(eslint@9.12.0) + eslint-config-standard: 13.0.1(eslint-plugin-import@2.23.3)(eslint-plugin-node@11.1.0(eslint@9.12.0))(eslint-plugin-promise@4.2.1)(eslint-plugin-standard@4.0.0(eslint@9.12.0))(eslint@9.12.0) + eslint-import-resolver-typescript: 2.5.0(eslint-plugin-import@2.23.3)(eslint@9.12.0) + eslint-plugin-import: 2.23.3(@typescript-eslint/parser@8.8.0(eslint@9.12.0)(typescript@5.6.2))(eslint@9.12.0) + eslint-plugin-jsdoc: 33.1.1(eslint@9.12.0) + eslint-plugin-mocha: 8.1.0(eslint@9.12.0) + eslint-plugin-node: 11.1.0(eslint@9.12.0) + eslint-plugin-prettier: 3.1.0(eslint@9.12.0)(prettier@3.3.3) eslint-plugin-promise: 4.2.1 - eslint-plugin-standard: 4.0.0(eslint@9.11.1) + eslint-plugin-standard: 4.0.0(eslint@9.12.0) prettier: 3.3.3 typescript: 4.4.3 transitivePeerDependencies: @@ -6154,9 +6162,9 @@ snapshots: dependencies: eslint-visitor-keys: 1.3.0 - eslint-utils@3.0.0(eslint@9.11.1): + eslint-utils@3.0.0(eslint@9.12.0): dependencies: - eslint: 9.11.1 + eslint: 9.12.0 eslint-visitor-keys: 2.1.0 eslint-visitor-keys@1.3.0: {} @@ -6167,18 +6175,18 @@ snapshots: eslint-visitor-keys@4.1.0: {} - eslint@9.11.1: + eslint@9.12.0: dependencies: - '@eslint-community/eslint-utils': 4.4.0(eslint@9.11.1) + '@eslint-community/eslint-utils': 4.4.0(eslint@9.12.0) '@eslint-community/regexpp': 4.11.1 '@eslint/config-array': 0.18.0 '@eslint/core': 0.6.0 '@eslint/eslintrc': 3.1.0 - '@eslint/js': 9.11.1 + '@eslint/js': 9.12.0 '@eslint/plugin-kit': 0.2.0 + '@humanfs/node': 0.16.5 '@humanwhocodes/module-importer': 1.0.1 - '@humanwhocodes/retry': 0.3.0 - '@nodelib/fs.walk': 1.2.8 + '@humanwhocodes/retry': 0.3.1 '@types/estree': 1.0.6 '@types/json-schema': 7.0.15 ajv: 6.12.6 @@ -6198,13 +6206,11 @@ snapshots: ignore: 5.3.2 imurmurhash: 0.1.4 is-glob: 4.0.3 - is-path-inside: 3.0.3 json-stable-stringify-without-jsonify: 1.0.1 lodash.merge: 4.6.2 minimatch: 3.1.2 natural-compare: 1.4.0 optionator: 0.9.4 - strip-ansi: 6.0.1 text-table: 0.2.0 transitivePeerDependencies: - supports-color @@ -6371,8 +6377,6 @@ snapshots: get-caller-file@2.0.5: {} - get-func-name@2.0.2: {} - get-intrinsic@1.2.4: dependencies: es-errors: 1.3.0 @@ -6686,8 +6690,6 @@ snapshots: is-number@7.0.0: {} - is-path-inside@3.0.3: {} - is-plain-obj@2.1.0: {} is-plain-obj@4.1.0: {} @@ -6864,9 +6866,7 @@ snapshots: longest-streak@2.0.4: {} - loupe@3.1.1: - dependencies: - get-func-name: 2.0.2 + loupe@3.1.2: {} lru-cache@10.4.3: {} @@ -7164,7 +7164,7 @@ snapshots: oniguruma-to-js@0.4.3: dependencies: - regex: 4.3.2 + regex: 4.3.3 optionator@0.9.4: dependencies: @@ -7282,7 +7282,7 @@ snapshots: picocolors: 1.1.0 source-map-js: 1.2.1 - preact@10.24.1: {} + preact@10.24.2: {} prelude-ls@1.2.1: {} @@ -7333,9 +7333,9 @@ snapshots: readline-sync@1.4.10: {} - regex@4.3.2: {} + regex@4.3.3: {} - regexp.prototype.flags@1.5.2: + regexp.prototype.flags@1.5.3: dependencies: call-bind: 1.0.7 define-properties: 1.2.1 @@ -7508,13 +7508,13 @@ snapshots: shebang-regex@3.0.0: {} - shiki@1.21.0: + shiki@1.22.0: dependencies: - '@shikijs/core': 1.21.0 - '@shikijs/engine-javascript': 1.21.0 - '@shikijs/engine-oniguruma': 1.21.0 - '@shikijs/types': 1.21.0 - '@shikijs/vscode-textmate': 9.2.2 + '@shikijs/core': 1.22.0 + '@shikijs/engine-javascript': 1.22.0 + '@shikijs/engine-oniguruma': 1.22.0 + '@shikijs/types': 1.22.0 + '@shikijs/vscode-textmate': 9.3.0 '@types/hast': 3.0.4 side-channel@1.0.6: @@ -7689,11 +7689,11 @@ snapshots: tinyspy@3.0.2: {} - tldts-core@6.1.48: {} + tldts-core@6.1.50: {} - tldts@6.1.48: + tldts@6.1.50: dependencies: - tldts-core: 6.1.48 + tldts-core: 6.1.50 to-fast-properties@2.0.0: {} @@ -7708,7 +7708,7 @@ snapshots: tough-cookie@5.0.0: dependencies: - tldts: 6.1.48 + tldts: 6.1.50 tr46@0.0.3: {} @@ -7810,22 +7810,22 @@ snapshots: typed-array-buffer: 1.0.2 typed-array-byte-offset: 1.0.2 - typescript-eslint@7.18.0(eslint@9.11.1)(typescript@5.6.2): + typescript-eslint@7.18.0(eslint@9.12.0)(typescript@5.6.2): dependencies: - '@typescript-eslint/eslint-plugin': 7.18.0(@typescript-eslint/parser@7.18.0(eslint@9.11.1)(typescript@5.6.2))(eslint@9.11.1)(typescript@5.6.2) - '@typescript-eslint/parser': 7.18.0(eslint@9.11.1)(typescript@5.6.2) - '@typescript-eslint/utils': 7.18.0(eslint@9.11.1)(typescript@5.6.2) - eslint: 9.11.1 + '@typescript-eslint/eslint-plugin': 7.18.0(@typescript-eslint/parser@7.18.0(eslint@9.12.0)(typescript@5.6.2))(eslint@9.12.0)(typescript@5.6.2) + '@typescript-eslint/parser': 7.18.0(eslint@9.12.0)(typescript@5.6.2) + '@typescript-eslint/utils': 7.18.0(eslint@9.12.0)(typescript@5.6.2) + eslint: 9.12.0 optionalDependencies: typescript: 5.6.2 transitivePeerDependencies: - supports-color - typescript-eslint@8.8.0(eslint@9.11.1)(typescript@5.6.2): + typescript-eslint@8.8.0(eslint@9.12.0)(typescript@5.6.2): dependencies: - '@typescript-eslint/eslint-plugin': 8.8.0(@typescript-eslint/parser@8.8.0(eslint@9.11.1)(typescript@5.6.2))(eslint@9.11.1)(typescript@5.6.2) - '@typescript-eslint/parser': 8.8.0(eslint@9.11.1)(typescript@5.6.2) - '@typescript-eslint/utils': 8.8.0(eslint@9.11.1)(typescript@5.6.2) + '@typescript-eslint/eslint-plugin': 8.8.0(@typescript-eslint/parser@8.8.0(eslint@9.12.0)(typescript@5.6.2))(eslint@9.12.0)(typescript@5.6.2) + '@typescript-eslint/parser': 8.8.0(eslint@9.12.0)(typescript@5.6.2) + '@typescript-eslint/utils': 8.8.0(eslint@9.12.0)(typescript@5.6.2) optionalDependencies: typescript: 5.6.2 transitivePeerDependencies: @@ -7978,24 +7978,25 @@ snapshots: '@types/node': 22.7.4 fsevents: 2.3.3 - vitepress@1.3.4(@algolia/client-search@5.7.0)(@types/node@22.7.4)(postcss@8.4.47)(search-insights@2.17.2)(typescript@5.6.2): + vitepress@1.4.0(@algolia/client-search@5.7.0)(@types/node@22.7.4)(postcss@8.4.47)(search-insights@2.17.2)(typescript@5.6.2): dependencies: '@docsearch/css': 3.6.2 '@docsearch/js': 3.6.2(@algolia/client-search@5.7.0)(search-insights@2.17.2) - '@shikijs/core': 1.21.0 - '@shikijs/transformers': 1.21.0 + '@shikijs/core': 1.22.0 + '@shikijs/transformers': 1.22.0 + '@shikijs/types': 1.22.0 '@types/markdown-it': 14.1.2 - '@vitejs/plugin-vue': 5.1.4(vite@5.4.8(@types/node@22.7.4))(vue@3.5.10(typescript@5.6.2)) + '@vitejs/plugin-vue': 5.1.4(vite@5.4.8(@types/node@22.7.4))(vue@3.5.11(typescript@5.6.2)) '@vue/devtools-api': 7.4.6 - '@vue/shared': 3.5.10 - '@vueuse/core': 11.1.0(vue@3.5.10(typescript@5.6.2)) - '@vueuse/integrations': 11.1.0(focus-trap@7.6.0)(vue@3.5.10(typescript@5.6.2)) + '@vue/shared': 3.5.11 + '@vueuse/core': 11.1.0(vue@3.5.11(typescript@5.6.2)) + '@vueuse/integrations': 11.1.0(focus-trap@7.6.0)(vue@3.5.11(typescript@5.6.2)) focus-trap: 7.6.0 mark.js: 8.11.1 minisearch: 7.1.0 - shiki: 1.21.0 + shiki: 1.22.0 vite: 5.4.8(@types/node@22.7.4) - vue: 3.5.10(typescript@5.6.2) + vue: 3.5.11(typescript@5.6.2) optionalDependencies: postcss: 8.4.47 transitivePeerDependencies: @@ -8062,17 +8063,17 @@ snapshots: - supports-color - terser - vue-demi@0.14.10(vue@3.5.10(typescript@5.6.2)): + vue-demi@0.14.10(vue@3.5.11(typescript@5.6.2)): dependencies: - vue: 3.5.10(typescript@5.6.2) + vue: 3.5.11(typescript@5.6.2) - vue@3.5.10(typescript@5.6.2): + vue@3.5.11(typescript@5.6.2): dependencies: - '@vue/compiler-dom': 3.5.10 - '@vue/compiler-sfc': 3.5.10 - '@vue/runtime-dom': 3.5.10 - '@vue/server-renderer': 3.5.10(vue@3.5.10(typescript@5.6.2)) - '@vue/shared': 3.5.10 + '@vue/compiler-dom': 3.5.11 + '@vue/compiler-sfc': 3.5.11 + '@vue/runtime-dom': 3.5.11 + '@vue/server-renderer': 3.5.11(vue@3.5.11(typescript@5.6.2)) + '@vue/shared': 3.5.11 optionalDependencies: typescript: 5.6.2 diff --git a/src/cli/_helpers.ts b/src/cli/_helpers.ts index 68290bc9..7337cee1 100644 --- a/src/cli/_helpers.ts +++ b/src/cli/_helpers.ts @@ -1,7 +1,8 @@ import { getIntrospectionQuery, type IntrospectionQuery } from 'graphql' import { Graffle } from '../entrypoints/__Graffle.js' -import type { TypedDocumentString } from '../layers/0_functions/types.js' +import type { TypedDocument } from '../lib/typed-document/__.js' +// todo make an introspection query extension. export const introspectionQuery = async (endpoint: URL): Promise => { const introspectionQueryDocument = getIntrospectionQuery({ descriptions: true, @@ -9,11 +10,9 @@ export const introspectionQuery = async (endpoint: URL): Promise + }) as TypedDocument.String - const data = await Graffle.create({ schema: endpoint }).rawString({ - document: introspectionQueryDocument, - }) + const data = await Graffle.create({ schema: endpoint }).gql(introspectionQueryDocument).send() if (!data) { throw new Error(`No data returned for introspection query.`) diff --git a/src/entrypoints/main.ts b/src/entrypoints/main.ts index 6212d530..b116974e 100644 --- a/src/entrypoints/main.ts +++ b/src/entrypoints/main.ts @@ -1,7 +1,5 @@ -export { execute } from '../layers/0_functions/execute.js' -export { type TypedDocumentString } from '../layers/0_functions/types.js' export { createExtension, type Extension } from '../layers/6_client/extension/extension.js' -export { gql } from '../layers/6_helpers/gql.js' +export { type TypedDocument } from '../lib/typed-document/__.js' // todo figure this export out. Was just put there to resolve a type error about "...cannot be named..." export { type Config as BuilderConfig } from '../layers/6_client/Settings/Config.js' export * from '../layers/6_client/Settings/Input.js' diff --git a/src/layers/0_functions/execute.ts b/src/layers/0_functions/execute.ts deleted file mode 100644 index b908864e..00000000 --- a/src/layers/0_functions/execute.ts +++ /dev/null @@ -1,32 +0,0 @@ -import type { ExecutionResult, GraphQLSchema } from 'graphql' -import { execute as graphqlExecute, graphql } from 'graphql' -import type { BaseInput_ } from './types.js' - -type Input = BaseInput_ & { - schema: GraphQLSchema -} - -export const execute = async (input: Input): Promise => { - switch (typeof input.document) { - case `string`: { - return await graphql({ - schema: input.schema, - source: input.document, - // contextValue: createContextValue(), // todo - variableValues: input.variables, - operationName: input.operationName, - }) - } - case `object`: { - return await graphqlExecute({ - schema: input.schema, - document: input.document, - // contextValue: createContextValue(), // todo - variableValues: input.variables, - operationName: input.operationName, - }) - } - default: - throw new Error(`Unsupported GraphQL document type: ${String(document)}`) - } -} diff --git a/src/layers/0_functions/types.ts b/src/layers/0_functions/types.ts deleted file mode 100644 index bcc32711..00000000 --- a/src/layers/0_functions/types.ts +++ /dev/null @@ -1,65 +0,0 @@ -import type { DocumentTypeDecoration } from '@graphql-typed-document-node/core' -import type { DocumentNode, TypedQueryDocumentNode } from 'graphql' -import type { HasRequiredKeys, IsEmptyObject } from 'type-fest' -import type { SomeData, StandardScalarVariables } from '../../lib/graphql-plus/graphql.js' -import type { Negate } from '../../lib/prelude.js' - -export type DocumentInput<$Data extends SomeData = SomeData, V = any> = - | string - | TypedDocumentString<$Data, V> - | TypedQueryDocumentNode<$Data, V> - -type OperationNameInput = string - -export type BaseInput_ = { - document: DocumentNode | string - operationName?: OperationNameInput - variables?: StandardScalarVariables -} - -// dprint-ignore -export type BaseInput<$Document extends DocumentInput = DocumentInput> = - & { - document: $Document - operationName?: OperationNameInput - } - & NoInfer<( - $Document extends TypedDocumentString - ? GetVariablesInputFromString> - : string extends $Document - ? { variables?: StandardScalarVariables } - : GetVariablesInputFromDocumentNode> - )> - -// dprint-ignore -type GetVariablesInputFromString<$Document extends TypedDocumentString> = - HasVariables<$Document> extends true - ? HasRequiredKeys> extends true - ? { variables: VariablesOf<$Document> } - : { variables?: VariablesOf<$Document> } - : {} - -// dprint-ignore -type GetVariablesInputFromDocumentNode<$Document extends TypedQueryDocumentNode> = - HasVariables<$Document> extends true - ? HasRequiredKeys> extends true - ? { variables: VariablesOf<$Document> } - : { variables?: VariablesOf<$Document> } - : {} - -type HasVariables<$Document extends TypedQueryDocumentNode | TypedDocumentString> = Negate< - IsEmptyObject> -> - -// dprint-ignore -type VariablesOf<$Document extends TypedQueryDocumentNode | TypedDocumentString> = - $Document extends TypedQueryDocumentNode - ? V - : $Document extends TypedDocumentString - ? V - : never - -// TODO open issue asking for core library to expose this type. -export interface TypedDocumentString, TVariables = Record> - extends String, DocumentTypeDecoration -{} diff --git a/src/layers/3_Result/infer/Field.ts b/src/layers/3_Result/infer/Field.ts index e2e5979b..dfd7e725 100644 --- a/src/layers/3_Result/infer/Field.ts +++ b/src/layers/3_Result/infer/Field.ts @@ -31,7 +31,7 @@ type InferFieldType< $Type extends Schema.Object$2 ? InferObject<$SelectionSet, $Schema, $Type> : $Type extends Schema.Interface ? InferInterface<$SelectionSet, $Schema, $Type> : $Type extends Schema.Union ? InferUnion<$SelectionSet, $Schema, $Type> : - TSError<'InferFieldType', `Unknown type`, { $Type: $Type }> + TSError<'InferFieldType', `Unknown type`, { $Type: $Type; $SelectionSet: $SelectionSet; $Schema:$Schema }> // dprint-ignore type FieldDirectiveInclude<$SelectionSet> = diff --git a/src/layers/3_Result/infer/root.test-d.ts b/src/layers/3_Result/infer/root.test-d.ts index 40b3e46a..98266b31 100644 --- a/src/layers/3_Result/infer/root.test-d.ts +++ b/src/layers/3_Result/infer/root.test-d.ts @@ -1,132 +1,138 @@ -import { test } from 'vitest' import type * as Schema from '../../../../tests/_/schemas/kitchen-sink/graffle/modules/SchemaBuildtime.js' import type { Index } from '../../../../tests/_/schemas/kitchen-sink/graffle/modules/SchemaIndex.js' import type * as SelectionSets from '../../../../tests/_/schemas/kitchen-sink/graffle/modules/SelectionSets.js' -import { AssertIsEqual } from '../../../lib/prelude.js' +import { AssertEqual } from '../../../lib/assert-equal.js' import type { ResultSet } from '../__.js' +import type { PickSelectsPositiveIndicatorAndNotSelectAlias } from './root.js' type $<$SelectionSet extends SelectionSets.Query> = ResultSet.Query<$SelectionSet, Index> // dprint-ignore -test(`general`, () => { - AssertIsEqual<$<{ __typename: true }>, { __typename: 'Query' }>() - - // Scalar - AssertIsEqual<$<{ id: true }>, { id: null | string }>() - // AssertIsEqual, { id: null | string }>() - // non-nullable - AssertIsEqual<$<{ idNonNull: true }>, { idNonNull: string }>() - // indicator negative - AssertIsEqual<$<{ id: true; string: false }>, { id: null | string }>() - // AssertIsEqual, { id: null | string }>() - AssertIsEqual<$<{ id: true; string: undefined }>, { id: null | string }>() - - // Custom Scalar - AssertIsEqual<$<{ date: true }>, { date: null | Date }>() - - // List - AssertIsEqual<$<{ listIntNonNull: true }>, { listIntNonNull: number[] }>() - AssertIsEqual<$<{ listInt: true }>, { listInt: null|(null|number)[] }>() - AssertIsEqual<$<{ listListIntNonNull: true }>, { listListIntNonNull: number[][] }>() - AssertIsEqual<$<{ listListInt: true }>, { listListInt: null|((null|(null|number)[])[]) }>() - - // Enum - AssertIsEqual<$<{ abcEnum: true }>, { abcEnum: null|'A'|'B'|'C' }>() - - // Object - AssertIsEqual<$<{ object: { id: true } }>, { object: null | { id: string | null } }>() - // non-nullable - AssertIsEqual<$<{ objectNonNull: { id: true } }>, { objectNonNull: { id: string | null } }>() - // with args - AssertIsEqual<$<{ objectWithArgs: { $: { id: 'abc' }; id: true }}>, { objectWithArgs: null | { id: string | null } }>() - - // scalars-wildcard - AssertIsEqual<$<{ objectNonNull: { $scalars: true } }>, { objectNonNull: { __typename: "Object1"; string: null|string; int: null|number; float: null|number; boolean: null|boolean; id: null|string } }>() - // scalars-wildcard with nested object - AssertIsEqual<$<{ objectNested: { $scalars: true } }>, { objectNested: null | { __typename: "ObjectNested"; id: null|string } }>() - // __typename - AssertIsEqual<$<{ objectNonNull: { __typename: true } }>, { objectNonNull: { __typename: "Object1" } }>() - - // Union - AssertIsEqual<$<{ unionFooBar: { __typename: true } }>, { unionFooBar: null | { __typename: "Foo" } | { __typename: "Bar" } }>() - AssertIsEqual<$<{ unionFooBar: { ___on_Foo: { __typename: true } } }>, { unionFooBar: null | {} | { __typename: "Foo" } }>() - AssertIsEqual<$<{ unionFooBar: { ___on_Foo: { id: true } } }>, { unionFooBar: null | {} | { id: null|string } }>() - AssertIsEqual<$<{ unionFooBar: { __typename: true; ___on_Foo: { id: true } } }>, { unionFooBar: null | { __typename: "Bar" } | { __typename: "Foo"; id: null|string } }>() - // with Args - AssertIsEqual<$<{ unionFooBarWithArgs: { $: { id: `abc` }, ___on_Foo: { id: true } } }>, { unionFooBarWithArgs: null | {} | { id: null|string } }>() - - - // Union fragments Case - AssertIsEqual<$<{ lowerCaseUnion: { __typename:true, ___on_lowerCaseObject: { id: true }, ___on_lowerCaseObject2: { int: true } } }>, { lowerCaseUnion: null | { __typename: 'lowerCaseObject'; id: null|string } | { __typename: 'lowerCaseObject2'; int: null|number } }>() - - - // Interface - AssertIsEqual<$<{ interface: { ___on_Object1ImplementingInterface: { id: true }}}>, { interface: null | { id: null | string} | {} }>() - AssertIsEqual<$<{ interface: { ___on_Object1ImplementingInterface: { int: true }}}>, { interface: null | { int: null | number} | {} }>() - AssertIsEqual<$<{ interface: { id: true }}>, { interface: null | { id: null | string} }>() - AssertIsEqual<$<{ interface: { id: true, ___on_Object1ImplementingInterface: { id: true } }}>, { interface: null | { id: null | string} }>() - AssertIsEqual<$<{ interface: { id: true, ___on_Object1ImplementingInterface: { int: true } }}>, { interface: null | { id: null | string} | { id: null | string; int: null | number }}>() - AssertIsEqual<$<{ interface: { __typename:true }}>, { interface: null | { __typename: 'Object1ImplementingInterface' } | { __typename: 'Object2ImplementingInterface' } }>() - AssertIsEqual<$<{ interface: { ___on_Object1ImplementingInterface: { __typename: true } }}>, { interface: null | { __typename: 'Object1ImplementingInterface' } | {} }>() - AssertIsEqual<$<{ interface: { $scalars: true }}>, { interface: null | { __typename: 'Object1ImplementingInterface', id: null | string, int: null|number} | { __typename: 'Object2ImplementingInterface', id: null | string; boolean:null|boolean} }>() - // with args - AssertIsEqual<$<{ interfaceWithArgs: { $:{id:'abc'}; id: true }}>, { interfaceWithArgs: null | { id: null | string } }>() - - // todo alias on interfaces, interface fragments - // Alias - // scalar - AssertIsEqual<$<{ id: ['id2', true] }>, { id2: null | string }>() - AssertIsEqual<$<{ idNonNull: ['id2', true] }>, { id2: string }>() - // multi - AssertIsEqual<$<{ id: [['id1', true],['id2', true]] }>, { id1: null | string; id2: null | string }>() - // AssertIsEqual, { id_as: ResultSet.Errors.UnknownFieldName<'id_as', Schema.Root.Query> }>() - // AssertIsEqual, { id_as_$: ResultSet.Errors.UnknownFieldName<'id_as_$', Schema.Root.Query> }>() - // union fragment - AssertIsEqual<$<{ unionFooBar: { ___on_Foo: { id: ['id2', true] } } }>, { unionFooBar: null | {} | { id2: null|string } }>() - - // Directive @include - // On scalar non-nullable - AssertIsEqual<$<{ idNonNull: { $include: boolean } }>, { idNonNull: null|string }>() - AssertIsEqual<$<{ idNonNull: { $include: {if:boolean} } }>, { idNonNull: null|string }>() - AssertIsEqual<$<{ idNonNull: { $include: true } }>, { idNonNull: string }>() - AssertIsEqual<$<{ idNonNull: { $include: {if:true} } }>, { idNonNull: string }>() - AssertIsEqual<$<{ idNonNull: { $include: false } }>, { idNonNull: null }>() - AssertIsEqual<$<{ idNonNull: { $include: {if:false} } }>, { idNonNull: null }>() - // On scalar nullable - AssertIsEqual<$<{ id: { $include: boolean } }>, { id: null|string }>() - AssertIsEqual<$<{ id: { $include: false } }>, { id: null }>() - AssertIsEqual<$<{ id: { $include: true } }>, { id: null|string }>() - - // Directive @skip - // On scalar non-nullable - AssertIsEqual<$<{ idNonNull: { $skip: boolean } }>, { idNonNull: null|string }>() - AssertIsEqual<$<{ idNonNull: { $skip: {if:boolean} } }>, { idNonNull: null|string }>() - AssertIsEqual<$<{ idNonNull: { $skip: true } }>, { idNonNull: null }>() - AssertIsEqual<$<{ idNonNull: { $skip: {if:true} } }>, { idNonNull: null }>() - AssertIsEqual<$<{ idNonNull: { $skip: false } }>, { idNonNull: string }>() - AssertIsEqual<$<{ idNonNull: { $skip: {if:false} } }>, { idNonNull: string }>() - // On scalar nullable - AssertIsEqual<$<{ id: { $skip: boolean } }>, { id: null|string }>() - AssertIsEqual<$<{ id: { $skip: false } }>, { id: null|string }>() - AssertIsEqual<$<{ id: { $skip: true } }>, { id: null }>() - - // Directive @defer - // todo - - // Directive @stream - // todo - - // Field Group - // todo - - // Arguments - // scalar - AssertIsEqual<$<{ stringWithArgs: true }>, { stringWithArgs: null | string }>() - AssertIsEqual<$<{ stringWithArgs: { $: { string: '' } } }>, { stringWithArgs: null | string }>() - - // Errors - // @ts-expect-error invalid query - type Result = $<{ id2: true }> - // unknown field - AssertIsEqual }>() -}) +{ + +AssertEqual, 'a'>() +AssertEqual, 'b'>() + +// dprint-ignore +AssertEqual<$<{ __typename: true }>, { __typename: 'Query' }>() + +// Scalar +AssertEqual<$<{ id: true }>, { id: null | string }>() +// AssertEqual, { id: null | string }>() +// non-nullable +AssertEqual<$<{ idNonNull: true }>, { idNonNull: string }>() +// indicator negative +AssertEqual<$<{ id: true; string: false }>, { id: null | string }>() +// AssertEqual, { id: null | string }>() +AssertEqual<$<{ id: true; string: undefined }>, { id: null | string }>() + +// Custom Scalar +AssertEqual<$<{ date: true }>, { date: null | Date }>() + +// List +AssertEqual<$<{ listIntNonNull: true }>, { listIntNonNull: number[] }>() +AssertEqual<$<{ listInt: true }>, { listInt: null|(null|number)[] }>() +AssertEqual<$<{ listListIntNonNull: true }>, { listListIntNonNull: number[][] }>() +AssertEqual<$<{ listListInt: true }>, { listListInt: null|((null|(null|number)[])[]) }>() + +// Enum +AssertEqual<$<{ abcEnum: true }>, { abcEnum: null|'A'|'B'|'C' }>() + +// Object +AssertEqual<$<{ object: { id: true } }>, { object: null | { id: string | null } }>() +// non-nullable +AssertEqual<$<{ objectNonNull: { id: true } }>, { objectNonNull: { id: string | null } }>() +// with args +AssertEqual<$<{ objectWithArgs: { $: { id: 'abc' }; id: true }}>, { objectWithArgs: null | { id: string | null } }>() + +// scalars-wildcard +AssertEqual<$<{ objectNonNull: { $scalars: true } }>, { objectNonNull: { __typename: "Object1"; string: null|string; int: null|number; float: null|number; boolean: null|boolean; id: null|string } }>() +// scalars-wildcard with nested object +AssertEqual<$<{ objectNested: { $scalars: true } }>, { objectNested: null | { __typename: "ObjectNested"; id: null|string } }>() +// __typename +AssertEqual<$<{ objectNonNull: { __typename: true } }>, { objectNonNull: { __typename: "Object1" } }>() + +// Union +AssertEqual<$<{ unionFooBar: { __typename: true } }>, { unionFooBar: null | { __typename: "Foo" } | { __typename: "Bar" } }>() +AssertEqual<$<{ unionFooBar: { ___on_Foo: { __typename: true } } }>, { unionFooBar: null | {} | { __typename: "Foo" } }>() +AssertEqual<$<{ unionFooBar: { ___on_Foo: { id: true } } }>, { unionFooBar: null | {} | { id: null|string } }>() +AssertEqual<$<{ unionFooBar: { __typename: true; ___on_Foo: { id: true } } }>, { unionFooBar: null | { __typename: "Bar" } | { __typename: "Foo"; id: null|string } }>() +// with Args +AssertEqual<$<{ unionFooBarWithArgs: { $: { id: `abc` }, ___on_Foo: { id: true } } }>, { unionFooBarWithArgs: null | {} | { id: null|string } }>() + + +// Union fragments Case +AssertEqual<$<{ lowerCaseUnion: { __typename:true, ___on_lowerCaseObject: { id: true }, ___on_lowerCaseObject2: { int: true } } }>, { lowerCaseUnion: null | { __typename: 'lowerCaseObject'; id: null|string } | { __typename: 'lowerCaseObject2'; int: null|number } }>() + + +// Interface +AssertEqual<$<{ interface: { ___on_Object1ImplementingInterface: { id: true }}}>, { interface: null | { id: null | string} | {} }>() +AssertEqual<$<{ interface: { ___on_Object1ImplementingInterface: { int: true }}}>, { interface: null | { int: null | number} | {} }>() +AssertEqual<$<{ interface: { id: true }}>, { interface: null | { id: null | string} }>() +AssertEqual<$<{ interface: { id: true, ___on_Object1ImplementingInterface: { id: true } }}>, { interface: null | { id: null | string} }>() +AssertEqual<$<{ interface: { id: true, ___on_Object1ImplementingInterface: { int: true } }}>, { interface: null | { id: null | string} | { id: null | string; int: null | number }}>() +AssertEqual<$<{ interface: { __typename:true }}>, { interface: null | { __typename: 'Object1ImplementingInterface' } | { __typename: 'Object2ImplementingInterface' } }>() +AssertEqual<$<{ interface: { ___on_Object1ImplementingInterface: { __typename: true } }}>, { interface: null | { __typename: 'Object1ImplementingInterface' } | {} }>() +AssertEqual<$<{ interface: { $scalars: true }}>, { interface: null | { __typename: 'Object1ImplementingInterface', id: null | string, int: null|number} | { __typename: 'Object2ImplementingInterface', id: null | string; boolean:null|boolean} }>() +// with args +AssertEqual<$<{ interfaceWithArgs: { $:{id:'abc'}; id: true }}>, { interfaceWithArgs: null | { id: null | string } }>() + +// todo alias on interfaces, interface fragments +// Alias +// scalar +AssertEqual<$<{ id: ['id2', true] }>, { id2: null | string }>() +AssertEqual<$<{ idNonNull: ['id2', true] }>, { id2: string }>() +// multi +AssertEqual<$<{ id: [['id1', true],['id2', true]] }>, { id1: null | string; id2: null | string }>() +// AssertEqual, { id_as: ResultSet.Errors.UnknownFieldName<'id_as', Schema.Root.Query> }>() +// AssertEqual, { id_as_$: ResultSet.Errors.UnknownFieldName<'id_as_$', Schema.Root.Query> }>() +// union fragment +AssertEqual<$<{ unionFooBar: { ___on_Foo: { id: ['id2', true] } } }>, { unionFooBar: null | {} | { id2: null|string } }>() + +// Directive @include +// On scalar non-nullable +AssertEqual<$<{ idNonNull: { $include: boolean } }>, { idNonNull: null|string }>() +AssertEqual<$<{ idNonNull: { $include: {if:boolean} } }>, { idNonNull: null|string }>() +AssertEqual<$<{ idNonNull: { $include: true } }>, { idNonNull: string }>() +AssertEqual<$<{ idNonNull: { $include: {if:true} } }>, { idNonNull: string }>() +AssertEqual<$<{ idNonNull: { $include: false } }>, { idNonNull: null }>() +AssertEqual<$<{ idNonNull: { $include: {if:false} } }>, { idNonNull: null }>() +// On scalar nullable +AssertEqual<$<{ id: { $include: boolean } }>, { id: null|string }>() +AssertEqual<$<{ id: { $include: false } }>, { id: null }>() +AssertEqual<$<{ id: { $include: true } }>, { id: null|string }>() + +// Directive @skip +// On scalar non-nullable +AssertEqual<$<{ idNonNull: { $skip: boolean } }>, { idNonNull: null|string }>() +AssertEqual<$<{ idNonNull: { $skip: {if:boolean} } }>, { idNonNull: null|string }>() +AssertEqual<$<{ idNonNull: { $skip: true } }>, { idNonNull: null }>() +AssertEqual<$<{ idNonNull: { $skip: {if:true} } }>, { idNonNull: null }>() +AssertEqual<$<{ idNonNull: { $skip: false } }>, { idNonNull: string }>() +AssertEqual<$<{ idNonNull: { $skip: {if:false} } }>, { idNonNull: string }>() +// On scalar nullable +AssertEqual<$<{ id: { $skip: boolean } }>, { id: null|string }>() +AssertEqual<$<{ id: { $skip: false } }>, { id: null|string }>() +AssertEqual<$<{ id: { $skip: true } }>, { id: null }>() + +// Directive @defer +// todo + +// Directive @stream +// todo + +// Field Group +// todo + +// Arguments +// scalar +AssertEqual<$<{ stringWithArgs: true }>, { stringWithArgs: null | string }>() +AssertEqual<$<{ stringWithArgs: { $: { string: '' } } }>, { stringWithArgs: null | string }>() + +// Errors +// @ts-expect-error invalid query +type Result = $<{ id2: true }> +// unknown field +AssertEqual }>() + +} diff --git a/src/layers/3_Result/infer/root.ts b/src/layers/3_Result/infer/root.ts index 761b965c..5f495a6a 100644 --- a/src/layers/3_Result/infer/root.ts +++ b/src/layers/3_Result/infer/root.ts @@ -1,5 +1,5 @@ import type { Simplify } from 'type-fest' -import { AssertIsEqual, type ExcludeNull, type GetKeyOr, type StringKeyof } from '../../../lib/prelude.js' +import { type ExcludeNull, type GetKeyOr, type StringKeyof } from '../../../lib/prelude.js' import type { TSError } from '../../../lib/TSError.js' import type { Schema } from '../../1_Schema/__.js' import type { Select } from '../../2_Select/__.js' @@ -56,7 +56,7 @@ type InferSelectionNonSelectAlias<$SelectionSet , $Schema extends SchemaIndex, $ } // dprint-ignore -type PickSelectsPositiveIndicatorAndNotSelectAlias<$SelectionSet> = StringKeyof<{ +export type PickSelectsPositiveIndicatorAndNotSelectAlias<$SelectionSet> = StringKeyof<{ [ $FieldName in keyof $SelectionSet as $SelectionSet[$FieldName] extends Select.Indicator.Negative ? never @@ -66,9 +66,6 @@ type PickSelectsPositiveIndicatorAndNotSelectAlias<$SelectionSet> = StringKeyof< ]: 0 }> -AssertIsEqual, 'a'>() -AssertIsEqual, 'b'>() - type InferSelectScalarsWildcard< $SelectionSet, $Index extends SchemaIndex, diff --git a/src/layers/5_core/__.ts b/src/layers/5_core/__.ts deleted file mode 100644 index 8b0f2fcf..00000000 --- a/src/layers/5_core/__.ts +++ /dev/null @@ -1 +0,0 @@ -export * as Core from './_.js' diff --git a/src/layers/5_core/hooks.ts b/src/layers/5_core/hooks.ts deleted file mode 100644 index f2fc4f9a..00000000 --- a/src/layers/5_core/hooks.ts +++ /dev/null @@ -1,112 +0,0 @@ -import type { DocumentNode, ExecutionResult, GraphQLSchema } from 'graphql' -import type { - GraphQLRequestEncoded, - GraphQLRequestInput, - StandardScalarVariables, -} from '../../lib/graphql-plus/graphql.js' -import type { getRequestEncodeSearchParameters, postRequestEncodeBody } from '../../lib/graphqlHTTP.js' -import type { Select } from '../2_Select/__.js' -import type { InterfaceTypedRequestContext, RequestContext } from '../6_client/client.js' -import type { Config } from '../6_client/Settings/Config.js' -import type { CoreExchangeGetRequest, CoreExchangePostRequest } from '../6_client/transportHttp/request.js' -import type { InterfaceRaw, InterfaceTyped, TransportHttp, TransportMemory } from './types.js' - -type InterfaceInput = - | ({ - interface: InterfaceTyped - context: InterfaceTypedRequestContext - document: Select.Document.DocumentNormalized - operationName?: string - } & TypedProperties) - | ({ - interface: InterfaceRaw - context: RequestContext - } & RawProperties) - -// dprint-ignore - -type TransportInput<$Config extends Config, $HttpProperties = {}, $MemoryProperties = {}> = - | ( - TransportHttp extends $Config['transport']['type'] - ? ({ - transport: TransportHttp - - } & $HttpProperties) - : never - ) - | ( - TransportMemory extends $Config['transport']['type'] - ? ({ - transport: TransportMemory - } & $MemoryProperties) - : never - ) - -export const hookNamesOrderedBySequence = [`encode`, `pack`, `exchange`, `unpack`, `decode`] as const - -export type HookSequence = typeof hookNamesOrderedBySequence - -export type HookDefEncode<$Config extends Config> = { - input: - & InterfaceInput<{ operationName?: string }, GraphQLRequestInput> - & TransportInput<$Config, { schema: string | URL }, { schema: GraphQLSchema }> -} - -export type HookDefPack<$Config extends Config> = { - input: - & GraphQLRequestEncoded - & InterfaceInput - // todo why is headers here but not other http request properties? - & TransportInput<$Config, { url: string | URL; headers?: HeadersInit }, { - schema: GraphQLSchema - }> - slots: { - /** - * When request will be sent using GET this slot is called to create the value that will be used for the HTTP Search Parameters. - */ - searchParams: getRequestEncodeSearchParameters - /** - * When request will be sent using POST this slot is called to create the value that will be used for the HTTP body. - */ - body: postRequestEncodeBody - } -} - -export type HookDefExchange<$Config extends Config> = { - slots: { - fetch: (request: Request) => Response | Promise - } - input: - & InterfaceInput - & TransportInput<$Config, { - request: CoreExchangePostRequest | CoreExchangeGetRequest - }, { - schema: GraphQLSchema - query: string | DocumentNode - variables?: StandardScalarVariables - operationName?: string - }> -} - -export type HookDefUnpack<$Config extends Config> = { - input: - & InterfaceInput - & TransportInput<$Config, { response: Response }, { - result: ExecutionResult - }> -} - -export type HookDefDecode<$Config extends Config> = { - input: - & { result: ExecutionResult } - & InterfaceInput - & TransportInput<$Config, { response: Response }> -} - -export type HookMap<$Config extends Config = Config> = { - encode: HookDefEncode<$Config> - pack: HookDefPack<$Config> - exchange: HookDefExchange<$Config> - unpack: HookDefUnpack<$Config> - decode: HookDefDecode<$Config> -} diff --git a/src/layers/5_core/_.ts b/src/layers/5_request/_.ts similarity index 100% rename from src/layers/5_core/_.ts rename to src/layers/5_request/_.ts diff --git a/src/layers/5_request/__.ts b/src/layers/5_request/__.ts new file mode 100644 index 00000000..e69c98a8 --- /dev/null +++ b/src/layers/5_request/__.ts @@ -0,0 +1 @@ +export * as RequestCore from './_.js' diff --git a/src/layers/5_core/core.ts b/src/layers/5_request/core.ts similarity index 73% rename from src/layers/5_core/core.ts rename to src/layers/5_request/core.ts index 0728350f..bcbde1b6 100644 --- a/src/layers/5_core/core.ts +++ b/src/layers/5_request/core.ts @@ -1,33 +1,36 @@ import { type ExecutionResult, parse, print } from 'graphql' import { Anyware } from '../../lib/anyware/__.js' -import { - OperationTypeAccessTypeMap, - parseGraphQLOperationType, - type StandardScalarVariables, -} from '../../lib/graphql-plus/graphql.js' import { getRequestEncodeSearchParameters, getRequestHeadersRec, parseExecutionResult, postRequestEncodeBody, postRequestHeadersRec, -} from '../../lib/graphqlHTTP.js' +} from '../../lib/graphql-http/graphqlHTTP.js' +import { execute } from '../../lib/graphql-plus/execute.js' +import type { Nodes } from '../../lib/graphql-plus/graphql.js' +import { + OperationTypeAccessTypeMap, + parseGraphQLOperationType, + type Variables, +} from '../../lib/graphql-plus/graphql.js' import { mergeRequestInit, searchParamsAppendAll } from '../../lib/http.js' -import { casesExhausted, getOptionalNullablePropertyOrThrow, throwNull } from '../../lib/prelude.js' -import { execute } from '../0_functions/execute.js' +import { casesExhausted, getOptionalNullablePropertyOrThrow, isString, throwNull } from '../../lib/prelude.js' import { Select } from '../2_Select/__.js' import { ResultSet } from '../3_Result/__.js' import { SelectionSetGraphqlMapper } from '../3_SelectGraphQLMapper/__.js' -import type { GraffleExecutionResultVar } from '../6_client/client.js' +import type { GraffleExecutionResultVar } from '../6_client/handleOutput.js' import type { Config } from '../6_client/Settings/Config.js' +import { MethodMode, type MethodModeGetReads } from '../6_client/transportHttp/request.js' import { type CoreExchangeGetRequest, type CoreExchangePostRequest, - MethodMode, - type MethodModeGetReads, -} from '../6_client/transportHttp/request.js' -import { type HookMap, hookNamesOrderedBySequence, type HookSequence } from './hooks.js' + type HookMap, + hookNamesOrderedBySequence, + type HookSequence, +} from './hooks.js' import { injectTypenameOnRootResultFields } from './schemaErrors.js' +import { Transport } from './types.js' export const anyware = Anyware.create({ // If core errors caused by an abort error then raise it as a direct error. @@ -44,60 +47,50 @@ export const anyware = Anyware.create({ let documentString: string // todo: the other case where we're going to need to parse document is for custom scalar support of raw - const isWillInjectTypename = input.context.config.output.errors.schema && input.context.schemaIndex + const isWillInjectTypename = input.state.config.output.errors.schema && input.schemaIndex if (isWillInjectTypename) { - const documentObject = input.interface === `raw` - ? typeof input.document === `string` - ? parse(input.document) - : input.document + const documentObject: Nodes.DocumentNode = input.interfaceType === `raw` + ? isString(input.request.query) + ? parse(input.request.query) + : input.request.query as Nodes.DocumentNode : SelectionSetGraphqlMapper.toGraphQL({ - schema: input.context.schemaIndex, - document: input.document, - customScalarsIndex: input.context.schemaIndex.customScalars.input, + schema: input.schemaIndex!, + document: input.request.document, + customScalarsIndex: input.schemaIndex!.customScalars.input, }) injectTypenameOnRootResultFields({ document: documentObject, - operationName: input.operationName, - schema: input.context.schemaIndex!, + operationName: input.request.operationName, + schema: input.schemaIndex!, }) documentString = print(documentObject) } else { - documentString = input.interface === `raw` - ? typeof input.document === `string` - ? input.document - : print(input.document) + documentString = input.interfaceType === `raw` + ? isString(input.request.query) + ? input.request.query + : print(input.request.query as Nodes.DocumentNode) : print(SelectionSetGraphqlMapper.toGraphQL({ - schema: input.context.schemaIndex, - document: input.document, - customScalarsIndex: input.context.schemaIndex.customScalars.input, + schema: input.schemaIndex!, + document: input.request.document, + customScalarsIndex: input.schemaIndex!.customScalars.input, })) } - const variables: StandardScalarVariables | undefined = input.interface === `raw` - ? input.variables + const variables: Variables | undefined = input.interfaceType === `raw` + ? input.request.variables // todo turn inputs into variables : undefined - switch (input.transport) { - case `http`: { - return { - ...input, - url: input.schema, - query: documentString, - variables, - } - } - case `memory`: { - return { - ...input, - schema: input.schema, - query: documentString, - variables, - } - } + return { + ...input, + request: { + query: documentString, + variables, + operationName: input.request.operationName, + }, } }, pack: { @@ -107,17 +100,26 @@ export const anyware = Anyware.create({ }, run: ({ input, slots }) => { // TODO thrown error here is swallowed in examples. - switch (input.transport) { + switch (input.transportType) { case `memory`: { return input + // return { + // ...input, + // request: { + // ...input.request, + // schema: input.schema, + // }, + // } } case `http`: { - const methodMode = input.context.config.transport.config.methodMode + if (input.state.config.transport.type !== Transport.http) throw new Error(`transport type is not http`) + + const methodMode = input.state.config.transport.config.methodMode // todo parsing here can be optimized. // 1. If using TS interface then work with initially submitted structured data to already know the operation type // 2. Maybe: Memoize over request.{ operationName, query } // 3. Maybe: Keep a cache of parsed request.{ query } - const operationType = throwNull(parseGraphQLOperationType(input)) // todo better feedback here than throwNull + const operationType = throwNull(parseGraphQLOperationType(input.request)) // todo better feedback here than throwNull const requestMethod = methodMode === MethodMode.post ? `post` : methodMode === MethodMode.getReads // eslint-disable-line @@ -131,11 +133,11 @@ export const anyware = Anyware.create({ headers: requestMethod === `get` ? getRequestHeadersRec : postRequestHeadersRec, }, { - headers: input.context.config.transport.config.headers, - signal: input.context.config.transport.config.signal, + headers: input.state.config.transport.config.headers, + signal: input.state.config.transport.config.signal, }, ), - input.context.config.transport.config.raw, + input.state.config.transport.config.raw, ), { headers: input.headers, @@ -146,18 +148,14 @@ export const anyware = Anyware.create({ methodMode: methodMode as MethodModeGetReads, ...baseProperties, method: `get`, - url: searchParamsAppendAll(input.url, slots.searchParams(input)), + url: searchParamsAppendAll(input.url, slots.searchParams(input.request)), } : { methodMode: methodMode, ...baseProperties, method: `post`, url: input.url, - body: slots.body({ - query: input.query, - variables: input.variables, - operationName: input.operationName, - }), + body: slots.body(input.request), } return { ...input, @@ -176,7 +174,7 @@ export const anyware = Anyware.create({ fetch: (request) => fetch(request), }, run: async ({ input, slots }) => { - switch (input.transport) { + switch (input.transportType) { case `http`: { const request = new Request(input.request.url, input.request) const response = await slots.fetch(request) @@ -186,12 +184,7 @@ export const anyware = Anyware.create({ } } case `memory`: { - const result = await execute({ - schema: input.schema, - document: input.query, - variables: input.variables, - operationName: input.operationName, - }) + const result = await execute(input) return { ...input, result, @@ -203,7 +196,7 @@ export const anyware = Anyware.create({ }, }, unpack: async ({ input }) => { - switch (input.transport) { + switch (input.transportType) { case `http`: { // todo 1 if response is missing header of content length then .json() hangs forever. // firstly consider a timeout, secondly, if response is malformed, then don't even run .json() @@ -232,10 +225,10 @@ export const anyware = Anyware.create({ // Hooks could have a new optional field "schema". When present certain enhanced features would be allowed. // like custom scalars and result fields. decode: ({ input }) => { - switch (input.interface) { + switch (input.interfaceType) { // todo this depends on the return mode case `raw`: { - switch (input.transport) { + switch (input.transportType) { case `http`: { return { ...input.result, @@ -250,18 +243,20 @@ export const anyware = Anyware.create({ } } case `typed`: { - const operation = Select.Document.getOperationOrThrow(input.document, input.operationName) + if (!input.schemaIndex) throw new Error(`schemaIndex is required for typed decode`) + + const operation = Select.Document.getOperationOrThrow(input.document!, input.operationName) // todo optimize // 1. Generate a map of possible custom scalar paths (tree structure) // 2. When traversing the result, skip keys that are not in the map // console.log(input.context.schemaIndex.Root) // console.log(getOptionalNullablePropertyOrThrow(input.context.schemaIndex.Root, operation.rootType)) const dataDecoded = ResultSet.decode( - getOptionalNullablePropertyOrThrow(input.context.schemaIndex.Root, operation.rootType), + getOptionalNullablePropertyOrThrow(input.schemaIndex.Root, operation.rootType), operation.selectionSet, input.result.data, ) - switch (input.transport) { + switch (input.transportType) { case `memory`: { return { ...input.result, data: dataDecoded } } diff --git a/src/layers/5_request/hooks.ts b/src/layers/5_request/hooks.ts new file mode 100644 index 00000000..94e33736 --- /dev/null +++ b/src/layers/5_request/hooks.ts @@ -0,0 +1,143 @@ +import type { ExecutionResult, GraphQLSchema } from 'graphql' +import type { GraphQLHTTP } from '../../lib/graphql-http/__.js' +import type { getRequestEncodeSearchParameters, postRequestEncodeBody } from '../../lib/graphql-http/graphqlHTTP.js' +import type { GraphQLRequestInput } from '../../lib/graphql-plus/graphql.js' +import type { httpMethodGet, httpMethodPost } from '../../lib/http.js' +import type { Select } from '../2_Select/__.js' +import type { SchemaIndex } from '../4_generator/generators/SchemaIndex.js' +import type { State } from '../6_client/fluent.js' +import type { Config } from '../6_client/Settings/Config.js' +import type { MethodModeGetReads, MethodModePost } from '../6_client/transportHttp/request.js' +import type { InterfaceRaw, InterfaceTyped, TransportHttp, TransportMemory } from './types.js' + +interface HookInputBase { + schemaIndex: SchemaIndex | null + state: State + // todo remove these + document?: Select.Document.DocumentNormalized + operationName?: string +} + +type InterfaceInput = + | ({ + interfaceType: InterfaceTyped + } & TypedProperties) + | ({ + interfaceType: InterfaceRaw + } & RawProperties) + +// dprint-ignore + +type TransportInput<$Config extends Config, $HttpProperties = {}, $MemoryProperties = {}> = + | ( + TransportHttp extends $Config['transport']['type'] + ? ({ + transportType: TransportHttp + url: string | URL + } & $HttpProperties) + : never + ) + | ( + TransportMemory extends $Config['transport']['type'] + ? ({ + transportType: TransportMemory + schema: GraphQLSchema + } & $MemoryProperties) + : never + ) + +export type HookDefEncode<$Config extends Config> = { + input: + & HookInputBase + & InterfaceInput< + { request: { document: Select.Document.DocumentNormalized; operationName?: string } }, + { request: GraphQLRequestInput } + > + & TransportInput<$Config> +} + +export type HookDefPack<$Config extends Config> = { + input: + & HookInputBase + & InterfaceInput + & TransportInput< + $Config, + // todo why is headers here but not other http request properties? + { headers?: HeadersInit } + > + & { request: GraphQLHTTP.RequestInput } + slots: { + /** + * When request will be sent using GET this slot is called to create the value that will be used for the HTTP Search Parameters. + */ + searchParams: getRequestEncodeSearchParameters + /** + * When request will be sent using POST this slot is called to create the value that will be used for the HTTP body. + */ + body: postRequestEncodeBody + } +} + +export type HookDefExchange<$Config extends Config> = { + slots: { + fetch: (request: Request) => Response | Promise + } + input: + & HookInputBase + & InterfaceInput + & TransportInput< + $Config, + { request: CoreExchangePostRequest | CoreExchangeGetRequest }, + { request: GraphQLHTTP.RequestInput } + > +} + +export type HookDefUnpack<$Config extends Config> = { + input: + & HookInputBase + & InterfaceInput + & TransportInput< + $Config, + { response: Response }, + { result: ExecutionResult } + > +} + +export type HookDefDecode<$Config extends Config> = { + input: + & HookInputBase + & InterfaceInput + & TransportInput< + $Config, + { response: Response } + > + & { result: ExecutionResult } +} + +export type HookMap<$Config extends Config = Config> = { + encode: HookDefEncode<$Config> + pack: HookDefPack<$Config> + exchange: HookDefExchange<$Config> + unpack: HookDefUnpack<$Config> + decode: HookDefDecode<$Config> +} + +export const hookNamesOrderedBySequence = [`encode`, `pack`, `exchange`, `unpack`, `decode`] as const + +export type HookSequence = typeof hookNamesOrderedBySequence + +/** + * An extension of {@link RequestInit} that adds a required `url` property and makes `body` required. + */ +export type CoreExchangePostRequest = Omit & { + methodMode: MethodModePost | MethodModeGetReads + method: httpMethodPost + url: string | URL // todo URL for config and string only for input. Requires anyware to allow different types for input and existing config. + body: BodyInit +} + +export type CoreExchangeGetRequest = Omit & { + methodMode: MethodModeGetReads + method: httpMethodGet + url: string | URL +} diff --git a/src/layers/5_core/schemaErrors.test.ts b/src/layers/5_request/schemaErrors.test.ts similarity index 89% rename from src/layers/5_core/schemaErrors.test.ts rename to src/layers/5_request/schemaErrors.test.ts index 6b9e0571..35e2a59c 100644 --- a/src/layers/5_core/schemaErrors.test.ts +++ b/src/layers/5_request/schemaErrors.test.ts @@ -1,10 +1,10 @@ +import { parse } from 'graphql' import { expect } from 'vitest' import { test } from '../../../tests/_/helpers.js' import { $Index as schema } from '../../../tests/_/schemas/kitchen-sink/graffle/modules/SchemaRuntime.js' import type { Query } from '../../../tests/_/schemas/kitchen-sink/graffle/modules/SelectionSets.js' import { Select } from '../2_Select/__.js' import { SelectionSetGraphqlMapper } from '../3_SelectGraphQLMapper/__.js' -import { gql } from '../6_helpers/gql.js' import { Throws } from '../7_extensions/Throws/Throws.js' import { injectTypenameOnRootResultFields } from './schemaErrors.js' @@ -36,18 +36,17 @@ test.each([ expect(documentWithoutTypename).toMatchObject(documentWithTypename) }) +// dprint-ignore test(`type name field injection works for raw string requests`, async ({ kitchenSink }) => { // todo it would be nicer to move the extension use to the fixture but how would we get the static type for that? // This makes me think of a feature we need to have. Make it easy to get static types of the client in its various configured states. - const result = await kitchenSink.use(Throws()).throws().rawString({ - document: `query { resultNonNull (case: Object1) { ... on Object1 { id } } }`, - }) + const result = await kitchenSink.use(Throws()).throws().gql`query { resultNonNull (case: Object1) { ... on Object1 { id } } }`.send() expect(result).toMatchObject({ resultNonNull: { __typename: `Object1`, id: `abc` } }) }) test(`type name field injection works for raw document requests`, async ({ kitchenSink }) => { - const result = await kitchenSink.use(Throws()).throws().raw({ - document: gql`query { resultNonNull (case: Object1) { ... on Object1 { id } } }`, - }) + const result = await kitchenSink.use(Throws()).throws().gql( + parse(`query { resultNonNull (case: Object1) { ... on Object1 { id } } }`), + ).send() expect(result).toMatchObject({ resultNonNull: { __typename: `Object1`, id: `abc` } }) }) diff --git a/src/layers/5_core/schemaErrors.ts b/src/layers/5_request/schemaErrors.ts similarity index 100% rename from src/layers/5_core/schemaErrors.ts rename to src/layers/5_request/schemaErrors.ts diff --git a/src/layers/5_core/types.ts b/src/layers/5_request/types.ts similarity index 100% rename from src/layers/5_core/types.ts rename to src/layers/5_request/types.ts diff --git a/src/layers/6_client/Settings/Config.ts b/src/layers/6_client/Settings/Config.ts index c41a05c9..420786c2 100644 --- a/src/layers/6_client/Settings/Config.ts +++ b/src/layers/6_client/Settings/Config.ts @@ -1,9 +1,10 @@ +import type { GraphQLSchema } from 'graphql' import type { RequireProperties, StringKeyof } from '../../../lib/prelude.js' import type { Schema } from '../../1_Schema/__.js' import type { Select } from '../../2_Select/__.js' import type { SchemaIndex } from '../../4_generator/generators/SchemaIndex.js' import type { GlobalRegistry } from '../../4_generator/globalRegistry.js' -import type { Transport } from '../../5_core/types.js' +import type { TransportHttp, TransportMemory } from '../../5_request/types.js' import type { ConfigGetOutputError } from '../handleOutput.js' import type { TransportHttpInput } from '../transportHttp/request.js' import type { InputStatic } from './Input.js' @@ -103,6 +104,17 @@ export type OutputConfigDefault = { } } +export interface TransportConfigHttp { + type: TransportHttp + url: string | URL + config: RequireProperties +} + +export interface TransportConfigMemory { + type: TransportMemory + schema: GraphQLSchema +} + export type Config = { /** * The initial input that was given to derive this config. @@ -110,10 +122,8 @@ export type Config = { initialInput: InputStatic // InputStatic name: GlobalRegistry.SchemaNames output: OutputConfig - transport: { - type: Transport - config: RequireProperties - } + schemaIndex: SchemaIndex | null + transport: TransportConfigHttp | TransportConfigMemory } /** diff --git a/src/layers/6_client/Settings/InputToConfig.ts b/src/layers/6_client/Settings/InputToConfig.ts index dcdae446..18bad66c 100644 --- a/src/layers/6_client/Settings/InputToConfig.ts +++ b/src/layers/6_client/Settings/InputToConfig.ts @@ -1,19 +1,17 @@ import type { IsUnknown } from 'type-fest' import type { ConfigManager } from '../../../lib/prelude.js' import type { GlobalRegistry } from '../../4_generator/globalRegistry.js' -import { Transport, type TransportHttp, type TransportMemory } from '../../5_core/types.js' +import { Transport } from '../../5_request/types.js' import { defaultMethodMode } from '../transportHttp/request.js' -import { type Config, outputConfigDefault } from './Config.js' +import { outputConfigDefault, type TransportConfigHttp, type TransportConfigMemory } from './Config.js' import type { InputOutputEnvelopeLonghand, InputStatic, URLInput } from './Input.js' // dprint-ignore export type InputToConfig<$Input extends InputStatic> = { initialInput: $Input name: HandleName<$Input> - transport: { - type: HandleTransport<$Input> - config: Config['transport']['config'] - } + schemaIndex: ConfigManager.OrDefault<$Input['schemaIndex'], null> + transport: HandleTransport<$Input> output: { defaults: { errorChannel: ConfigManager.ReadOrDefault<$Input, ['output', 'defaults', 'errorChannel'], 'throw'> @@ -43,22 +41,20 @@ export const defaultSchemaName: GlobalRegistry.DefaultSchemaName = `default` export const inputToConfig = <$Input extends InputStatic>( input: $Input, ): InputToConfig<$Input> => { - const envelopeLonghand: InputOutputEnvelopeLonghand | undefined = typeof input.output?.envelope === `object` + const outputEnvelopeLonghand: InputOutputEnvelopeLonghand | undefined = typeof input.output?.envelope === `object` ? { enabled: true, ...input.output.envelope } : typeof input.output?.envelope === `boolean` ? { enabled: input.output.envelope } : undefined + + const transport = handleTransport(input) + return { initialInput: input, // @ts-expect-error conditional type fixme name: input.name ?? defaultSchemaName, - transport: { - type: handleTransportType(input), - config: { - methodMode: input.transport?.methodMode ?? defaultMethodMode, - ...input.transport, - }, - }, + transport, + schemaIndex: input.schemaIndex ?? null as any, output: { defaults: { // @ts-expect-error conditional type @@ -66,15 +62,15 @@ export const inputToConfig = <$Input extends InputStatic> = $Input // dprint-ignore type HandleTransport<$Input extends InputStatic> = - $Input['schema'] extends URLInput ? TransportHttp : + $Input['schema'] extends URLInput ? TransportConfigHttp : // When the client is generated via introspection of a URL then the schema defaults to that URL. // This is the only case when schema can be unknown from so we can assume that transport is HTTP. - IsUnknown<$Input['schema']> extends true ? TransportHttp - : TransportMemory + IsUnknown<$Input['schema']> extends true ? TransportConfigHttp + : TransportConfigMemory -const handleTransportType = >(input: T): HandleTransport => { - // @ts-expect-error conditional type - return input.schema instanceof URL || typeof input.schema === `string` ? Transport.http : Transport.memory +const handleTransport = >(input: T): HandleTransport => { + if (input.schema instanceof URL || typeof input.schema === `string`) { + return { + type: Transport.http, + url: input.schema, + config: { + methodMode: input.transport?.methodMode ?? defaultMethodMode, + ...input.transport, + }, + } as any + } + return { + type: Transport.memory, + schema: input.schema, + } as any } diff --git a/src/layers/6_client/Settings/client.create.config.output.test-d.ts b/src/layers/6_client/Settings/client.create.config.output.test-d.ts index 717845bf..8d12df06 100644 --- a/src/layers/6_client/Settings/client.create.config.output.test-d.ts +++ b/src/layers/6_client/Settings/client.create.config.output.test-d.ts @@ -4,10 +4,9 @@ import { describe } from 'node:test' import { expectTypeOf, test } from 'vitest' import { Graffle } from '../../../../tests/_/schemas/kitchen-sink/graffle/__.js' import { schema } from '../../../../tests/_/schemas/kitchen-sink/schema.js' +import { AssertEqual } from '../../../lib/assert-equal.js' import { type GraphQLExecutionResultError } from '../../../lib/graphql-plus/graphql.js' -import { AssertIsEqual } from '../../../lib/prelude.js' -import type { ErrorsOther } from '../client.js' -import type { Envelope } from '../handleOutput.js' +import type { Envelope, ErrorsOther } from '../handleOutput.js' const G = Graffle.create @@ -83,7 +82,7 @@ describe('.envelope', () => { }) test('query.$batch', () => { const result = g.query.$batch({ __typename: true, idNonNull: true }) - AssertIsEqual> + AssertEqual> }) }) test('object enables it', async () => { @@ -183,7 +182,7 @@ describe('.errors.schema', () => { }) describe('envelope.schema', () => { const g = G({ schema, output: { envelope: { errors: { schema: true } }, errors: { schema: 'return' } } }) - type Config = typeof g._.context.config + type Config = typeof g._.config test('query.', async () => { // todo: once we have execution result with type variable errors, then enhance this test to assert that the result errors come through in the errors field. expectTypeOf(g.query.resultNonNull(resultFieldSelect)).resolves.toEqualTypeOf< diff --git a/src/layers/6_client/Settings/inputIncrementable/inputIncrementable.ts b/src/layers/6_client/Settings/inputIncrementable/inputIncrementable.ts index a8674948..8eba5c84 100644 --- a/src/layers/6_client/Settings/inputIncrementable/inputIncrementable.ts +++ b/src/layers/6_client/Settings/inputIncrementable/inputIncrementable.ts @@ -1,5 +1,5 @@ import type { GlobalRegistry } from '../../../4_generator/globalRegistry.js' -import type { Transport, TransportMemory } from '../../../5_core/types.js' +import type { Transport, TransportMemory } from '../../../5_request/types.js' import type { TransportHttpInput } from '../../transportHttp/request.js' import type { Config } from '../Config.js' import type { InputToConfig } from '../InputToConfig.js' diff --git a/src/layers/6_client/client.test.ts b/src/layers/6_client/client.test.ts index de426ecc..f9bb0b97 100644 --- a/src/layers/6_client/client.test.ts +++ b/src/layers/6_client/client.test.ts @@ -22,7 +22,7 @@ describe(`without schemaIndex only raw is available`, () => { }) test(`available methods`, () => { - expect(graffle.raw).toBeTypeOf(`function`) + expect(graffle.gql).toBeTypeOf(`function`) }) }) diff --git a/src/layers/6_client/client.transport-http.test.ts b/src/layers/6_client/client.transport-http.test.ts index 91dbb63a..be47ca73 100644 --- a/src/layers/6_client/client.transport-http.test.ts +++ b/src/layers/6_client/client.transport-http.test.ts @@ -3,26 +3,25 @@ import { createResponse, test } from '../../../tests/_/helpers.js' import { serveSchema } from '../../../tests/_/lib/serveSchema.js' import { Pokemon } from '../../../tests/_/schemas/pokemon/graffle/__.js' import { Graffle } from '../../entrypoints/main.js' -import { ACCEPT_REC, CONTENT_TYPE_REC } from '../../lib/graphqlHTTP.js' -import { Transport } from '../5_core/types.js' -import type { CoreExchangeGetRequest, CoreExchangePostRequest } from './transportHttp/request.js' +import { ACCEPT_REC, CONTENT_TYPE_REC } from '../../lib/graphql-http/graphqlHTTP.js' +import { Transport } from '../5_request/types.js' const schema = new URL(`https://foo.io/api/graphql`) test(`anyware hooks are typed to http transport`, () => { Graffle.create({ schema }).anyware(async ({ encode }) => { - expectTypeOf(encode.input.transport).toEqualTypeOf(Transport.http) + expectTypeOf(encode.input.transportType).toEqualTypeOf(Transport.http) const { pack } = await encode() - expectTypeOf(pack.input.transport).toEqualTypeOf(Transport.http) + expectTypeOf(pack.input.transportType).toEqualTypeOf(Transport.http) const { exchange } = await pack() - expectTypeOf(exchange.input.transport).toEqualTypeOf(Transport.http) + expectTypeOf(exchange.input.transportType).toEqualTypeOf(Transport.http) // todo we can statically track the method mode like we do the transport mode expectTypeOf(exchange.input.request).toEqualTypeOf() const { unpack } = await exchange() - expectTypeOf(unpack.input.transport).toEqualTypeOf(Transport.http) + expectTypeOf(unpack.input.transportType).toEqualTypeOf(Transport.http) expectTypeOf(unpack.input.response).toEqualTypeOf() const { decode } = await unpack() - expectTypeOf(decode.input.transport).toEqualTypeOf(Transport.http) + expectTypeOf(decode.input.transportType).toEqualTypeOf(Transport.http) expectTypeOf(decode.input.response).toEqualTypeOf() const result = await decode() if (!(result instanceof Error)) { @@ -33,6 +32,7 @@ test(`anyware hooks are typed to http transport`, () => { }) import { schema as schemaPokemon } from '../../../tests/_/schemas/pokemon/schema.js' +import type { CoreExchangeGetRequest, CoreExchangePostRequest } from '../5_request/hooks.js' test(`when envelope is used then response property is present even if relying on schema url default`, async () => { const service = await serveSchema({ schema: schemaPokemon }) @@ -46,7 +46,7 @@ describe(`methodMode`, () => { describe(`default (post)`, () => { test(`sends spec compliant post request by default`, async ({ fetch, graffle }) => { fetch.mockImplementationOnce(() => Promise.resolve(createResponse({ data: { id: `abc` } }))) - await graffle.rawString({ document: `query { id }` }) + await graffle.gql`query { id }`.send() const request = fetch.mock.calls[0]?.[0] expect(request?.method).toEqual(`POST`) expect(request?.headers.get(`content-type`)).toEqual(CONTENT_TYPE_REC) @@ -57,11 +57,7 @@ describe(`methodMode`, () => { test(`can set method mode to get`, async ({ fetch }) => { fetch.mockImplementationOnce(() => Promise.resolve(createResponse({ data: { user: { name: `foo` } } }))) const graffle = Graffle.create({ schema, transport: { methodMode: `getReads` } }) - await graffle.rawString({ - document: `query foo($id: ID!){user(id:$id){name}}`, - variables: { 'id': `QVBJcy5ndXJ1` }, - operationName: `foo`, - }) + await graffle.gql`query foo($id: ID!){user(id:$id){name}}`.send(`foo`, { 'id': `QVBJcy5ndXJ1` }) const request = fetch.mock.calls[0]?.[0] expect(request?.method).toEqual(`GET`) expect(request?.headers.get(`content-type`)).toEqual(null) @@ -73,14 +69,14 @@ describe(`methodMode`, () => { test(`if no variables or operationName then search parameters are omitted`, async ({ fetch }) => { fetch.mockImplementationOnce(() => Promise.resolve(createResponse({ data: { user: { name: `foo` } } }))) const graffle = Graffle.create({ schema, transport: { methodMode: `getReads` } }) - await graffle.rawString({ document: `query {user{name}}` }) + await graffle.gql`query {user{name}}`.send() const request = fetch.mock.calls[0]?.[0] expect(request?.url).toMatchInlineSnapshot(`"https://foo.io/api/graphql?query=query+%7Buser%7Bname%7D%7D"`) }) test(`mutation still uses POST`, async ({ fetch }) => { fetch.mockImplementationOnce(() => Promise.resolve(createResponse({ data: { user: { name: `foo` } } }))) const graffle = Graffle.create({ schema, transport: { methodMode: `getReads` } }) - await graffle.rawString({ document: `mutation { user { name } }` }) + await graffle.gql`mutation { user { name } }`.send() const request = fetch.mock.calls[0]?.[0] expect(request?.method).toEqual(`POST`) expect(request?.headers.get(`content-type`)).toEqual(CONTENT_TYPE_REC) @@ -93,7 +89,7 @@ describe(`configuration`, () => { test(`can set headers`, async ({ fetch }) => { fetch.mockImplementationOnce(() => Promise.resolve(createResponse({ data: { id: `abc` } }))) const graffle = Graffle.create({ schema, transport: { headers: { 'x-foo': `bar` } } }) - await graffle.rawString({ document: `query { id }` }) + await graffle.gql`query { id }`.send() const request = fetch.mock.calls[0]?.[0] expect(request?.headers.get(`x-foo`)).toEqual(`bar`) }) @@ -101,7 +97,7 @@ describe(`configuration`, () => { test(`can set raw (requestInit)`, async ({ fetch }) => { fetch.mockImplementationOnce(() => Promise.resolve(createResponse({ data: { id: `abc` } }))) const graffle = Graffle.create({ schema, transport: { raw: { headers: { 'x-foo': `bar` } } } }) - await graffle.rawString({ document: `query { id }` }) + await graffle.gql`query { id }`.send() const request = fetch.mock.calls[0]?.[0] expect(request?.headers.get(`x-foo`)).toEqual(`bar`) }) @@ -111,7 +107,7 @@ describe(`configuration`, () => { test(`to constructor`, async () => { const abortController = new AbortController() const graffle = Graffle.create({ schema, transport: { signal: abortController.signal } }) - const resultPromise = graffle.rawString({ document: `query { id }` }) + const resultPromise = graffle.gql`query { id }`.send() abortController.abort() const { caughtError } = await resultPromise.catch((caughtError: unknown) => ({ caughtError })) as any as { caughtError: Error @@ -121,7 +117,7 @@ describe(`configuration`, () => { test(`to "with"`, async () => { const abortController = new AbortController() const graffle = Graffle.create({ schema }).with({ transport: { signal: abortController.signal } }) - const resultPromise = graffle.rawString({ document: `query { id }` }) + const resultPromise = graffle.gql`query { id }`.send() abortController.abort() const { caughtError } = await resultPromise.catch((caughtError: unknown) => ({ caughtError })) as any as { caughtError: Error diff --git a/src/layers/6_client/client.transport-memory.test.ts b/src/layers/6_client/client.transport-memory.test.ts index 810ab7f0..b52a5aa1 100644 --- a/src/layers/6_client/client.transport-memory.test.ts +++ b/src/layers/6_client/client.transport-memory.test.ts @@ -2,23 +2,21 @@ import { expectTypeOf } from 'vitest' import { test } from '../../../tests/_/helpers.js' import { schema } from '../../../tests/_/schemas/kitchen-sink/schema.js' import { Graffle } from '../../entrypoints/main.js' -import { Transport } from '../5_core/types.js' +import { Transport } from '../5_request/types.js' test(`anyware hooks are typed to memory transport`, () => { Graffle.create({ schema }).anyware(async ({ encode }) => { - expectTypeOf(encode.input.transport).toEqualTypeOf(Transport.memory) + expectTypeOf(encode.input.transportType).toEqualTypeOf(Transport.memory) const { pack } = await encode() - expectTypeOf(pack.input.transport).toEqualTypeOf(Transport.memory) + expectTypeOf(pack.input.transportType).toEqualTypeOf(Transport.memory) const { exchange } = await pack() - expectTypeOf(exchange.input.transport).toEqualTypeOf(Transport.memory) - // @ts-expect-error any - exchange.input.request + expectTypeOf(exchange.input.transportType).toEqualTypeOf(Transport.memory) const { unpack } = await exchange() - expectTypeOf(unpack.input.transport).toEqualTypeOf(Transport.memory) + expectTypeOf(unpack.input.transportType).toEqualTypeOf(Transport.memory) // @ts-expect-error any unpack.input.response const { decode } = await unpack() - expectTypeOf(decode.input.transport).toEqualTypeOf(Transport.memory) + expectTypeOf(decode.input.transportType).toEqualTypeOf(Transport.memory) // @ts-expect-error any decode.input.response const result = await decode() diff --git a/src/layers/6_client/client.ts b/src/layers/6_client/client.ts index 03b36746..fa23d48f 100644 --- a/src/layers/6_client/client.ts +++ b/src/layers/6_client/client.ts @@ -1,81 +1,17 @@ -import { type ExecutionResult, GraphQLSchema } from 'graphql' -import type { Errors } from '../../lib/errors/__.js' import type { Fluent } from '../../lib/fluent/__.js' -import { type RootTypeName } from '../../lib/graphql-plus/graphql.js' import { proxyGet } from '../../lib/prelude.js' -import type { BaseInput_ } from '../0_functions/types.js' -import { Schema } from '../1_Schema/__.js' -import { readMaybeThunk } from '../1_Schema/core/helpers.js' -import { Select } from '../2_Select/__.js' import type { SchemaIndex } from '../4_generator/generators/SchemaIndex.js' import type { GlobalRegistry } from '../4_generator/globalRegistry.js' -import { Core } from '../5_core/__.js' -import { type InterfaceRaw, type TransportHttp } from '../5_core/types.js' import { type UseFn, useProperties } from './extension/use.js' -import type { ClientContext, FnParametersProperty, State } from './fluent.js' -import { handleOutput } from './handleOutput.js' +import { type ClientContext, createState, type FnParametersProperty, type StateWithoutConfig } from './fluent.js' +import { type FnGql, gqlProperties } from './gql/gql.js' import { anywareProperties, type FnAnyware } from './properties/anyware.js' import type { FnInternal } from './properties/internal.js' import { type FnRetry, retryProperties } from './properties/retry.js' import { type FnWith, withProperties } from './properties/with.js' -import { createMethodDocument } from './requestMethods/document.js' -import type { FnRequestMethods } from './requestMethods/requestMethods.js' -import { type Config } from './Settings/Config.js' +import { type FnRequestMethods, requestMethodsProperties } from './requestMethods/requestMethods.js' import { type InputStatic } from './Settings/Input.js' -import { type InputToConfig, inputToConfig } from './Settings/InputToConfig.js' - -/** - * Types of "other" Graffle Error. - */ -export type ErrorsOther = - | Errors.ContextualError - // Possible from http transport fetch with abort controller. - | DOMException - -export type GraffleExecutionResultVar<$Config extends Config = Config> = - | ( - & ExecutionResult - & ($Config['transport']['type'] extends TransportHttp ? { - /** - * If transport was HTTP, then the raw response is available here. - */ - response: Response - } - : TransportHttp extends $Config['transport']['type'] ? { - /** - * If transport was HTTP, then the raw response is available here. - */ - response?: Response - } - : {}) - ) - | ErrorsOther - -// todo get type from selectionset module -export type SelectionSetOrIndicator = boolean | object - -// todo get type from selectionset module -export type SelectionSetOrArgs = object - -export interface RequestContext { - config: Config - state: State - schemaIndex: SchemaIndex | null -} - -export interface InterfaceTypedRequestContext extends RequestContext { - schemaIndex: SchemaIndex -} - -type RawParameters = [BaseInput_] - -const resolveRawParameters = (parameters: RawParameters) => { - // return parameters.length === 2 - // ? { document: parameters[0], ...parameters[1] } - // return typeof parameters[0] === `string` || `kind` in parameters[0] - // ? { document: parameters[0], ...parameters[1] } - return parameters[0] -} +import { type InputToConfig } from './Settings/InputToConfig.js' export type Client<$Context extends ClientContext> = Fluent.Materialize< Fluent.AddMany< @@ -87,6 +23,7 @@ export type Client<$Context extends ClientContext> = Fluent.Materialize< FnWith, UseFn, FnAnyware, + FnGql, ] > > @@ -97,7 +34,6 @@ export type IncrementWthNewConfig< > = Fluent.IncrementWthNewContext< $Parameters, { - schemaIndex: $Parameters['state']['context']['schemaIndex'] config: $ConfigNew } > @@ -114,186 +50,50 @@ type Create = <$Input extends InputStatic>(input: $I }> export const create: Create = (input) => { - const initialState = { + const initialState = createState({ extensions: [], retry: null, input, - } + }) return createWithState(initialState) } const createWithState = ( - state: State, + stateWithoutConfig: StateWithoutConfig, ) => { - // todo lazily compute config, not every fluent call uses it. - const context: RequestContext = { - // @ts-expect-error fixme - config: inputToConfig(state.input), - state, - schemaIndex: state.input.schemaIndex ?? null, - } - - /** - * @remarks Without generation the type of returnMode can be `ReturnModeTypeBase` which leads - * TS to think some errors below are invalid checks because of a non-present member. - * However our implementation here needs to be generic and support all return modes - * so we force cast it as such. - */ - // const returnMode = input.returnMode ?? `data` as ReturnModeType - - const executeDocument = async ( - context: InterfaceTypedRequestContext, - document: Select.Document.DocumentNormalized, - operationName?: string, - ) => { - const transport = state.input.schema instanceof GraphQLSchema ? `memory` : `http` - const interface_ = `typed` - const anywareInitialInput = { - interface: interface_, - transport, - schema: state.input.schema, - context, - document, - operationName, - } as Core.Hooks.HookDefEncode['input'] - return await run(context, anywareInitialInput) - } - - const executeRootType = async ( - context: InterfaceTypedRequestContext, - rootTypeName: RootTypeName, - rootTypeSelectionSet: Select.SelectionSet.AnySelectionSet, - ) => { - return executeDocument( - context, - Select.Document.createDocumentNormalizedFromRootTypeSelection( - rootTypeName, - rootTypeSelectionSet, - ), - ) - } - - const executeRootTypeField = async ( - context: InterfaceTypedRequestContext, - rootTypeName: RootTypeName, - rootTypeFieldName: string, - argsOrSelectionSet?: object, - ) => { - const selectedType = readMaybeThunk(context.schemaIndex.Root[rootTypeName]?.fields[rootTypeFieldName]?.type) - const selectedNamedType = readMaybeThunk( - // eslint-disable-next-line - // @ts-ignore excess depth error - Schema.Output.unwrapToNamed(selectedType), - ) as Schema.Output.Named - if (!selectedNamedType) throw new Error(`${rootTypeName} field not found: ${String(rootTypeFieldName)}`) // eslint-disable-line - // @ts-expect-error fixme - const isSelectedTypeScalarOrTypeName = selectedNamedType.kind === `Scalar` || selectedNamedType.kind === `typename` // todo fix type here, its valid - const isFieldHasArgs = Boolean(context.schemaIndex.Root[rootTypeName]?.fields[rootTypeFieldName]?.args) - // We should only need to add __typename for result type fields, but the return handler doesn't yet know how to look beyond a plain object type so we have to add all those cases here. - // todo we could look at the root type fields that have result types and compare to the incoming query for match? - const isHasSchemaErrors = Object.values(context.schemaIndex.error.objects).length > 0 - const needsTypenameAdded = isHasSchemaErrors && context.config.output.errors.schema !== false - && (selectedNamedType.kind === `Object` || selectedNamedType.kind === `Interface` - || selectedNamedType.kind === `Union`) - const rootTypeFieldSelectionSet = isSelectedTypeScalarOrTypeName - ? isFieldHasArgs && argsOrSelectionSet ? { $: argsOrSelectionSet } : true - : needsTypenameAdded - ? { ...argsOrSelectionSet, __typename: true } - : argsOrSelectionSet - - const result = await executeRootType(context, rootTypeName, { - [rootTypeFieldName]: rootTypeFieldSelectionSet, - } as Select.SelectionSet.AnySelectionSet) - if (result instanceof Error) return result - - return context.config.output.envelope.enabled - ? result - // @ts-expect-error - : result[rootTypeFieldName] - } - - const createMethodsRootType = (context: InterfaceTypedRequestContext, rootTypeName: RootTypeName) => { - return new Proxy({}, { - get: (_, key) => { - if (typeof key === `symbol`) throw new Error(`Symbols not supported.`) - - if (key.startsWith(`$batch`)) { - return async (selectionSetOrIndicator: SelectionSetOrIndicator) => - executeRootType(context, rootTypeName, selectionSetOrIndicator as Select.SelectionSet.AnySelectionSet) - } else { - const fieldName = key - return (selectionSetOrArgs: SelectionSetOrArgs) => - executeRootTypeField(context, rootTypeName, fieldName, selectionSetOrArgs) - } - }, - }) - } - - const run = async (context: RequestContext, initialInput: Core.Hooks.HookDefEncode['input']) => { - const result = await Core.anyware.run({ - initialInput, - retryingExtension: context.state.retry as any, - extensions: context.state.extensions.filter(_ => _.onRequest !== undefined).map(_ => _.onRequest!) as any, - }) - return handleOutput(context, result) - } - - const runRaw = async (context: RequestContext, rawInput: BaseInput_) => { - const interface_: InterfaceRaw = `raw` - const transport = state.input.schema instanceof GraphQLSchema ? `memory` : `http` - const initialInput = { - interface: interface_, - transport, - document: rawInput.document, - schema: state.input.schema, - context, - variables: rawInput.variables, - operationName: rawInput.operationName, - } as Core.Hooks.HookDefEncode['input'] - return await run(context, initialInput) - } + const state = createState(stateWithoutConfig) // @ts-expect-error ignoreme const clientDirect: Client = { - _: { - context: { - config: context.config, - }, - }, - raw: async (...args: RawParameters) => { - const input = resolveRawParameters(args) - return await runRaw(context, input) - }, - rawString: async (...args: RawParameters) => { - return await clientDirect.raw(...args) - }, + _: state, + ...gqlProperties(state), ...withProperties(createWithState, state), ...useProperties(createWithState, state), ...anywareProperties(createWithState, state), ...retryProperties(createWithState, state), } - // todo extract this into constructor "create typed client" - if (state.input.schemaIndex) { - const typedContext: InterfaceTypedRequestContext = { - ...context, - schemaIndex: state.input.schemaIndex, - } + // todo, these methods will become available even without a schema index present. + // The schema index nullability will affect more granular features within.. + // So, we are going to need a different check than this one. + if (state.input.schemaIndex) { Object.assign(clientDirect, { - document: createMethodDocument(typedContext, executeDocument), - query: createMethodsRootType(typedContext, `Query`), - mutation: createMethodsRootType(typedContext, `Mutation`), - // todo - // subscription: async () => {}, + ...requestMethodsProperties(state), }) } const clientProxy = proxyGet(clientDirect, ({ path, property }) => { + // eslint-disable-next-line + // @ts-ignore fixme "Type instantiation is excessively deep and possibly infinite" const onGetHandlers = state.extensions.map(_ => _.onBuilderGet).filter(_ => _ !== undefined) for (const onGetHandler of onGetHandlers) { - const result = onGetHandler({ context, client: clientDirect, path, property }) + const result = onGetHandler({ + client: clientDirect, + path, + property, + }) if (result !== undefined) return result } diff --git a/src/layers/6_client/extension/extension.ts b/src/layers/6_client/extension/extension.ts index 79fe24da..fc4209b6 100644 --- a/src/layers/6_client/extension/extension.ts +++ b/src/layers/6_client/extension/extension.ts @@ -2,8 +2,8 @@ import type { Anyware } from '../../../lib/anyware/__.js' import type { FnProperty } from '../../../lib/fluent/Fluent.js' import type { HKT } from '../../../lib/hkt/__.js' import type { Fn } from '../../../lib/hkt/hkt.js' -import type { Core } from '../../5_core/__.js' -import type { Client, RequestContext } from '../client.js' +import type { RequestCore } from '../../5_request/__.js' +import type { Client } from '../client.js' import type { Config } from '../Settings/Config.js' export interface TypeHooks { @@ -23,7 +23,7 @@ interface Base { /** * Anyware executed on every request. */ - onRequest?: Anyware.Extension2 + onRequest?: Anyware.Extension2 /** * Hook into "get" events on the builder proxy. Useful for adding new methods or manipulating existing ones. * @@ -41,7 +41,6 @@ interface Base { */ onBuilderGet?: ( input: { - context: RequestContext path: string[] property: string client: Client<{ schemaIndex: null; config: Config }> diff --git a/src/layers/6_client/fluent.ts b/src/layers/6_client/fluent.ts index f95d1ccd..377d5f29 100644 --- a/src/layers/6_client/fluent.ts +++ b/src/layers/6_client/fluent.ts @@ -1,15 +1,14 @@ import type { Anyware } from '../../lib/anyware/__.js' import type { Fluent } from '../../lib/fluent/__.js' -import type { SchemaIndex } from '../4_generator/generators/SchemaIndex.js' import type { GlobalRegistry } from '../4_generator/globalRegistry.js' -import type { Core } from '../5_core/__.js' +import type { RequestCore } from '../5_request/__.js' import type { Extension } from './extension/extension.js' import type { Config } from './Settings/Config.js' import type { InputStatic } from './Settings/Input.js' +import { inputToConfig } from './Settings/InputToConfig.js' export type ClientContext = { config: Config - schemaIndex: SchemaIndex | null } export type FnClient<$Context extends ClientContext = ClientContext> = Fluent.Create<$Context> @@ -40,14 +39,31 @@ export const defineProperties = ( // } // } -// export const createTerminus = (property: (state: CreateState) => unknown) => { -// return (state: CreateState) => { -// return property(state) -// } -// } +type TerminusDefinitions = Record + +export const defineTerminus = (property: (state: State) => TerminusDefinitions) => { + return (state: State) => { + return property(state) + } +} export interface State { input: InputStatic - retry: Anyware.Extension2 | null + config: Config + retry: Anyware.Extension2 | null extensions: Extension[] } + +export const createState = (stateWithoutConfig: StateWithoutConfig): State => { + let config: Config | null + + return { + ...stateWithoutConfig, + get config(): Config { + const configFound = config ?? inputToConfig(stateWithoutConfig.input) + return configFound as any + }, + } +} + +export type StateWithoutConfig = Omit diff --git a/src/layers/6_client/gql/gql.test-d.ts b/src/layers/6_client/gql/gql.test-d.ts new file mode 100644 index 00000000..3dd0a94e --- /dev/null +++ b/src/layers/6_client/gql/gql.test-d.ts @@ -0,0 +1,72 @@ +import { kitchenSink as g } from '../../../../tests/_/helpers.js' +import { AssertTypeOf } from '../../../lib/assert-equal.js' +import type { TypedDocument } from '../../../lib/typed-document/__.js' + +type D = { id: 0 } + +const d1 = 0 as any as TypedDocument.Node<{ id: 0 }, {}> + +AssertTypeOf(await g.gql(d1).send()) +// @ts-expect-error - variables not allowed. +await g.gql(d1).send({}) + +// +// +// + +const d2 = 0 as any as TypedDocument.Node<{ id: 0 }, { x?: 0 }> + +AssertTypeOf(await g.gql(d2).send()) +AssertTypeOf(await g.gql(d2).send({})) +AssertTypeOf(await g.gql(d2).send({ x: 0 })) +AssertTypeOf(await g.gql(d2).send({ x: 0 })) +// @ts-expect-error - wrong type +await g.gql(d2).send({ filter: `wrong type` }) + +// +// +// + +const d3 = 0 as any as TypedDocument.Node<{ id: 0 }, { x: 0 }> + +AssertTypeOf(await g.gql(d3).send({ x: 0 })) +// @ts-expect-error - missing argument +AssertTypeOf(await g.gql(d3).send({})) + +// +// +// + +// dprint-ignore +{ + AssertTypeOf(await g.gql >``.send({ x: 1 })) + AssertTypeOf(await g.gql >``.send()) + AssertTypeOf(await g.gql >``.send({ x: 1 })) + AssertTypeOf(await g.gql >``.send()) + AssertTypeOf(await g.gql>``.send()) + AssertTypeOf(await g.gql>``.send({ x: 1 })) + AssertTypeOf(await g.gql>``.send(`abc`, { x: 1 })) + // @ts-expect-error - wrong argument type + await g.gql >``.send({ x: 2 }) + + AssertTypeOf(await g.gql >``.send({ x: 1 })) + AssertTypeOf(await g.gql >``.send()) + AssertTypeOf(await g.gql >``.send({ x: 1 })) + AssertTypeOf(await g.gql >``.send()) + AssertTypeOf(await g.gql>``.send()) // eslint-disable-line + AssertTypeOf(await g.gql>``.send({ x: 1 })) // eslint-disable-line + AssertTypeOf(await g.gql>``.send(`abc`, { x: 1 })) // eslint-disable-line + // @ts-expect-error - wrong argument type + await g.gql >``.send({ x: 2 }) + + AssertTypeOf(await g.gql >``.send({ x: 1 })) + AssertTypeOf(await g.gql >``.send()) + AssertTypeOf(await g.gql >``.send({ x: 1 })) + AssertTypeOf(await g.gql >``.send()) + AssertTypeOf(await g.gql>``.send()) // eslint-disable-line + AssertTypeOf(await g.gql>``.send({ x: 1 })) // eslint-disable-line + AssertTypeOf(await g.gql>``.send(`abc`, { x: 1 })) // eslint-disable-line + // @ts-expect-error - wrong argument type + await g.gql >``.send({ x: 2 }) + +} diff --git a/src/layers/6_client/gql/gql.test.ts b/src/layers/6_client/gql/gql.test.ts new file mode 100644 index 00000000..d3bb4aac --- /dev/null +++ b/src/layers/6_client/gql/gql.test.ts @@ -0,0 +1,18 @@ +import { describe, expect } from 'vitest' +import { test } from '../../../../tests/_/helpers.js' +import { Spy } from '../../../../tests/_/SpyExtension.js' + +// todo test with custom scalars + +describe(`memory transport`, () => { + describe(`operationName`, () => { + test(`undefined by default`, async ({ kitchenSink }) => { + await kitchenSink.use(Spy()).gql`query { id }`.send() + expect(Spy.input).toMatchObject({ request: { operationName: undefined } }) + }) + test(`reflects explicit value`, async ({ kitchenSink }) => { + await kitchenSink.use(Spy()).gql`query foo { id }`.send(`foo`) + expect(Spy.input).toMatchObject({ request: { operationName: `foo` } }) + }) + }) +}) diff --git a/src/layers/6_client/gql/gql.ts b/src/layers/6_client/gql/gql.ts new file mode 100644 index 00000000..fd90feef --- /dev/null +++ b/src/layers/6_client/gql/gql.ts @@ -0,0 +1,83 @@ +import type { Fluent } from '../../../lib/fluent/__.js' +import type { TypedDocument } from '../../../lib/typed-document/__.js' +import { RequestCore } from '../../5_request/__.js' +import type { InterfaceRaw } from '../../5_request/types.js' +import { defineTerminus } from '../fluent.js' +import { handleOutput } from '../handleOutput.js' +import type { Config } from '../Settings/Config.js' +import { type DocumentController, resolveSendArguments, type sendArgumentsImplementation } from './send.js' + +// dprint-ignore +export interface gql<$Config extends Config = Config> { + <$Document extends TypedDocument.TypedDocument>(document: $Document): DocumentController<$Config, $Document> + <$Document extends TypedDocument.TypedDocument>(parts: TemplateStringsArray, ...args: unknown[]): DocumentController<$Config, $Document> +} + +type TemplateStringsArguments = [TemplateStringsArray, ...unknown[]] + +type gqlArguments = [TypedDocument.TypedDocument] | TemplateStringsArguments + +const resolveGqlArguments = (args: gqlArguments) => { + const document = isTemplateStringArguments(args) ? joinTemplateStringArrayAndArgs(args) : args[0] + return { + document, + } +} + +export interface FnGql extends Fluent.FnProperty<'gql'> { + // @ts-expect-error untyped params + return: gql +} + +export const gqlProperties = defineTerminus((state) => { + return { + gql: (...args: gqlArguments) => { + const { document } = resolveGqlArguments(args) + + return { + send: async (...args: sendArgumentsImplementation) => { + const { operationName, variables } = resolveSendArguments(args) + const interfaceType: InterfaceRaw = `raw` + const transportType = state.config.transport.type + const url = state.config.transport.type === `http` ? state.config.transport.url : undefined + const schema = state.config.transport.type === `http` ? undefined : state.config.transport.schema + const initialInput = { + interfaceType, + transportType, + state, + url, + schema, + schemaIndex: state.config.schemaIndex, + request: { + query: document, + variables, + operationName, + }, + } as RequestCore.Hooks.HookDefEncode['input'] + const result = await RequestCore.anyware.run({ + initialInput, + retryingExtension: state.retry as any, + extensions: state.extensions.filter(_ => _.onRequest !== undefined).map(_ => _.onRequest!) as any, + }) + return handleOutput(state, result) + }, + } as any + }, + } +}) + +const isTemplateStringArguments = (args: [...unknown[]]): args is TemplateStringsArguments => { + return isTemplateStringArray(args[0]) +} + +const isTemplateStringArray = (arg: any): arg is TemplateStringsArray => { + return Array.isArray(arg) && `raw` in arg && arg.raw !== undefined +} + +const joinTemplateStringArrayAndArgs = (args: TemplateStringsArguments): string => { + const [templateParts, ...templateArgs] = args + return templateParts.reduce( + (string, part, index) => `${string}${part}${index in templateArgs ? String(templateArgs[index]) : ``}`, + ``, + ) +} diff --git a/src/layers/6_client/gql/send.test-d.ts b/src/layers/6_client/gql/send.test-d.ts new file mode 100644 index 00000000..225ae710 --- /dev/null +++ b/src/layers/6_client/gql/send.test-d.ts @@ -0,0 +1,20 @@ +import { AssertEqual } from '../../../lib/assert-equal.js' +import type { TypedDocument } from '../../../lib/typed-document/__.js' +import type { SendArguments } from './send.js' + +AssertEqual< + SendArguments>, + [string, { x: 1 }] | [{ x: 1 }] +>() +AssertEqual< + SendArguments>, + [x?: string] | [x?: string, x?: { x?: 1 }] | [x?: { x?: 1 }] +>() +AssertEqual< + SendArguments>, + [x?: string] +>() +AssertEqual< + SendArguments>, + [x?: string] | [x?: string, x?: TypedDocument.Variables] | [x?: TypedDocument.Variables] +>() diff --git a/src/layers/6_client/gql/send.ts b/src/layers/6_client/gql/send.ts new file mode 100644 index 00000000..6bb4c79c --- /dev/null +++ b/src/layers/6_client/gql/send.ts @@ -0,0 +1,35 @@ +import { isString } from '../../../lib/prelude.js' +import type { TypedDocument } from '../../../lib/typed-document/__.js' +import type { RawResolveOutputReturnRootType } from '../handleOutput.js' +import type { Config } from '../Settings/Config.js' + +// dprint-ignore +export type SendArguments<$TypedDocument extends TypedDocument.TypedDocument> = + SendArguments_> + +// dprint-ignore +type SendArguments_<$Variables extends TypedDocument.Variables> = + SendArguments__<$Variables, TypedDocument.GetVariablesInputKind<$Variables>> + +// dprint-ignore +type SendArguments__<$Variables extends TypedDocument.Variables, $VariablesKind extends TypedDocument.VariablesInputKind> = + $VariablesKind extends 'none' ? ([operationName?: string]) : + $VariablesKind extends 'optional' ? ([operationName?: string] | [operationName?: string, variables?: $Variables] | [variables?: $Variables]) : + $VariablesKind extends 'required' ? ([operationName: string, variables: $Variables] | [variables: $Variables]) : + never + +// dprint-ignore +export interface DocumentController<$Config extends Config, $TypedDocument extends TypedDocument.TypedDocument> { + send(...args: SendArguments<$TypedDocument>): Promise>> +} + +export type sendArgumentsImplementation = [] | [string] | [TypedDocument.Variables] | [string, TypedDocument.Variables] + +export const resolveSendArguments = (args: sendArgumentsImplementation) => { + const operationName = isString(args[0]) ? args[0] : undefined + const variables = isString(args[0]) ? args[1] : args[0] + return { + operationName, + variables, + } +} diff --git a/src/layers/6_client/handleOutput.ts b/src/layers/6_client/handleOutput.ts index 67383d97..0ada8524 100644 --- a/src/layers/6_client/handleOutput.ts +++ b/src/layers/6_client/handleOutput.ts @@ -1,10 +1,11 @@ -import type { GraphQLError } from 'graphql' +import type { ExecutionResult, GraphQLError } from 'graphql' import type { Simplify } from 'type-fest' import { Errors } from '../../lib/errors/__.js' import type { GraphQLExecutionResultError } from '../../lib/graphql-plus/graphql.js' import { isRecordLikeObject, type SimplifyExceptError, type Values } from '../../lib/prelude.js' import type { SchemaIndex } from '../4_generator/generators/SchemaIndex.js' -import type { ErrorsOther, GraffleExecutionResultVar, InterfaceTypedRequestContext, RequestContext } from './client.js' +import type { TransportHttp } from '../5_request/types.js' +import type { State } from './fluent.js' import { type Config, type ErrorCategory, @@ -13,34 +14,63 @@ import { readConfigErrorCategoryOutputChannel, } from './Settings/Config.js' +/** + * Types of "other" Graffle Error. + */ +export type ErrorsOther = + | Errors.ContextualError + // Possible from http transport fetch with abort controller. + | DOMException + +export type GraffleExecutionResultVar<$Config extends Config = Config> = + | ( + & ExecutionResult + & ($Config['transport']['type'] extends TransportHttp ? { + /** + * If transport was HTTP, then the raw response is available here. + */ + response: Response + } + : TransportHttp extends $Config['transport']['type'] ? { + /** + * If transport was HTTP, then the raw response is available here. + */ + response?: Response + } + : {}) + ) + | ErrorsOther + export const handleOutput = ( - context: RequestContext, + state: State, + // context: RequestContext, result: GraffleExecutionResultVar, ) => { - if (isContextConfigTraditionalGraphQLOutput(context.config)) { + if (isContextConfigTraditionalGraphQLOutput(state.config)) { if (result instanceof Error) throw result return result } - const c = context.config.output + const config = state.config + const c = config.output const isEnvelope = c.envelope.enabled - const isThrowOther = readConfigErrorCategoryOutputChannel(context.config, `other`) === `throw` + const isThrowOther = readConfigErrorCategoryOutputChannel(config, `other`) === `throw` && (!c.envelope.enabled || !c.envelope.errors.other) - const isReturnOther = readConfigErrorCategoryOutputChannel(context.config, `other`) === `return` + const isReturnOther = readConfigErrorCategoryOutputChannel(config, `other`) === `return` && (!c.envelope.enabled || !c.envelope.errors.other) - const isThrowExecution = readConfigErrorCategoryOutputChannel(context.config, `execution`) === `throw` + const isThrowExecution = readConfigErrorCategoryOutputChannel(config, `execution`) === `throw` && (!c.envelope.enabled || !c.envelope.errors.execution) - const isReturnExecution = readConfigErrorCategoryOutputChannel(context.config, `execution`) === `return` + const isReturnExecution = readConfigErrorCategoryOutputChannel(config, `execution`) === `return` && (!c.envelope.enabled || !c.envelope.errors.execution) - const isThrowSchema = readConfigErrorCategoryOutputChannel(context.config, `schema`) === `throw` + const isThrowSchema = readConfigErrorCategoryOutputChannel(config, `schema`) === `throw` - const isReturnSchema = readConfigErrorCategoryOutputChannel(context.config, `schema`) === `return` + const isReturnSchema = readConfigErrorCategoryOutputChannel(config, `schema`) === `return` if (result instanceof Error) { if (isThrowOther) throw result @@ -60,7 +90,7 @@ export const handleOutput = ( return isEnvelope ? { ...result, errors: [...result.errors ?? [], error] } : error } - if (isTypedContext(context)) { + if (state.input.schemaIndex) { if (c.errors.schema !== false) { if (!isRecordLikeObject(result.data)) throw new Error(`Expected data to be an object.`) const schemaErrors = Object.entries(result.data).map(([rootFieldName, rootFieldValue]) => { @@ -79,7 +109,7 @@ export const handleOutput = ( } const isErrorObject = Boolean( - context.schemaIndex.error.objectsTypename[__typename], + state.input.schemaIndex?.error.objectsTypename[__typename], ) if (!isErrorObject) return null // todo extract message @@ -112,8 +142,6 @@ export const handleOutput = ( return result.data } -const isTypedContext = (context: RequestContext): context is InterfaceTypedRequestContext => `schemaIndex` in context - /** * Types for output handling. */ diff --git a/src/layers/6_client/prefilled.ts b/src/layers/6_client/prefilled.ts index fceba1bb..bab7a110 100644 --- a/src/layers/6_client/prefilled.ts +++ b/src/layers/6_client/prefilled.ts @@ -41,7 +41,7 @@ export type CreatePrefilled = // @ts-ignore passes after generation Client<{ // @ts-expect-error fixme - TS cannot figure out that name input meets constraint - config: InputToConfig<$Input & { name: $Name }>, + config: InputToConfig<$Input & { name: $Name; schemaIndex: GlobalRegistry.GetSchemaIndexOrDefault<$Name> }>, schemaIndex: GlobalRegistry.GetSchemaIndexOrDefault<$Name> }> diff --git a/src/layers/6_client/properties/anyware.ts b/src/layers/6_client/properties/anyware.ts index 10c117b4..c482da22 100644 --- a/src/layers/6_client/properties/anyware.ts +++ b/src/layers/6_client/properties/anyware.ts @@ -1,6 +1,6 @@ import type { Anyware, Anyware as AnywareLib } from '../../../lib/anyware/__.js' import type { Fluent } from '../../../lib/fluent/__.js' -import type { Core } from '../../5_core/__.js' +import type { RequestCore } from '../../5_request/__.js' import { createExtension } from '../extension/extension.js' import { defineProperties, type FnParametersProperty } from '../fluent.js' @@ -14,13 +14,13 @@ export interface Anyware<$Args extends FnParametersProperty> { * TODO Anyware Docs. */ ( - anyware: AnywareLib.Extension2>, + anyware: AnywareLib.Extension2>, ): Fluent.IncrementNothing<$Args> } export const anywareProperties = defineProperties((builder, state) => { return { - anyware: (anyware: Anyware.Extension2) => { + anyware: (anyware: Anyware.Extension2) => { return builder({ ...state, extensions: [...state.extensions, createExtension({ name: `InlineAnyware`, onRequest: anyware })], diff --git a/src/layers/6_client/properties/internal.ts b/src/layers/6_client/properties/internal.ts index 612abac7..128a01f5 100644 --- a/src/layers/6_client/properties/internal.ts +++ b/src/layers/6_client/properties/internal.ts @@ -10,9 +10,7 @@ export type Internal<$Args extends FnParametersMerge> = { /** * TODO */ - _: { - context: $Args - } + _: $Args } // todo once context is on state diff --git a/src/layers/6_client/properties/retry.ts b/src/layers/6_client/properties/retry.ts index 5b22a723..b8330eec 100644 --- a/src/layers/6_client/properties/retry.ts +++ b/src/layers/6_client/properties/retry.ts @@ -1,6 +1,6 @@ import type { Anyware } from '../../../lib/anyware/__.js' import type { Fluent } from '../../../lib/fluent/__.js' -import type { Core } from '../../5_core/__.js' +import type { RequestCore } from '../../5_request/__.js' import { defineProperties, type FnParametersProperty } from '../fluent.js' export interface FnRetry extends Fluent.FnProperty<`retry`> { @@ -12,12 +12,12 @@ export interface Retry<$Args extends FnParametersProperty> { /** * TODO Retry Docs. */ - (extension: Anyware.Extension2): Fluent.IncrementNothing<$Args> + (extension: Anyware.Extension2): Fluent.IncrementNothing<$Args> } export const retryProperties = defineProperties((builder, state) => { return { - retry: (anyware: Anyware.Extension2) => { + retry: (anyware: Anyware.Extension2) => { return builder({ ...state, retry: anyware }) }, } diff --git a/src/layers/6_client/raw/client.raw.test-d.ts b/src/layers/6_client/raw/client.raw.test-d.ts deleted file mode 100644 index 69883c94..00000000 --- a/src/layers/6_client/raw/client.raw.test-d.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { describe, expectTypeOf } from 'vitest' -import { test } from '../../../../tests/_/helpers.js' -import { gql } from '../../6_helpers/gql.js' - -describe(`TypedQueryDocumentNode`, () => { - describe(`data`, () => { - const document = gql<{ id: string }, {}>`query { id }` - test(`envelope data is typed`, async ({ kitchenSink: g }) => { - expectTypeOf(await g.raw({ document })).toEqualTypeOf() - }) - test(`variables are not allowed to be passed in`, async ({ kitchenSink: g }) => { - // @ts-expect-error - variables not allowed. - await g.raw({ document: document, variables: {} }) - }) - }) - - describe(`data + optional variables`, () => { - const document = gql<{ id: string }, { filter?: boolean }>`query { id }` - test(`envelope data is typed`, ({ kitchenSink: g }) => { - expectTypeOf(g.raw({ document })).resolves.toEqualTypeOf<{ id: string } | null>() - }) - test(`variables are typed and allowed to be passed in or omitted`, async ({ kitchenSink: g }) => { - // Expect no type errors below - await g.raw({ document }) - await g.raw({ document, variables: {} }) - await g.raw({ document, variables: { filter: true } }) - await g.raw({ document, variables: { filter: false } }) - // @ts-expect-error - wrong type - await g.raw({ document, variables: { filter: `wrong type` } }) - }) - }) - - describe(`data + 1+ variables required`, () => { - const document = gql<{ id: string }, { filter: boolean }>`query { id }` - test(`valid variables can be given`, async ({ kitchenSink: g }) => { - await g.raw({ document, variables: { filter: true } }) - }) - test(`variables property cannot be omitted`, async ({ kitchenSink: g }) => { - // @ts-expect-error - variables missing - await g.raw({ document }) - // @ts-expect-error - variables filter property missing - await g.raw({ document, variables: {} }) - }) - test(`given variables must be valid types`, async ({ kitchenSink: g }) => { - // @ts-expect-error - wrong type - await g.raw({ document, variables: { filter: `wrong type` } }) - }) - }) -}) diff --git a/src/layers/6_client/raw/client.raw.test.ts b/src/layers/6_client/raw/client.raw.test.ts deleted file mode 100644 index 642a0e54..00000000 --- a/src/layers/6_client/raw/client.raw.test.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { beforeEach, describe, expect } from 'vitest' -import { test } from '../../../../tests/_/helpers.js' -import { Graffle } from '../../../../tests/_/schemas/kitchen-sink/graffle/__.js' -import { schema } from '../../../../tests/_/schemas/kitchen-sink/schema.js' -import { createExtension } from '../extension/extension.js' - -// todo test with custom scalars - -const graffle = Graffle.create({ schema }) - -describe(`memory transport`, () => { - let input: object | undefined - const spyExchangeInput = createExtension({ - name: `spy`, - onRequest: ({ exchange }) => { - if (exchange.input.transport === `memory`) { - input = exchange.input - } - return exchange() - }, - }) - beforeEach(() => { - input = undefined - }) - describe(`operationName`, () => { - test(`undefined by default`, async () => { - await graffle.use(spyExchangeInput).rawString({ document: `query { id }` }) - expect(input).toMatchObject({ operationName: undefined }) - }) - test(`reflects explicit value`, async () => { - await graffle.use(spyExchangeInput).rawString({ document: `query foo { id }`, operationName: `foo` }) - expect(input).toMatchObject({ operationName: `foo` }) - }) - }) -}) diff --git a/src/layers/6_client/raw/client.rawString.test-d.ts b/src/layers/6_client/raw/client.rawString.test-d.ts deleted file mode 100644 index 3c41d30c..00000000 --- a/src/layers/6_client/raw/client.rawString.test-d.ts +++ /dev/null @@ -1,71 +0,0 @@ -/* eslint-disable */ -import { describe, expectTypeOf } from 'vitest' -import { test } from '../../../../tests/_/helpers.js' -import { Graffle } from '../../../../tests/_/schemas/kitchen-sink/graffle/__.js' -import { schema } from '../../../../tests/_/schemas/kitchen-sink/schema.js' -import type { TypedDocumentString } from '../../0_functions/types.js' -import type { Envelope, RawResolveOutputReturnRootType } from '../handleOutput.js' - -const g = Graffle.create({ schema }) - -describe(`TypedDocumentString with just data (no variables)`, () => { - const document = ` - query { - id - } - ` as TypedDocumentString<{ id: string }, {}> - - test(`envelope data is typed`, () => { - expectTypeOf(g.rawString({ document })).resolves.toEqualTypeOf< - RawResolveOutputReturnRootType - >() - }) - test('variables are not allowed to be passed in', () => { - // @ts-expect-error - variables not allowed. - g.rawString({ document: document, variables: {} }) - }) -}) - -describe(`TypedQueryDocumentNode with data and optional variables`, () => { - const document = ` - query { - id - } - ` as TypedDocumentString<{ id: string }, { filter?: boolean }> - - // dprint-ignore - test(`envelope data is typed`, () => { - expectTypeOf(g.rawString({ document })).resolves.toEqualTypeOf>() - }) - test('variables are typed and allowed to be passed in or omitted', () => { - // Expect no type errors below - g.rawString({ document }) - g.rawString({ document, variables: {} }) - g.rawString({ document, variables: { filter: true } }) - g.rawString({ document, variables: { filter: false } }) - // @ts-expect-error - wrong type - g.rawString({ document, variables: { filter: 'wrong type' } }) - }) -}) - -describe(`TypedQueryDocumentNode with data and one or more required variables`, () => { - const document = ` - query { - id - } - ` as TypedDocumentString<{ id: string }, { filter: boolean }> - - test('valid variables can be given', () => { - g.rawString({ document, variables: { filter: true } }) - }) - test('variables property cannot be omitted', () => { - // @ts-expect-error - variables missing - g.rawString({ document }) - // @ts-expect-error - variables filter property missing - g.rawString({ document, variables: {} }) - }) - test('given variables must be valid types', () => { - // @ts-expect-error - wrong type - g.rawString({ document, variables: { filter: 'wrong type' } }) - }) -}) diff --git a/src/layers/6_client/raw/methods.ts b/src/layers/6_client/raw/methods.ts deleted file mode 100644 index ea367ea5..00000000 --- a/src/layers/6_client/raw/methods.ts +++ /dev/null @@ -1,13 +0,0 @@ -import type { TypedQueryDocumentNode } from 'graphql' -import type { SimplifyExceptError } from '../../../lib/prelude.js' -import type { BaseInput, TypedDocumentString } from '../../0_functions/types.js' -import type { RawResolveOutputReturnRootType } from '../handleOutput.js' -import type { Config } from '../Settings/Config.js' - -// dprint-ignore -export type BuilderRequestMethodsStatic<$Config extends Config> = { - raw: <$Data extends Record, $Variables>(input: BaseInput>) => - Promise>> - rawString: <$Data extends Record, $Variables>(input: BaseInput>) => - Promise> -} diff --git a/src/layers/6_client/requestMethods/document.ts b/src/layers/6_client/requestMethods/document.ts index 5dc39bb4..a2fbfd14 100644 --- a/src/layers/6_client/requestMethods/document.ts +++ b/src/layers/6_client/requestMethods/document.ts @@ -1,10 +1,9 @@ import type { UnionToTuple } from 'type-fest' import type { IsTupleMultiple } from '../../../lib/prelude.js' -import { Select } from '../../2_Select/__.js' +import type { Select } from '../../2_Select/__.js' import type { ResultSet } from '../../3_Result/__.js' import type { SchemaIndex } from '../../4_generator/generators/SchemaIndex.js' -import type { InterfaceTypedRequestContext } from '../client.js' -import type { ResolveOutputReturnRootType } from '../handleOutput.js' +import { type ResolveOutputReturnRootType } from '../handleOutput.js' import type { AddTypenameToSelectedRootTypeResultFields, Config } from '../Settings/Config.js' // dprint-ignore @@ -64,13 +63,3 @@ export type DocumentRunner< // : keyof { [K in keyof $Document & string as Schema.Named.NameParse extends never ? K : never]: K } extends never // ? $Document // : TSError<'ValidateDocumentOperationNames', `One or more Invalid operation name in document: ${keyof { [K in keyof $Document & string as Schema.Named.NameParse extends never ? K : never]: K }}`> - -export const createMethodDocument = - (context: InterfaceTypedRequestContext, executeDocument: any) => (document: Select.Document.DocumentObject) => { - const documentNormalized = Select.Document.normalizeOrThrow(document) - return { - run: async (maybeOperationName?: string) => { - return await executeDocument(context, documentNormalized, maybeOperationName) - }, - } - } diff --git a/src/layers/6_client/requestMethods/requestMethods.ts b/src/layers/6_client/requestMethods/requestMethods.ts index faad0c44..2063d160 100644 --- a/src/layers/6_client/requestMethods/requestMethods.ts +++ b/src/layers/6_client/requestMethods/requestMethods.ts @@ -1,8 +1,14 @@ import type { HKT } from '../../../entrypoints/utilities-for-generated.js' import type { Fluent } from '../../../lib/fluent/__.js' +import type { RootTypeName, Variables } from '../../../lib/graphql-plus/graphql.js' +import { readMaybeThunk } from '../../1_Schema/_.js' +import { Schema } from '../../1_Schema/__.js' +import { Select } from '../../2_Select/__.js' import type { GlobalRegistry } from '../../4_generator/globalRegistry.js' -import type { ClientContext } from '../fluent.js' -import type { BuilderRequestMethodsStatic } from '../raw/methods.js' +import { RequestCore } from '../../5_request/__.js' +import { type ClientContext, defineTerminus, type State } from '../fluent.js' +import { handleOutput } from '../handleOutput.js' +import type { Config } from '../Settings/Config.js' export interface FnRequestMethods extends Fluent.FnMerge { // @ts-expect-error untyped params @@ -11,9 +17,8 @@ export interface FnRequestMethods extends Fluent.FnMerge { // dprint-ignore export type BuilderRequestMethods<$Context extends ClientContext>= - & BuilderRequestMethodsStatic<$Context['config']> & ( - $Context['schemaIndex'] extends null + $Context['config']['schemaIndex'] extends null ? {} : ( @@ -27,3 +32,131 @@ export type BuilderRequestMethods<$Context extends ClientContext>= } ) ) + +export const requestMethodsProperties = defineTerminus((state) => { + return { + document: createMethodDocument(state), + query: createMethodRootType(state, `Query`), + mutation: createMethodRootType(state, `Mutation`), + // todo + // subscription: async () => {}, + } +}) + +export const createMethodDocument = (state: State) => (document: Select.Document.DocumentObject) => { + const documentNormalized = Select.Document.normalizeOrThrow(document) + return { + run: async (maybeOperationName?: string) => { + return await executeDocument(state, documentNormalized, maybeOperationName) + }, + } +} + +const createMethodRootType = (state: State, rootTypeName: RootTypeName) => { + return new Proxy({}, { + get: (_, key) => { + if (typeof key === `symbol`) throw new Error(`Symbols not supported.`) + + if (key.startsWith(`$batch`)) { + return async (selectionSetOrIndicator: Select.SelectionSet.FieldValue) => + executeRootType(state, rootTypeName, selectionSetOrIndicator as Select.SelectionSet.AnySelectionSet) + } else { + const fieldName = key + return (selectionSetOrArgs: Select.SelectionSet.AnySelectionSet | Select.Arguments.ArgsObject) => + executeRootTypeField(state, rootTypeName, fieldName, selectionSetOrArgs) + } + }, + }) +} + +const executeRootTypeField = async ( + state: State, + rootTypeName: RootTypeName, + rootTypeFieldName: string, + argsOrSelectionSet?: Select.SelectionSet.AnySelectionSet | Select.Arguments.ArgsObject, +) => { + if (!state.input.schemaIndex) throw new Error(`Schema not loaded`) + + const selectedType = readMaybeThunk(state.input.schemaIndex.Root[rootTypeName]?.fields[rootTypeFieldName]?.type) + const selectedNamedType = readMaybeThunk( + // eslint-disable-next-line + // @ts-ignore excess depth error + Schema.Output.unwrapToNamed(selectedType), + ) as Schema.Output.Named + // eslint-disable-next-line + if (!selectedNamedType) throw new Error(`${rootTypeName} field not found: ${String(rootTypeFieldName)}`) + // @ts-expect-error fixme + const isSelectedTypeScalarOrTypeName = selectedNamedType.kind === `Scalar` || selectedNamedType.kind === `typename` // todo fix type here, its valid + const isFieldHasArgs = Boolean(state.input.schemaIndex.Root[rootTypeName]?.fields[rootTypeFieldName]?.args) + // We should only need to add __typename for result type fields, but the return handler doesn't yet know how to look beyond a plain object type so we have to add all those cases here. + // todo we could look at the root type fields that have result types and compare to the incoming query for match? + const isHasSchemaErrors = Object.values(state.input.schemaIndex.error.objects).length > 0 + const needsTypenameAdded = isHasSchemaErrors && state.config.output.errors.schema !== false + && (selectedNamedType.kind === `Object` || selectedNamedType.kind === `Interface` + || selectedNamedType.kind === `Union`) + const rootTypeFieldSelectionSet = isSelectedTypeScalarOrTypeName + ? isFieldHasArgs && argsOrSelectionSet ? { $: argsOrSelectionSet } : true + : needsTypenameAdded + ? { ...argsOrSelectionSet, __typename: true } + : argsOrSelectionSet + + const result = await executeRootType(state, rootTypeName, { + [rootTypeFieldName]: rootTypeFieldSelectionSet, + } as Select.SelectionSet.AnySelectionSet) + if (result instanceof Error) return result + + return state.config.output.envelope.enabled + ? result + // @ts-expect-error + : result[rootTypeFieldName] +} + +const executeRootType = async ( + state: State, + rootTypeName: RootTypeName, + rootTypeSelectionSet: Select.SelectionSet.AnySelectionSet, +) => { + return executeDocument( + state, + Select.Document.createDocumentNormalizedFromRootTypeSelection( + rootTypeName, + rootTypeSelectionSet, + ), + ) +} + +export const executeDocument = async ( + state: State, + document: Select.Document.DocumentNormalized, + operationName?: string, + variables?: Variables, +) => { + const transportType = state.config.transport.type + const interfaceType = `typed` + const url = state.config.transport.type === `http` ? state.config.transport.url : undefined + const schema = state.config.transport.type === `http` ? undefined : state.config.transport.schema + const initialInput = { + document, + operationName, + // todo, remove the above + state, + interfaceType, + transportType, + url, + schema, + schemaIndex: state.config.schemaIndex, + request: { + document, + operationName, + variables, + }, + } as RequestCore.Hooks.HookDefEncode['input'] + + const result = await RequestCore.anyware.run({ + initialInput, + retryingExtension: state.retry as any, + extensions: state.extensions.filter(_ => _.onRequest !== undefined).map(_ => _.onRequest!) as any, + }) + + return handleOutput(state, result) +} diff --git a/src/layers/6_client/transportHttp/request.ts b/src/layers/6_client/transportHttp/request.ts index cffca80d..db7b9a4e 100644 --- a/src/layers/6_client/transportHttp/request.ts +++ b/src/layers/6_client/transportHttp/request.ts @@ -1,5 +1,3 @@ -import type { httpMethodGet, httpMethodPost } from '../../../lib/http.js' - export const MethodMode = { post: `post`, getReads: `getReads`, @@ -29,20 +27,4 @@ export type TransportHttpInput = { raw?: RequestInit } -/** - * An extension of {@link RequestInit} that adds a required `url` property and makes `body` required. - */ -export type CoreExchangePostRequest = Omit & { - methodMode: MethodModePost | MethodModeGetReads - method: httpMethodPost - url: string | URL // todo URL for config and string only for input. Requires anyware to allow different types for input and existing config. - body: BodyInit -} - -export type CoreExchangeGetRequest = Omit & { - methodMode: MethodModeGetReads - method: httpMethodGet - url: string | URL -} - export const defaultMethodMode: MethodMode = `post` diff --git a/src/layers/6_helpers/gql.ts b/src/layers/6_helpers/gql.ts deleted file mode 100644 index ba4f6e30..00000000 --- a/src/layers/6_helpers/gql.ts +++ /dev/null @@ -1,28 +0,0 @@ -import type { TypedQueryDocumentNode } from 'graphql' -import { parse } from 'graphql' -import type { SomeData } from '../../lib/graphql-plus/graphql.js' - -/** - * Returns the string with any variables given interpolated and then parsed into a DocumentNode. - * - * @example - * ``` - * import { gql } from 'graffle' - * - * await request('https://foo.bar/graphql', gql`...`) - * ``` - * - * @remarks - * - * Several tools in the Node GraphQL ecosystem are hardcoded to specially treat any template tag named "gql". For example see this prettier issue: https://github.com/prettier/prettier/issues/4360. Using this template tag has no runtime effect beyond variable interpolation. - */ -export const gql = <$Data extends SomeData, $Variables>( - chunks: TemplateStringsArray, - ...variables: unknown[] -): TypedQueryDocumentNode<$Data, $Variables> => { - const string = chunks.reduce( - (acc, chunk, index) => `${acc}${chunk}${index in variables ? String(variables[index]) : ``}`, - ``, - ) - return parse(string) as any -} diff --git a/src/layers/7_extensions/Opentelemetry/Opentelemetry.ts b/src/layers/7_extensions/Opentelemetry/Opentelemetry.ts index d58ea97e..05434634 100644 --- a/src/layers/7_extensions/Opentelemetry/Opentelemetry.ts +++ b/src/layers/7_extensions/Opentelemetry/Opentelemetry.ts @@ -12,6 +12,7 @@ export const Opentelemetry = (input?: Input) => { return createExtension({ name, onRequest: async ({ encode }) => { + encode.input return await startActiveGraffleSpan(`request`, async () => { const { pack } = await startActiveGraffleSpan(`encode`, encode) const { exchange } = await startActiveGraffleSpan(`pack`, pack) diff --git a/src/layers/7_extensions/Throws/Throws.test.ts b/src/layers/7_extensions/Throws/Throws.test.ts index e13ea280..4bb86a67 100644 --- a/src/layers/7_extensions/Throws/Throws.test.ts +++ b/src/layers/7_extensions/Throws/Throws.test.ts @@ -40,7 +40,7 @@ describe(`document`, () => { }) test(`.raw() throws if errors array non-empty`, async () => { - await expect(graffle.throws().rawString({ document: `query { foo }` })).rejects.toMatchInlineSnapshot( + await expect(graffle.throws().gql`query { foo }`.send()).rejects.toMatchInlineSnapshot( `[ContextualAggregateError: One or more errors in the execution result.]`, ) }) diff --git a/src/layers/7_extensions/Throws/Throws.ts b/src/layers/7_extensions/Throws/Throws.ts index 89a73bc9..b60fb890 100644 --- a/src/layers/7_extensions/Throws/Throws.ts +++ b/src/layers/7_extensions/Throws/Throws.ts @@ -16,7 +16,7 @@ export const Throws = () => { const throwsifiedInput: WithInput = { output: { envelope: { - enabled: client._.context.config.output.envelope.enabled, + enabled: client._.config.output.envelope.enabled, // @ts-expect-error errors: { execution: false, other: false, schema: false }, }, diff --git a/src/layers/7_extensions/Upload/Upload.test.ts b/src/layers/7_extensions/Upload/Upload.test.ts index 8e02b07d..8a1dc3cb 100644 --- a/src/layers/7_extensions/Upload/Upload.test.ts +++ b/src/layers/7_extensions/Upload/Upload.test.ts @@ -8,12 +8,13 @@ import { Upload } from './Upload.js' import { type SchemaService, serveSchema } from '../../../../tests/_/lib/serveSchema.js' import type { Client } from '../../6_client/client.js' -import type { Config, OutputConfigDefault } from '../../6_client/Settings/Config.js' +import type { OutputConfigDefault, TransportConfigHttp } from '../../6_client/Settings/Config.js' let schemaServer: SchemaService let graffle: Client<{ config: { - transport: { type: 'http'; config: Config['transport']['config'] } + schemaIndex: null + transport: TransportConfigHttp output: OutputConfigDefault initialInput: { schema: URL } name: 'default' @@ -36,15 +37,12 @@ afterAll(async () => { }) test(`upload`, async () => { - const data = await graffle.rawString({ - document: ` - mutation ($blob: Upload!) { - readTextFile(blob: $blob) - } - `, - variables: { - blob: new Blob([`Hello World`], { type: `text/plain` }) as any, - }, + const data = await graffle.gql` + mutation ($blob: Upload!) { + readTextFile(blob: $blob) + } + `.send({ + blob: new Blob([`Hello World`], { type: `text/plain` }) as any, }) expect(data).toMatchInlineSnapshot(` { diff --git a/src/layers/7_extensions/Upload/Upload.ts b/src/layers/7_extensions/Upload/Upload.ts index e33710e1..79d2693c 100644 --- a/src/layers/7_extensions/Upload/Upload.ts +++ b/src/layers/7_extensions/Upload/Upload.ts @@ -1,5 +1,5 @@ import { createExtension } from '../../../entrypoints/main.js' -import type { StandardScalarVariables } from '../../../lib/graphql-plus/graphql.js' +import type { Variables } from '../../../lib/graphql-plus/graphql.js' import { createBody } from './createBody.js' /** @@ -21,7 +21,9 @@ export const Upload = () => if (!hasUploadScalarVariable) return // TODO we can probably get file upload working for in-memory schemas too :) - if (pack.input.transport !== `http`) throw new Error(`Must be using http transport to use "Upload" scalar.`) + if (pack.input.transportType !== `http`) { + throw new Error(`Must be using http transport to use "Upload" scalar.`) + } return createBody({ query: input.query, @@ -39,6 +41,6 @@ export const Upload = () => }, }) -const isUsingUploadScalar = (_variables: StandardScalarVariables) => { +const isUsingUploadScalar = (_variables: Variables) => { return Object.values(_variables).some(_ => _ instanceof Blob) } diff --git a/src/layers/7_extensions/Upload/createBody.ts b/src/layers/7_extensions/Upload/createBody.ts index 5c4c7464..27261918 100644 --- a/src/layers/7_extensions/Upload/createBody.ts +++ b/src/layers/7_extensions/Upload/createBody.ts @@ -1,7 +1,7 @@ -import type { ExecutionInput } from '../../../lib/graphqlHTTP.js' +import type { RequestInput } from '../../../lib/graphql-http/graphqlHTTP.js' import extractFiles from './extractFiles.js' -export const createBody = (input: ExecutionInput): FormData => { +export const createBody = (input: RequestInput): FormData => { const { clone, files } = extractFiles( { query: input.query, variables: input.variables }, (value: unknown) => value instanceof Blob, diff --git a/src/lib/assert-equal.ts b/src/lib/assert-equal.ts new file mode 100644 index 00000000..bd497ffa --- /dev/null +++ b/src/lib/assert-equal.ts @@ -0,0 +1,22 @@ +import type { SimplifyDeep } from 'type-fest' + +export type IsEqual = [A] extends [B] ? [B] extends [A] ? true : false : false + +export type AssertEqual = IsEqual extends true ? true : never + +export const AssertEqual = ( + ..._: IsEqual extends false ? [reason: { + A: SimplifyDeep + B: SimplifyDeep + }] + : [] +) => undefined + +export const AssertTypeOf = ( + _: B, + ...__: IsEqual extends false ? [reason: { + A: SimplifyDeep + B: SimplifyDeep + }] + : [] +) => undefined diff --git a/src/lib/graphql-http/__.ts b/src/lib/graphql-http/__.ts new file mode 100644 index 00000000..945c9910 --- /dev/null +++ b/src/lib/graphql-http/__.ts @@ -0,0 +1 @@ +export * as GraphQLHTTP from './graphqlHTTP.js' diff --git a/src/lib/graphqlHTTP.ts b/src/lib/graphql-http/graphqlHTTP.ts similarity index 84% rename from src/lib/graphqlHTTP.ts rename to src/lib/graphql-http/graphqlHTTP.ts index acdb1c7e..de871a4a 100644 --- a/src/lib/graphqlHTTP.ts +++ b/src/lib/graphql-http/graphqlHTTP.ts @@ -1,12 +1,12 @@ import type { GraphQLFormattedError } from 'graphql' import { type ExecutionResult, GraphQLError } from 'graphql' -import type { GraphQLRequestEncoded, StandardScalarVariables } from './graphql-plus/graphql.js' -import { CONTENT_TYPE_GQL, CONTENT_TYPE_JSON } from './http.js' -import { isRecordLikeObject } from './prelude.js' +import type { Variables } from '../graphql-plus/graphql.js' +import { CONTENT_TYPE_GQL, CONTENT_TYPE_JSON } from '../http.js' +import { isRecordLikeObject } from '../prelude.js' -export type ExecutionInput = { +export interface RequestInput { query: string - variables: StandardScalarVariables + variables?: Variables operationName?: string } @@ -75,7 +75,7 @@ export const getRequestHeadersRec = { accept: ACCEPT_REC, } -export const getRequestEncodeSearchParameters = (request: GraphQLRequestEncoded): Record => { +export const getRequestEncodeSearchParameters = (request: RequestInput): Record => { return { query: request.query, ...(request.variables ? { variables: JSON.stringify(request.variables) } : {}), @@ -84,7 +84,7 @@ export const getRequestEncodeSearchParameters = (request: GraphQLRequestEncoded) } export type getRequestEncodeSearchParameters = typeof getRequestEncodeSearchParameters -export const postRequestEncodeBody = (input: GraphQLRequestEncoded): BodyInit => { +export const postRequestEncodeBody = (input: RequestInput): BodyInit => { return JSON.stringify({ query: input.query, variables: input.variables, diff --git a/src/lib/graphql-plus/execute.ts b/src/lib/graphql-plus/execute.ts new file mode 100644 index 00000000..407ea232 --- /dev/null +++ b/src/lib/graphql-plus/execute.ts @@ -0,0 +1,30 @@ +import type { ExecutionResult, GraphQLSchema } from 'graphql' +import { execute as graphqlExecute, graphql } from 'graphql' +import { TypedDocument } from '../typed-document/__.js' +import type { GraphQLRequestInput } from './graphql.js' + +export type ExecuteInput = { + request: GraphQLRequestInput + schema: GraphQLSchema +} + +export const execute = async (input: ExecuteInput): Promise => { + const { schema, request: { query, operationName, variables: variableValues } } = input + if (TypedDocument.isString(query)) { + return await graphql({ + schema, + source: query as string, + variableValues, + operationName, + // contextValue: createContextValue(), // todo + }) + } else { + return await graphqlExecute({ + schema, + document: query, + variableValues, + operationName, + // contextValue: createContextValue(), // todo + }) + } +} diff --git a/src/lib/graphql.test.ts b/src/lib/graphql-plus/graphql.test.ts similarity index 93% rename from src/lib/graphql.test.ts rename to src/lib/graphql-plus/graphql.test.ts index efeb8d47..bdea6e4d 100644 --- a/src/lib/graphql.test.ts +++ b/src/lib/graphql-plus/graphql.test.ts @@ -1,9 +1,5 @@ import { describe, expect, test } from 'vitest' -import { - type GraphQLRequestEncoded, - type OperationTypeNameAll, - parseGraphQLOperationType, -} from './graphql-plus/graphql.js' +import { type GraphQLRequestInput, type OperationTypeNameAll, parseGraphQLOperationType } from './graphql.js' const operationNameOne = `one` const operationNameTwo = `two` @@ -14,7 +10,7 @@ const docOverloadedTerms = `query { queryX }` type CaseParameters = [ description: string, - request: GraphQLRequestEncoded, + request: GraphQLRequestInput, result: null | OperationTypeNameAll, ] diff --git a/src/lib/graphql-plus/graphql.ts b/src/lib/graphql-plus/graphql.ts index d4cc2878..94934d37 100644 --- a/src/lib/graphql-plus/graphql.ts +++ b/src/lib/graphql-plus/graphql.ts @@ -1,5 +1,4 @@ import type { - DocumentNode, GraphQLArgument, GraphQLEnumValue, GraphQLError, @@ -27,6 +26,8 @@ import { OperationTypeNode, } from 'graphql' import type { Errors } from '../errors/__.js' +import { isString } from '../prelude.js' +import type { TypedDocument } from '../typed-document/__.js' import { isScalarTypeAndCustom } from './nodesSchema.js' export * from './_Nodes.js' @@ -307,16 +308,6 @@ export const hasMutation = (typeMapByKind: TypeMapByKind) => export const hasSubscription = (typeMapByKind: TypeMapByKind) => typeMapByKind.GraphQLRootType.find((_) => _.name === `Subscription`) -export type Variables = Record - -export type StandardScalarVariables = { - [key: string]: string | boolean | null | number | StandardScalarVariables -} - -export type SomeData = Record - -export type GraphQLExecutionResultError = Errors.ContextualAggregateError - export const OperationTypes = { query: `query`, mutation: `mutation`, @@ -345,21 +336,26 @@ export const OperationTypeAccessTypeMap = { export const isOperationTypeName = (value: unknown): value is OperationTypeName => value === `query` || value === `mutation` -export type GraphQLRequestEncoded = { - query: string - variables?: StandardScalarVariables +export interface GraphQLRequestInput { + query: string | TypedDocument.TypedDocument + variables?: Variables operationName?: string } -export type GraphQLRequestInput = { - document: string | DocumentNode - variables?: StandardScalarVariables - operationName?: string +export type Variables = { + [key: string]: string | boolean | null | number | Variables } +export type SomeData = Record + +export type GraphQLExecutionResultError = Errors.ContextualAggregateError + const definedOperationPattern = new RegExp(`^\\b(${Object.values(OperationTypes).join(`|`)})\\b`) -export const parseGraphQLOperationType = (request: GraphQLRequestEncoded): OperationTypeNameAll | null => { +export const parseGraphQLOperationType = (request: GraphQLRequestInput): OperationTypeNameAll | null => { + // todo support DocumentNode too + if (!isString(request.query)) return null + const { operationName, query: document } = request const definedOperations = document.split(/[{}\n]+/).map(s => s.trim()).map(line => { diff --git a/src/lib/graphql-plus/nodes.ts b/src/lib/graphql-plus/nodes.ts index f1c0fa45..d13330a7 100644 --- a/src/lib/graphql-plus/nodes.ts +++ b/src/lib/graphql-plus/nodes.ts @@ -120,6 +120,10 @@ export const Document: Constructor = (document) => { } } +export const isDocumentNode = (value: unknown): value is DocumentNode => { + return typeof value === `object` && value !== null && `kind` in value && value.kind === `Document` +} + export const OperationDefinition: Constructor = (operationDefinition) => { return { kind: Kind.OPERATION_DEFINITION, diff --git a/src/lib/prelude.test-d.ts b/src/lib/prelude.test-d.ts index fee65e43..b41178d1 100644 --- a/src/lib/prelude.test-d.ts +++ b/src/lib/prelude.test-d.ts @@ -1,12 +1,20 @@ -import { expectTypeOf, test } from 'vitest' +import { AssertEqual } from './assert-equal.js' import type { ConfigManager } from './prelude.js' +import type { OmitKeysWithPrefix } from './prelude.js' -test(`ConfigManager`, () => { - expectTypeOf>().toEqualTypeOf<{ a: { b: 2 }; a2: 2 }>() - expectTypeOf>().toEqualTypeOf<{ a: { b: 3 } }>() - expectTypeOf>().toEqualTypeOf<{ a: { b: 3 } }>() - // never - expectTypeOf>().toEqualTypeOf() - expectTypeOf>().toEqualTypeOf() - expectTypeOf>().toEqualTypeOf<{ a: { b: never } }>() -}) +// dprint-ignore +{ + +AssertEqual , { a: 1; b: 2 }>() +AssertEqual , { b: 2 }>() + +// ConfigManager +AssertEqual, { a: { b: 2 }; a2: 2 }>() +AssertEqual, { a: { b: 3 } }>() +AssertEqual, { a: { b: 3 } }>() +// never +AssertEqual, never>() +AssertEqual, never>() +AssertEqual, { a: { b: never } }>() + +} diff --git a/src/lib/prelude.ts b/src/lib/prelude.ts index 47b822a3..57f9da42 100644 --- a/src/lib/prelude.ts +++ b/src/lib/prelude.ts @@ -1,7 +1,6 @@ import type { IsEmptyObject, IsNever, IsUnknown, Simplify } from 'type-fest' import type { ConditionalSimplify, ConditionalSimplifyDeep } from 'type-fest/source/conditional-simplify.js' -import type { ExcludeUndefined } from 'type-fest/source/required-deep.js' /* eslint-disable */ export type RemoveIndex = { @@ -213,6 +212,7 @@ export type LastOf = UnionToIntersection T : never> ext // export type IsMultiple = T extends 0 ? false : T extends 1 ? false : true export type ExcludeNull = Exclude +export type ExcludeUndefined = Exclude export type ExcludeNullAndUndefined = Exclude export const mapValues = < @@ -352,9 +352,13 @@ export namespace ConfigManager { export type ReadOrDefault<$Obj, $Path extends Path, $Default> = OrDefault, $Default> - export type OrDefault<$Value, $Default> = IsUnknown<$Value> extends true ? $Default - : $Value extends undefined ? $Default - : $Value + // dprint-ignore + export type OrDefault<$Value, $Default> = + // When no value has been passed in, because the property is optional, + // then the inferred type is unknown. + IsUnknown<$Value> extends true ? $Default : + $Value extends undefined ? $Default : + $Value // dprint-ignore export type Read<$Value, $Path extends [...string[]]> = @@ -487,21 +491,6 @@ export const identityProxy = new Proxy({}, { get: () => (value: unknown) => value, }) -// todo just for tets, move to test lib - -export type IsEqual = A extends B ? B extends A ? true : false : false - -export type AssertIsEqual = IsEqual extends true ? true : never - -export const AssertIsEqual = ( - ..._: IsEqual extends false ? [reason: { - message: `Types not equal` - A: SimplifyDeep - B: SimplifyDeep - }] - : [] -) => undefined - export type IfExtendsElse<$Type, $Extends, $Else> = $Type extends $Extends ? $Type : $Else // dprint-ignore @@ -573,9 +562,6 @@ export type OmitKeysWithPrefix<$Object extends object, $Prefix extends string> = ]: $Object[$Key] } -AssertIsEqual, { a: 1; b: 2 }>() -AssertIsEqual, { b: 2 }>() - export const getFromEnumLooselyOrThrow = < $Record extends { [_ in keyof $Record]: unknown }, $Key extends string, @@ -614,3 +600,11 @@ export type StringKeyof = keyof T & string export const keysStrict = (obj: T): (keyof T)[] => { return Object.keys(obj) as (keyof T)[] } + +export type HasKeys = keyof T extends never ? false : true + +export type IsHasIndexType = string extends keyof T ? true : false + +export const isString = (value: unknown): value is string => { + return typeof value === 'string' +} diff --git a/src/lib/typed-document/TypedDocument.test-d.ts b/src/lib/typed-document/TypedDocument.test-d.ts new file mode 100644 index 00000000..fdbfa890 --- /dev/null +++ b/src/lib/typed-document/TypedDocument.test-d.ts @@ -0,0 +1,38 @@ +import type { DocumentNode } from 'graphql' +import { AssertEqual } from '../assert-equal.js' +import type { + GetVariablesInputKind, + Node, + Query, + ResultOf, + String, + Variables, + VariablesInputKindNone, + VariablesInputKindOptional, + VariablesInputKindRequired, + VariablesOf, +} from './TypedDocument.js' +// We want to test both internal/external Node to ensure they both work. See jsdoc for `Node` for more context. +import type { TypedDocumentNode as Node2 } from '@graphql-typed-document-node/core' + +// dprint-ignore +{ + AssertEqual, VariablesInputKindOptional>() + AssertEqual, VariablesInputKindNone>() + AssertEqual, VariablesInputKindNone>() + AssertEqual, VariablesInputKindRequired>() + AssertEqual, VariablesInputKindRequired>() + AssertEqual, VariablesInputKindOptional>() + AssertEqual, VariablesInputKindOptional>() + + AssertEqual, Variables>() + AssertEqual>, {}>() + AssertEqual>, {}>() + AssertEqual>, {}>() + AssertEqual>, {}>() + + AssertEqual>, {x:1}>() + AssertEqual>, {x:1}>() + AssertEqual>, {x:1}>() + AssertEqual>, {x:1}>() +} diff --git a/src/lib/typed-document/TypedDocument.ts b/src/lib/typed-document/TypedDocument.ts new file mode 100644 index 00000000..7741054a --- /dev/null +++ b/src/lib/typed-document/TypedDocument.ts @@ -0,0 +1,98 @@ +import type { DocumentTypeDecoration } from '@graphql-typed-document-node/core' +import type { DocumentNode, TypedQueryDocumentNode } from 'graphql' +import type { HasRequiredKeys, IsNever, IsUnknown } from 'type-fest' +import { type HasKeys, type IsHasIndexType } from '../../lib/prelude.js' +import type { SomeData, Variables } from '../graphql-plus/graphql.js' + +export { type TypedQueryDocumentNode as Query } from 'graphql' + +export type { SomeData, Variables } from '../graphql-plus/graphql.js' + +// We default to `any` because otherwise when this type is used as a constraint +// it will reject apparent subtypes. The reason I think has to do with co/contra-variant stuff +// in regards to how function parameters versus return types affect if only wider or narrower +// types are allowed. + +// dprint-ignore +export type TypedDocument<$Result extends SomeData = SomeData, $Variables extends Variables = any> = + | TypedQueryDocumentNode<$Result, $Variables> + | TypedDocumentString <$Result, $Variables> + | TypedDocumentNode <$Result, $Variables> + +/** + * @remarks From package \@graphql-typed-document-node/core in theory but not exported + * @see https://github.com/dotansimha/graphql-typed-document-node/issues/163 + */ +// dprint-ignore +interface TypedDocumentString<$Result = SomeData, $Variables = Variables> extends String, DocumentTypeDecoration<$Result, $Variables> { + // nothing +} + +/** + * This type is re-defined here because importing it from `@graphql-typed-document-node/core` leads to this error: + * + * Failed to resolve entry for package "\@graphql-typed-document-node/core". The package may have incorrect main/module/exports specified in its package.json + * + * @see https://github.com/dotansimha/graphql-typed-document-node + */ +// dprint-ignore +interface TypedDocumentNode<$Result = SomeData, $Variables = Variables> extends DocumentNode, DocumentTypeDecoration<$Result, $Variables> { + // nothing +} + +export { type TypedDocumentNode as Node, type TypedDocumentString as String } + +// +// +// +// +// Variables Helpers + +// dprint-ignore +export type GetVariablesInputKind<$Variables extends Variables> = + IsNever<$Variables> extends true ? VariablesInputKindNone : + IsHasIndexType<$Variables> extends true ? VariablesInputKindOptional : + HasRequiredKeys<$Variables> extends true ? VariablesInputKindRequired : + HasKeys<$Variables> extends true ? VariablesInputKindOptional : + VariablesInputKindNone + +export type VariablesInputKind = + | VariablesInputKindNone + | VariablesInputKindRequired + | VariablesInputKindOptional + +export type VariablesInputKindNone = 'none' + +export type VariablesInputKindRequired = 'required' + +export type VariablesInputKindOptional = 'optional' + +// +// +// +// +// Document Helpers + +export const isString = <$TypedDocument extends TypedDocument>( + document: $TypedDocument, +): document is Exclude<$TypedDocument, TypedDocumentNode | TypedQueryDocumentNode> => typeof document === `string` + +// dprint-ignore +export type ResultOf<$Document extends TypedDocument> = + $Document extends TypedQueryDocumentNode ? $R : + $Document extends TypedDocumentNode ? $R : + $Document extends TypedDocumentString ? $R : + never + +// dprint-ignore +export type VariablesOf<$Document extends TypedDocument> = + $Document extends TypedDocumentString ? $V : + $Document extends TypedQueryDocumentNode ? $V : + $Document extends TypedDocumentNode ? IsUnknown<$V> extends true + // This catches case of DocumentNode being passed + // which is a subtype of TypedDocumentNode, however, + // extracting variables from it will always yield + // unknown. + ? Variables + : $V : + never diff --git a/src/lib/typed-document/__.ts b/src/lib/typed-document/__.ts new file mode 100644 index 00000000..d05f8988 --- /dev/null +++ b/src/lib/typed-document/__.ts @@ -0,0 +1 @@ +export * as TypedDocument from './TypedDocument.js' diff --git a/tests/_/SpyExtension.ts b/tests/_/SpyExtension.ts new file mode 100644 index 00000000..584f5d1f --- /dev/null +++ b/tests/_/SpyExtension.ts @@ -0,0 +1,19 @@ +import { beforeEach } from 'vitest' +import { createExtension } from '../../src/entrypoints/main.js' + +export const Spy = () => + createExtension({ + name: `spy`, + onRequest: ({ exchange }) => { + if (exchange.input.transportType === `memory`) { + Spy.input = exchange.input + } + return exchange() + }, + }) + +Spy.input = undefined as object | undefined + +beforeEach(() => { + Spy.input = undefined +}) diff --git a/tests/_/helpers.ts b/tests/_/helpers.ts index b0a2f099..faf39347 100644 --- a/tests/_/helpers.ts +++ b/tests/_/helpers.ts @@ -3,7 +3,7 @@ import { test as testBase, vi } from 'vitest' import { Graffle } from '../../src/entrypoints/main.js' import type { Config } from '../../src/entrypoints/utilities-for-generated.js' import type { Client } from '../../src/layers/6_client/client.js' -import { CONTENT_TYPE_REC } from '../../src/lib/graphqlHTTP.js' +import { CONTENT_TYPE_REC } from '../../src/lib/graphql-http/graphqlHTTP.js' import { type SchemaService, serveSchema } from './lib/serveSchema.js' import { db } from './schemas/db.js' import { Graffle as KitchenSink } from './schemas/kitchen-sink/graffle/__.js' @@ -11,6 +11,8 @@ import { type Index as KitchenSinkSchemaIndex } from './schemas/kitchen-sink/gra import { schema as kitchenSinkSchema } from './schemas/kitchen-sink/schema.js' import { schema } from './schemas/pokemon/schema.js' +export const kitchenSink = KitchenSink.create({ schema: kitchenSinkSchema }) + export const createResponse = (body: object) => new Response(JSON.stringify(body), { status: 200, headers: { 'content-type': CONTENT_TYPE_REC } }) diff --git a/tests/examples/30_raw/raw_rawString__rawString.test.ts b/tests/examples/30_gql/gql_gql-document-node.test.ts similarity index 73% rename from tests/examples/30_raw/raw_rawString__rawString.test.ts rename to tests/examples/30_gql/gql_gql-document-node.test.ts index 262aa580..3e51d18a 100644 --- a/tests/examples/30_raw/raw_rawString__rawString.test.ts +++ b/tests/examples/30_gql/gql_gql-document-node.test.ts @@ -7,13 +7,13 @@ import { expect, test } from 'vitest' import { runExample } from '../../../scripts/generate-examples-derivatives/helpers.js' -test(`raw_rawString__rawString`, async () => { - const exampleResult = await runExample(`./examples/30_raw/raw_rawString__rawString.ts`) +test(`gql_gql-document-node`, async () => { + const exampleResult = await runExample(`./examples/30_gql/gql_gql-document-node.ts`) // Examples should output their data results. const exampleResultMaybeEncoded = exampleResult // If ever outputs vary by Node version, you can use this to snapshot by Node version. // const nodeMajor = process.version.match(/v(\d+)/)?.[1] ?? `unknown` await expect(exampleResultMaybeEncoded).toMatchFileSnapshot( - `../../../examples/__outputs__/30_raw/raw_rawString__rawString.output.txt`, + `../../../examples/__outputs__/30_gql/gql_gql-document-node.output.txt`, ) }) diff --git a/tests/examples/30_raw/raw_rawDocumentNode_rawTyped__raw-document-node-typed.test.ts b/tests/examples/30_gql/gql_gql-document-node_gql-typed_gql-document-node-typed__gql-document-node-typed.test.ts similarity index 60% rename from tests/examples/30_raw/raw_rawDocumentNode_rawTyped__raw-document-node-typed.test.ts rename to tests/examples/30_gql/gql_gql-document-node_gql-typed_gql-document-node-typed__gql-document-node-typed.test.ts index 4944e4eb..69661daa 100644 --- a/tests/examples/30_raw/raw_rawDocumentNode_rawTyped__raw-document-node-typed.test.ts +++ b/tests/examples/30_gql/gql_gql-document-node_gql-typed_gql-document-node-typed__gql-document-node-typed.test.ts @@ -7,13 +7,15 @@ import { expect, test } from 'vitest' import { runExample } from '../../../scripts/generate-examples-derivatives/helpers.js' -test(`raw_rawDocumentNode_rawTyped__raw-document-node-typed`, async () => { - const exampleResult = await runExample(`./examples/30_raw/raw_rawDocumentNode_rawTyped__raw-document-node-typed.ts`) +test(`gql_gql-document-node_gql-typed_gql-document-node-typed__gql-document-node-typed`, async () => { + const exampleResult = await runExample( + `./examples/30_gql/gql_gql-document-node_gql-typed_gql-document-node-typed__gql-document-node-typed.ts`, + ) // Examples should output their data results. const exampleResultMaybeEncoded = exampleResult // If ever outputs vary by Node version, you can use this to snapshot by Node version. // const nodeMajor = process.version.match(/v(\d+)/)?.[1] ?? `unknown` await expect(exampleResultMaybeEncoded).toMatchFileSnapshot( - `../../../examples/__outputs__/30_raw/raw_rawDocumentNode_rawTyped__raw-document-node-typed.output.txt`, + `../../../examples/__outputs__/30_gql/gql_gql-document-node_gql-typed_gql-document-node-typed__gql-document-node-typed.output.txt`, ) }) diff --git a/tests/examples/30_raw/raw_rawDocumentNode__raw-document-node.test.ts b/tests/examples/30_gql/gql_gql-string.test.ts similarity index 70% rename from tests/examples/30_raw/raw_rawDocumentNode__raw-document-node.test.ts rename to tests/examples/30_gql/gql_gql-string.test.ts index f54317cc..8f3a6447 100644 --- a/tests/examples/30_raw/raw_rawDocumentNode__raw-document-node.test.ts +++ b/tests/examples/30_gql/gql_gql-string.test.ts @@ -7,13 +7,13 @@ import { expect, test } from 'vitest' import { runExample } from '../../../scripts/generate-examples-derivatives/helpers.js' -test(`raw_rawDocumentNode__raw-document-node`, async () => { - const exampleResult = await runExample(`./examples/30_raw/raw_rawDocumentNode__raw-document-node.ts`) +test(`gql_gql-string`, async () => { + const exampleResult = await runExample(`./examples/30_gql/gql_gql-string.ts`) // Examples should output their data results. const exampleResultMaybeEncoded = exampleResult // If ever outputs vary by Node version, you can use this to snapshot by Node version. // const nodeMajor = process.version.match(/v(\d+)/)?.[1] ?? `unknown` await expect(exampleResultMaybeEncoded).toMatchFileSnapshot( - `../../../examples/__outputs__/30_raw/raw_rawDocumentNode__raw-document-node.output.txt`, + `../../../examples/__outputs__/30_gql/gql_gql-string.output.txt`, ) }) diff --git a/tests/examples/30_raw/raw_rawString_rawTyped__rawString-typed.test.ts b/tests/examples/30_gql/gql_gql-string_gql-typed__gql-string-typed.test.ts similarity index 69% rename from tests/examples/30_raw/raw_rawString_rawTyped__rawString-typed.test.ts rename to tests/examples/30_gql/gql_gql-string_gql-typed__gql-string-typed.test.ts index 897b9ef1..e916c085 100644 --- a/tests/examples/30_raw/raw_rawString_rawTyped__rawString-typed.test.ts +++ b/tests/examples/30_gql/gql_gql-string_gql-typed__gql-string-typed.test.ts @@ -7,13 +7,13 @@ import { expect, test } from 'vitest' import { runExample } from '../../../scripts/generate-examples-derivatives/helpers.js' -test(`raw_rawString_rawTyped__rawString-typed`, async () => { - const exampleResult = await runExample(`./examples/30_raw/raw_rawString_rawTyped__rawString-typed.ts`) +test(`gql_gql-string_gql-typed__gql-string-typed`, async () => { + const exampleResult = await runExample(`./examples/30_gql/gql_gql-string_gql-typed__gql-string-typed.ts`) // Examples should output their data results. const exampleResultMaybeEncoded = exampleResult // If ever outputs vary by Node version, you can use this to snapshot by Node version. // const nodeMajor = process.version.match(/v(\d+)/)?.[1] ?? `unknown` await expect(exampleResultMaybeEncoded).toMatchFileSnapshot( - `../../../examples/__outputs__/30_raw/raw_rawString_rawTyped__rawString-typed.output.txt`, + `../../../examples/__outputs__/30_gql/gql_gql-string_gql-typed__gql-string-typed.output.txt`, ) }) diff --git a/website/content/_snippets/example-links/gql-document-node-typed.md b/website/content/_snippets/example-links/gql-document-node-typed.md new file mode 100644 index 00000000..017d9d97 --- /dev/null +++ b/website/content/_snippets/example-links/gql-document-node-typed.md @@ -0,0 +1 @@ + diff --git a/website/content/_snippets/example-links/gql-document-node.md b/website/content/_snippets/example-links/gql-document-node.md new file mode 100644 index 00000000..467c2b33 --- /dev/null +++ b/website/content/_snippets/example-links/gql-document-node.md @@ -0,0 +1 @@ + diff --git a/website/content/_snippets/example-links/gql-document-node_gql-document-node-typed.md b/website/content/_snippets/example-links/gql-document-node_gql-document-node-typed.md new file mode 100644 index 00000000..017d9d97 --- /dev/null +++ b/website/content/_snippets/example-links/gql-document-node_gql-document-node-typed.md @@ -0,0 +1 @@ + diff --git a/website/content/_snippets/example-links/gql-document-node_gql-typed.md b/website/content/_snippets/example-links/gql-document-node_gql-typed.md new file mode 100644 index 00000000..017d9d97 --- /dev/null +++ b/website/content/_snippets/example-links/gql-document-node_gql-typed.md @@ -0,0 +1 @@ + diff --git a/website/content/_snippets/example-links/gql-document-node_gql-typed_gql-document-node-typed.md b/website/content/_snippets/example-links/gql-document-node_gql-typed_gql-document-node-typed.md new file mode 100644 index 00000000..017d9d97 --- /dev/null +++ b/website/content/_snippets/example-links/gql-document-node_gql-typed_gql-document-node-typed.md @@ -0,0 +1 @@ + diff --git a/website/content/_snippets/example-links/raw_rawString.md b/website/content/_snippets/example-links/gql-string.md similarity index 50% rename from website/content/_snippets/example-links/raw_rawString.md rename to website/content/_snippets/example-links/gql-string.md index d2d84c97..90c08f7d 100644 --- a/website/content/_snippets/example-links/raw_rawString.md +++ b/website/content/_snippets/example-links/gql-string.md @@ -1 +1 @@ - + diff --git a/website/content/_snippets/example-links/gql-string_gql-typed.md b/website/content/_snippets/example-links/gql-string_gql-typed.md new file mode 100644 index 00000000..dba5f5bb --- /dev/null +++ b/website/content/_snippets/example-links/gql-string_gql-typed.md @@ -0,0 +1 @@ + diff --git a/website/content/_snippets/example-links/gql-typed.md b/website/content/_snippets/example-links/gql-typed.md new file mode 100644 index 00000000..29c002fe --- /dev/null +++ b/website/content/_snippets/example-links/gql-typed.md @@ -0,0 +1 @@ + diff --git a/website/content/_snippets/example-links/gql-typed_gql-document-node-typed.md b/website/content/_snippets/example-links/gql-typed_gql-document-node-typed.md new file mode 100644 index 00000000..017d9d97 --- /dev/null +++ b/website/content/_snippets/example-links/gql-typed_gql-document-node-typed.md @@ -0,0 +1 @@ + diff --git a/website/content/_snippets/example-links/gql.md b/website/content/_snippets/example-links/gql.md new file mode 100644 index 00000000..69e33f00 --- /dev/null +++ b/website/content/_snippets/example-links/gql.md @@ -0,0 +1 @@ + diff --git a/website/content/_snippets/example-links/gql_gql-document-node-typed.md b/website/content/_snippets/example-links/gql_gql-document-node-typed.md new file mode 100644 index 00000000..017d9d97 --- /dev/null +++ b/website/content/_snippets/example-links/gql_gql-document-node-typed.md @@ -0,0 +1 @@ + diff --git a/website/content/_snippets/example-links/gql_gql-document-node.md b/website/content/_snippets/example-links/gql_gql-document-node.md new file mode 100644 index 00000000..467c2b33 --- /dev/null +++ b/website/content/_snippets/example-links/gql_gql-document-node.md @@ -0,0 +1 @@ + diff --git a/website/content/_snippets/example-links/gql_gql-document-node_gql-document-node-typed.md b/website/content/_snippets/example-links/gql_gql-document-node_gql-document-node-typed.md new file mode 100644 index 00000000..017d9d97 --- /dev/null +++ b/website/content/_snippets/example-links/gql_gql-document-node_gql-document-node-typed.md @@ -0,0 +1 @@ + diff --git a/website/content/_snippets/example-links/gql_gql-document-node_gql-typed.md b/website/content/_snippets/example-links/gql_gql-document-node_gql-typed.md new file mode 100644 index 00000000..017d9d97 --- /dev/null +++ b/website/content/_snippets/example-links/gql_gql-document-node_gql-typed.md @@ -0,0 +1 @@ + diff --git a/website/content/_snippets/example-links/gql_gql-document-node_gql-typed_gql-document-node-typed.md b/website/content/_snippets/example-links/gql_gql-document-node_gql-typed_gql-document-node-typed.md new file mode 100644 index 00000000..017d9d97 --- /dev/null +++ b/website/content/_snippets/example-links/gql_gql-document-node_gql-typed_gql-document-node-typed.md @@ -0,0 +1 @@ + diff --git a/website/content/_snippets/example-links/rawString.md b/website/content/_snippets/example-links/gql_gql-string.md similarity index 50% rename from website/content/_snippets/example-links/rawString.md rename to website/content/_snippets/example-links/gql_gql-string.md index d2d84c97..90c08f7d 100644 --- a/website/content/_snippets/example-links/rawString.md +++ b/website/content/_snippets/example-links/gql_gql-string.md @@ -1 +1 @@ - + diff --git a/website/content/_snippets/example-links/gql_gql-string_gql-typed.md b/website/content/_snippets/example-links/gql_gql-string_gql-typed.md new file mode 100644 index 00000000..dba5f5bb --- /dev/null +++ b/website/content/_snippets/example-links/gql_gql-string_gql-typed.md @@ -0,0 +1 @@ + diff --git a/website/content/_snippets/example-links/gql_gql-typed.md b/website/content/_snippets/example-links/gql_gql-typed.md new file mode 100644 index 00000000..29c002fe --- /dev/null +++ b/website/content/_snippets/example-links/gql_gql-typed.md @@ -0,0 +1 @@ + diff --git a/website/content/_snippets/example-links/gql_gql-typed_gql-document-node-typed.md b/website/content/_snippets/example-links/gql_gql-typed_gql-document-node-typed.md new file mode 100644 index 00000000..017d9d97 --- /dev/null +++ b/website/content/_snippets/example-links/gql_gql-typed_gql-document-node-typed.md @@ -0,0 +1 @@ + diff --git a/website/content/_snippets/example-links/raw.md b/website/content/_snippets/example-links/raw.md index ea6f9619..4f68b60e 100644 --- a/website/content/_snippets/example-links/raw.md +++ b/website/content/_snippets/example-links/raw.md @@ -1 +1 @@ - + diff --git a/website/content/_snippets/example-links/rawDocumentNode.md b/website/content/_snippets/example-links/rawDocumentNode.md deleted file mode 100644 index 207594be..00000000 --- a/website/content/_snippets/example-links/rawDocumentNode.md +++ /dev/null @@ -1 +0,0 @@ - diff --git a/website/content/_snippets/example-links/rawDocumentNode_rawTyped.md b/website/content/_snippets/example-links/rawDocumentNode_rawTyped.md deleted file mode 100644 index 6e48e510..00000000 --- a/website/content/_snippets/example-links/rawDocumentNode_rawTyped.md +++ /dev/null @@ -1 +0,0 @@ - diff --git a/website/content/_snippets/example-links/rawString_rawTyped.md b/website/content/_snippets/example-links/rawString_rawTyped.md deleted file mode 100644 index 050d1428..00000000 --- a/website/content/_snippets/example-links/rawString_rawTyped.md +++ /dev/null @@ -1 +0,0 @@ - diff --git a/website/content/_snippets/example-links/rawTyped.md b/website/content/_snippets/example-links/rawTyped.md deleted file mode 100644 index 5675fc97..00000000 --- a/website/content/_snippets/example-links/rawTyped.md +++ /dev/null @@ -1 +0,0 @@ - diff --git a/website/content/_snippets/example-links/raw_rawDocumentNode.md b/website/content/_snippets/example-links/raw_rawDocumentNode.md deleted file mode 100644 index 207594be..00000000 --- a/website/content/_snippets/example-links/raw_rawDocumentNode.md +++ /dev/null @@ -1 +0,0 @@ - diff --git a/website/content/_snippets/example-links/raw_rawDocumentNode_rawTyped.md b/website/content/_snippets/example-links/raw_rawDocumentNode_rawTyped.md deleted file mode 100644 index 6e48e510..00000000 --- a/website/content/_snippets/example-links/raw_rawDocumentNode_rawTyped.md +++ /dev/null @@ -1 +0,0 @@ - diff --git a/website/content/_snippets/example-links/raw_rawString_rawTyped.md b/website/content/_snippets/example-links/raw_rawString_rawTyped.md deleted file mode 100644 index 050d1428..00000000 --- a/website/content/_snippets/example-links/raw_rawString_rawTyped.md +++ /dev/null @@ -1 +0,0 @@ - diff --git a/website/content/_snippets/example-links/raw_rawTyped.md b/website/content/_snippets/example-links/raw_rawTyped.md deleted file mode 100644 index 5675fc97..00000000 --- a/website/content/_snippets/example-links/raw_rawTyped.md +++ /dev/null @@ -1 +0,0 @@ - diff --git a/website/content/_snippets/examples/anyware/slot-body.detail.md b/website/content/_snippets/examples/anyware/slot-body.detail.md index 3cb02fe2..6374c1ed 100644 --- a/website/content/_snippets/examples/anyware/slot-body.detail.md +++ b/website/content/_snippets/examples/anyware/slot-body.detail.md @@ -22,17 +22,14 @@ const graffle = Graffle }) }) -const result = await graffle.rawString({ - document: ` +const result = await graffle.gql` query pokemon { trainers { name } } query trainers { pokemon { name } } - `, - operationName: `pokemon`, -}) + `.send(`pokemon`) console.log(result) ``` diff --git a/website/content/_snippets/examples/anyware/slot-body.md b/website/content/_snippets/examples/anyware/slot-body.md index 3ab2fe23..cd8d305c 100644 --- a/website/content/_snippets/examples/anyware/slot-body.md +++ b/website/content/_snippets/examples/anyware/slot-body.md @@ -20,17 +20,14 @@ const graffle = Graffle }) }) -const result = await graffle.rawString({ - document: ` +const result = await graffle.gql` query pokemon { trainers { name } } query trainers { pokemon { name } } - `, - operationName: `pokemon`, -}) + `.send(`pokemon`) console.log(result) ``` diff --git a/website/content/_snippets/examples/anyware/slot-fetch.detail.md b/website/content/_snippets/examples/anyware/slot-fetch.detail.md index 9fd14f67..a22f4933 100644 --- a/website/content/_snippets/examples/anyware/slot-fetch.detail.md +++ b/website/content/_snippets/examples/anyware/slot-fetch.detail.md @@ -13,15 +13,19 @@ const graffle = Graffle return await exchange({ using: { fetch: () => { - return new Response(JSON.stringify({ data: { continents: [{ name: `Earthsea` }] } })) + return new Response(JSON.stringify({ data: { trainers: [{ name: `Jason` }] } })) }, }, }) }) -const result = await graffle.rawString({ - document: `query { continents { name } }`, -}) +const result = await graffle.gql` + query { + trainers { + name + } + } +`.send() console.log(result) ``` @@ -29,7 +33,7 @@ console.log(result) ```txt -{ continents: [ { name: 'Earthsea' } ] } +{ trainers: [ { name: 'Jason' } ] } ``` diff --git a/website/content/_snippets/examples/anyware/slot-fetch.md b/website/content/_snippets/examples/anyware/slot-fetch.md index afcd36d4..2a1bafd2 100644 --- a/website/content/_snippets/examples/anyware/slot-fetch.md +++ b/website/content/_snippets/examples/anyware/slot-fetch.md @@ -11,15 +11,19 @@ const graffle = Graffle return await exchange({ using: { fetch: () => { - return new Response(JSON.stringify({ data: { continents: [{ name: `Earthsea` }] } })) + return new Response(JSON.stringify({ data: { trainers: [{ name: `Jason` }] } })) }, }, }) }) -const result = await graffle.rawString({ - document: `query { continents { name } }`, -}) +const result = await graffle.gql` + query { + trainers { + name + } + } +`.send() console.log(result) ``` @@ -27,7 +31,7 @@ console.log(result) ```txt -{ continents: [ { name: 'Earthsea' } ] } +{ trainers: [ { name: 'Jason' } ] } ``` diff --git a/website/content/_snippets/examples/anyware/slot-search-params.detail.md b/website/content/_snippets/examples/anyware/slot-search-params.detail.md index 951e069a..190a5594 100644 --- a/website/content/_snippets/examples/anyware/slot-search-params.detail.md +++ b/website/content/_snippets/examples/anyware/slot-search-params.detail.md @@ -22,17 +22,15 @@ const graffle = Graffle }) }) -const result = await graffle.rawString({ - document: ` +const result = await graffle.gql` query trainers { pokemon { name } } query pokemon { trainers { name } } - `, - operationName: `queryCountries`, -}) + ` + .send(`queryCountries`) console.log(result) ``` @@ -49,10 +47,7 @@ ContextualError: There was an error in the core implementation of hook "pack". at runPipeline (/some/path/to/runPipeline.ts:XX:XX:18) at async runPipeline (/some/path/to/runPipeline.ts:XX:XX:14) at async Object.run (/some/path/to/main.ts:XX:XX:22) - at async run (/some/path/to/client.ts:XX:XX:20) - at async runRaw (/some/path/to/client.ts:XX:XX:12) - at async Object.raw (/some/path/to/client.ts:XX:XX:14) - at async Proxy.rawString (/some/path/to/client.ts:XX:XX:14) + at async Object.send (/some/path/to/gql.ts:XX:XX:26) at async (/some/path/to/anyware_slot_slot-body__slot-search-params.ts:XX:XX:16) { context: { hookName: 'pack', source: 'implementation' }, cause: Error: Unexpected null value. diff --git a/website/content/_snippets/examples/anyware/slot-search-params.md b/website/content/_snippets/examples/anyware/slot-search-params.md index bd2469fe..bc6f9c22 100644 --- a/website/content/_snippets/examples/anyware/slot-search-params.md +++ b/website/content/_snippets/examples/anyware/slot-search-params.md @@ -20,17 +20,15 @@ const graffle = Graffle }) }) -const result = await graffle.rawString({ - document: ` +const result = await graffle.gql` query trainers { pokemon { name } } query pokemon { trainers { name } } - `, - operationName: `queryCountries`, -}) + ` + .send(`queryCountries`) console.log(result) ``` @@ -47,10 +45,7 @@ ContextualError: There was an error in the core implementation of hook "pack". at runPipeline (/some/path/to/runPipeline.ts:XX:XX:18) at async runPipeline (/some/path/to/runPipeline.ts:XX:XX:14) at async Object.run (/some/path/to/main.ts:XX:XX:22) - at async run (/some/path/to/client.ts:XX:XX:20) - at async runRaw (/some/path/to/client.ts:XX:XX:12) - at async Object.raw (/some/path/to/client.ts:XX:XX:14) - at async Proxy.rawString (/some/path/to/client.ts:XX:XX:14) + at async Object.send (/some/path/to/gql.ts:XX:XX:26) at async (/some/path/to/anyware_slot_slot-body__slot-search-params.ts:XX:XX:16) { context: { hookName: 'pack', source: 'implementation' }, cause: Error: Unexpected null value. diff --git a/website/content/_snippets/examples/extension/opentelemetry.detail.md b/website/content/_snippets/examples/extension/opentelemetry.detail.md index a957caf5..755bc177 100644 --- a/website/content/_snippets/examples/extension/opentelemetry.detail.md +++ b/website/content/_snippets/examples/extension/opentelemetry.detail.md @@ -20,7 +20,7 @@ provider.addSpanProcessor(processor) provider.register() const graffle = Pokemon.create().use(Opentelemetry()) -const data = await graffle.rawString({ document: `query { pokemons { name } }` }) +const data = await graffle.gql`query { pokemons { name } }`.send() console.log(data) ``` @@ -37,14 +37,14 @@ console.log(data) } }, instrumentationScope: { name: 'graffle', version: undefined, schemaUrl: undefined }, - traceId: 'd7f120898ea4e086c016a9328aeb4588', - parentId: '8977b7ec1a73aa42', + traceId: '1a56566cbf32cac1ab51f61c2296386d', + parentId: 'e9e71e5ac59a4abf', traceState: undefined, name: 'encode', - id: '5c86f62c08b7f3bd', + id: '5dd0dda86a63442a', kind: 0, - timestamp: 1727803645728000, - duration: 748.709, + timestamp: 1728318378110000, + duration: 592.375, attributes: {}, status: { code: 0 }, events: [], @@ -64,14 +64,14 @@ console.log(data) } }, instrumentationScope: { name: 'graffle', version: undefined, schemaUrl: undefined }, - traceId: 'd7f120898ea4e086c016a9328aeb4588', - parentId: '8977b7ec1a73aa42', + traceId: '1a56566cbf32cac1ab51f61c2296386d', + parentId: 'e9e71e5ac59a4abf', traceState: undefined, name: 'pack', - id: 'ac44e7f088223e59', + id: 'c6a933e2385f4f29', kind: 0, - timestamp: 1727803645732000, - duration: 12910.625, + timestamp: 1728318378112000, + duration: 263004.291, attributes: {}, status: { code: 0 }, events: [], @@ -91,14 +91,14 @@ console.log(data) } }, instrumentationScope: { name: 'graffle', version: undefined, schemaUrl: undefined }, - traceId: 'd7f120898ea4e086c016a9328aeb4588', - parentId: '8977b7ec1a73aa42', + traceId: '1a56566cbf32cac1ab51f61c2296386d', + parentId: 'e9e71e5ac59a4abf', traceState: undefined, name: 'exchange', - id: '07c6d24729766b4d', + id: '99259acfe1a55e81', kind: 0, - timestamp: 1727803645745000, - duration: 21332.375, + timestamp: 1728318378377000, + duration: 46421.75, attributes: {}, status: { code: 0 }, events: [], @@ -118,14 +118,14 @@ console.log(data) } }, instrumentationScope: { name: 'graffle', version: undefined, schemaUrl: undefined }, - traceId: 'd7f120898ea4e086c016a9328aeb4588', - parentId: '8977b7ec1a73aa42', + traceId: '1a56566cbf32cac1ab51f61c2296386d', + parentId: 'e9e71e5ac59a4abf', traceState: undefined, name: 'unpack', - id: '14366c75d72eb1d4', + id: '0cef5ce8392b53a8', kind: 0, - timestamp: 1727803645767000, - duration: 1140.625, + timestamp: 1728318378424000, + duration: 1580.666, attributes: {}, status: { code: 0 }, events: [], @@ -145,14 +145,14 @@ console.log(data) } }, instrumentationScope: { name: 'graffle', version: undefined, schemaUrl: undefined }, - traceId: 'd7f120898ea4e086c016a9328aeb4588', - parentId: '8977b7ec1a73aa42', + traceId: '1a56566cbf32cac1ab51f61c2296386d', + parentId: 'e9e71e5ac59a4abf', traceState: undefined, name: 'decode', - id: 'e89206579d516345', + id: '8e7ed7776dfe35b5', kind: 0, - timestamp: 1727803645768000, - duration: 192.958, + timestamp: 1728318378426000, + duration: 207.167, attributes: {}, status: { code: 0 }, events: [], @@ -172,14 +172,14 @@ console.log(data) } }, instrumentationScope: { name: 'graffle', version: undefined, schemaUrl: undefined }, - traceId: 'd7f120898ea4e086c016a9328aeb4588', + traceId: '1a56566cbf32cac1ab51f61c2296386d', parentId: undefined, traceState: undefined, name: 'request', - id: '8977b7ec1a73aa42', + id: 'e9e71e5ac59a4abf', kind: 0, - timestamp: 1727803645728000, - duration: 40803.792, + timestamp: 1728318378109000, + duration: 316401.583, attributes: {}, status: { code: 0 }, events: [], diff --git a/website/content/_snippets/examples/extension/opentelemetry.md b/website/content/_snippets/examples/extension/opentelemetry.md index d0e14fbf..50e32af3 100644 --- a/website/content/_snippets/examples/extension/opentelemetry.md +++ b/website/content/_snippets/examples/extension/opentelemetry.md @@ -18,7 +18,7 @@ provider.addSpanProcessor(processor) provider.register() const graffle = Pokemon.create().use(Opentelemetry()) -const data = await graffle.rawString({ document: `query { pokemons { name } }` }) +const data = await graffle.gql`query { pokemons { name } }`.send() console.log(data) ``` @@ -35,14 +35,14 @@ console.log(data) } }, instrumentationScope: { name: 'graffle', version: undefined, schemaUrl: undefined }, - traceId: 'd7f120898ea4e086c016a9328aeb4588', - parentId: '8977b7ec1a73aa42', + traceId: '1a56566cbf32cac1ab51f61c2296386d', + parentId: 'e9e71e5ac59a4abf', traceState: undefined, name: 'encode', - id: '5c86f62c08b7f3bd', + id: '5dd0dda86a63442a', kind: 0, - timestamp: 1727803645728000, - duration: 748.709, + timestamp: 1728318378110000, + duration: 592.375, attributes: {}, status: { code: 0 }, events: [], @@ -62,14 +62,14 @@ console.log(data) } }, instrumentationScope: { name: 'graffle', version: undefined, schemaUrl: undefined }, - traceId: 'd7f120898ea4e086c016a9328aeb4588', - parentId: '8977b7ec1a73aa42', + traceId: '1a56566cbf32cac1ab51f61c2296386d', + parentId: 'e9e71e5ac59a4abf', traceState: undefined, name: 'pack', - id: 'ac44e7f088223e59', + id: 'c6a933e2385f4f29', kind: 0, - timestamp: 1727803645732000, - duration: 12910.625, + timestamp: 1728318378112000, + duration: 263004.291, attributes: {}, status: { code: 0 }, events: [], @@ -89,14 +89,14 @@ console.log(data) } }, instrumentationScope: { name: 'graffle', version: undefined, schemaUrl: undefined }, - traceId: 'd7f120898ea4e086c016a9328aeb4588', - parentId: '8977b7ec1a73aa42', + traceId: '1a56566cbf32cac1ab51f61c2296386d', + parentId: 'e9e71e5ac59a4abf', traceState: undefined, name: 'exchange', - id: '07c6d24729766b4d', + id: '99259acfe1a55e81', kind: 0, - timestamp: 1727803645745000, - duration: 21332.375, + timestamp: 1728318378377000, + duration: 46421.75, attributes: {}, status: { code: 0 }, events: [], @@ -116,14 +116,14 @@ console.log(data) } }, instrumentationScope: { name: 'graffle', version: undefined, schemaUrl: undefined }, - traceId: 'd7f120898ea4e086c016a9328aeb4588', - parentId: '8977b7ec1a73aa42', + traceId: '1a56566cbf32cac1ab51f61c2296386d', + parentId: 'e9e71e5ac59a4abf', traceState: undefined, name: 'unpack', - id: '14366c75d72eb1d4', + id: '0cef5ce8392b53a8', kind: 0, - timestamp: 1727803645767000, - duration: 1140.625, + timestamp: 1728318378424000, + duration: 1580.666, attributes: {}, status: { code: 0 }, events: [], @@ -143,14 +143,14 @@ console.log(data) } }, instrumentationScope: { name: 'graffle', version: undefined, schemaUrl: undefined }, - traceId: 'd7f120898ea4e086c016a9328aeb4588', - parentId: '8977b7ec1a73aa42', + traceId: '1a56566cbf32cac1ab51f61c2296386d', + parentId: 'e9e71e5ac59a4abf', traceState: undefined, name: 'decode', - id: 'e89206579d516345', + id: '8e7ed7776dfe35b5', kind: 0, - timestamp: 1727803645768000, - duration: 192.958, + timestamp: 1728318378426000, + duration: 207.167, attributes: {}, status: { code: 0 }, events: [], @@ -170,14 +170,14 @@ console.log(data) } }, instrumentationScope: { name: 'graffle', version: undefined, schemaUrl: undefined }, - traceId: 'd7f120898ea4e086c016a9328aeb4588', + traceId: '1a56566cbf32cac1ab51f61c2296386d', parentId: undefined, traceState: undefined, name: 'request', - id: '8977b7ec1a73aa42', + id: 'e9e71e5ac59a4abf', kind: 0, - timestamp: 1727803645728000, - duration: 40803.792, + timestamp: 1728318378109000, + duration: 316401.583, attributes: {}, status: { code: 0 }, events: [], diff --git a/website/content/_snippets/examples/generated/document.detail.md b/website/content/_snippets/examples/generated/document.detail.md index 1b0477c0..d7479c82 100644 --- a/website/content/_snippets/examples/generated/document.detail.md +++ b/website/content/_snippets/examples/generated/document.detail.md @@ -31,11 +31,11 @@ const pokemons = await pokemon.document({ makeSomeNewPokemons: { addPokemon: [ [`addAngryPikachu`, { - $: { name: `AngryPikachu`, attack: 100, defense: 100, hp: 100, type: `electric` }, + $: { name: `AngryPikachu`, attack: 100, defense: 100, hp: 100, $type: `electric` }, name: true, }], [`addAngryCharizard`, { - $: { name: `AngryCharizard`, attack: 100, defense: 100, hp: 100, type: `fire` }, + $: { name: `AngryCharizard`, attack: 100, defense: 100, hp: 100, $type: `fire` }, name: true, }], ], diff --git a/website/content/_snippets/examples/generated/document.md b/website/content/_snippets/examples/generated/document.md index fe7ed3c6..12f9048b 100644 --- a/website/content/_snippets/examples/generated/document.md +++ b/website/content/_snippets/examples/generated/document.md @@ -29,11 +29,11 @@ const pokemons = await pokemon.document({ makeSomeNewPokemons: { addPokemon: [ [`addAngryPikachu`, { - $: { name: `AngryPikachu`, attack: 100, defense: 100, hp: 100, type: `electric` }, + $: { name: `AngryPikachu`, attack: 100, defense: 100, hp: 100, $type: `electric` }, name: true, }], [`addAngryCharizard`, { - $: { name: `AngryCharizard`, attack: 100, defense: 100, hp: 100, type: `fire` }, + $: { name: `AngryCharizard`, attack: 100, defense: 100, hp: 100, $type: `fire` }, name: true, }], ], diff --git a/website/content/_snippets/examples/gql/gql-document-node-typed.detail.md b/website/content/_snippets/examples/gql/gql-document-node-typed.detail.md new file mode 100644 index 00000000..a2a16b91 --- /dev/null +++ b/website/content/_snippets/examples/gql/gql-document-node-typed.detail.md @@ -0,0 +1,64 @@ +::: details Example + +
+Gql Document Node Typed + + +```ts twoslash +import { parse, type TypedQueryDocumentNode } from 'graphql' +import { Graffle } from 'graffle' + +const graffle = Graffle.create({ + schema: `http://localhost:3000/graphql`, +}) + +type Document = TypedQueryDocumentNode< + { + pokemonByName: { + id: string + name: string + hp: number + attack: number + defense: number + trainer: { name: string } + } + }, + { name: string } +> + +const document = parse(` + query ($name: String!) { + pokemonByName (name: $name) { + name + hp + attack + defense + trainer { + name + } + } + } + `) as Document + +const data = await graffle.gql(document).send({ name: `Pikachu` }) + +console.log(data?.pokemonByName) +``` + + + +```txt +[ + { + name: 'Pikachu', + hp: 35, + attack: 55, + defense: 40, + trainer: { name: 'Ash' } + } +] +``` + + +
+::: diff --git a/website/content/_snippets/examples/gql/gql-document-node-typed.md b/website/content/_snippets/examples/gql/gql-document-node-typed.md new file mode 100644 index 00000000..ee5e7a39 --- /dev/null +++ b/website/content/_snippets/examples/gql/gql-document-node-typed.md @@ -0,0 +1,61 @@ +
+Gql Document Node Typed + + +```ts twoslash +import { parse, type TypedQueryDocumentNode } from 'graphql' +import { Graffle } from 'graffle' + +const graffle = Graffle.create({ + schema: `http://localhost:3000/graphql`, +}) + +type Document = TypedQueryDocumentNode< + { + pokemonByName: { + id: string + name: string + hp: number + attack: number + defense: number + trainer: { name: string } + } + }, + { name: string } +> + +const document = parse(` + query ($name: String!) { + pokemonByName (name: $name) { + name + hp + attack + defense + trainer { + name + } + } + } + `) as Document + +const data = await graffle.gql(document).send({ name: `Pikachu` }) + +console.log(data?.pokemonByName) +``` + + + +```txt +[ + { + name: 'Pikachu', + hp: 35, + attack: 55, + defense: 40, + trainer: { name: 'Ash' } + } +] +``` + + +
diff --git a/website/content/_snippets/examples/gql/gql-document-node.detail.md b/website/content/_snippets/examples/gql/gql-document-node.detail.md new file mode 100644 index 00000000..55018f97 --- /dev/null +++ b/website/content/_snippets/examples/gql/gql-document-node.detail.md @@ -0,0 +1,42 @@ +::: details Example + +
+Gql Document Node + + +```ts twoslash +import { parse } from 'graphql' +import { Opentelemetry, Throws } from 'graffle/extensions' +import { Graffle } from 'graffle' + +const graffle = Graffle.create({ + schema: `http://localhost:3000/graphql`, +}) + .use(Throws()) + .use(Opentelemetry()) + +const data = await graffle.gql(parse(` + query pokemonByName ($name: String!) { + pokemonByName (name: $name) { + name + trainer { + name + } + } + } +`)).send({ name: `Pikachu` }) + +console.log(data) +``` + + + +```txt +{ + pokemonByName: [ { name: 'Pikachu', trainer: { name: 'Ash' } } ] +} +``` + + +
+::: diff --git a/website/content/_snippets/examples/gql/gql-document-node.md b/website/content/_snippets/examples/gql/gql-document-node.md new file mode 100644 index 00000000..af65235d --- /dev/null +++ b/website/content/_snippets/examples/gql/gql-document-node.md @@ -0,0 +1,39 @@ +
+Gql Document Node + + +```ts twoslash +import { parse } from 'graphql' +import { Opentelemetry, Throws } from 'graffle/extensions' +import { Graffle } from 'graffle' + +const graffle = Graffle.create({ + schema: `http://localhost:3000/graphql`, +}) + .use(Throws()) + .use(Opentelemetry()) + +const data = await graffle.gql(parse(` + query pokemonByName ($name: String!) { + pokemonByName (name: $name) { + name + trainer { + name + } + } + } +`)).send({ name: `Pikachu` }) + +console.log(data) +``` + + + +```txt +{ + pokemonByName: [ { name: 'Pikachu', trainer: { name: 'Ash' } } ] +} +``` + + +
diff --git a/website/content/_snippets/examples/raw/raw-string-typed.detail.md b/website/content/_snippets/examples/gql/gql-string-typed.detail.md similarity index 81% rename from website/content/_snippets/examples/raw/raw-string-typed.detail.md rename to website/content/_snippets/examples/gql/gql-string-typed.detail.md index 4f869e1f..6f78a870 100644 --- a/website/content/_snippets/examples/raw/raw-string-typed.detail.md +++ b/website/content/_snippets/examples/gql/gql-string-typed.detail.md @@ -1,11 +1,11 @@ ::: details Example
-Raw String Typed +Gql String Typed ```ts twoslash -import { Graffle, type TypedDocumentString } from 'graffle' +import { Graffle, type TypedDocument } from 'graffle' const graffle = Graffle.create({ schema: `http://localhost:3000/graphql`, @@ -17,7 +17,7 @@ const graffle = Graffle.create({ * @see https://the-guild.dev/graphql/codegen/plugins/presets/preset-client#documentmode * @see https://github.com/jasonkuhrt/graffle/issues/997 */ -type Document = TypedDocumentString< +type Document = TypedDocument.String< { pokemonByName: { id: string @@ -47,10 +47,7 @@ const document: Document = /* gql */ ` } ` -const data = await graffle.rawString({ - document, - variables: { name: `Pikachu` }, -}) +const data = await graffle.gql(document).send({ name: `Pikachu` }) console.log(data?.pokemonByName) ``` diff --git a/website/content/_snippets/examples/raw/raw-string-typed.md b/website/content/_snippets/examples/gql/gql-string-typed.md similarity index 81% rename from website/content/_snippets/examples/raw/raw-string-typed.md rename to website/content/_snippets/examples/gql/gql-string-typed.md index 4f40b35c..f5b2def1 100644 --- a/website/content/_snippets/examples/raw/raw-string-typed.md +++ b/website/content/_snippets/examples/gql/gql-string-typed.md @@ -1,9 +1,9 @@
-Raw String Typed +Gql String Typed ```ts twoslash -import { Graffle, type TypedDocumentString } from 'graffle' +import { Graffle, type TypedDocument } from 'graffle' const graffle = Graffle.create({ schema: `http://localhost:3000/graphql`, @@ -15,7 +15,7 @@ const graffle = Graffle.create({ * @see https://the-guild.dev/graphql/codegen/plugins/presets/preset-client#documentmode * @see https://github.com/jasonkuhrt/graffle/issues/997 */ -type Document = TypedDocumentString< +type Document = TypedDocument.String< { pokemonByName: { id: string @@ -45,10 +45,7 @@ const document: Document = /* gql */ ` } ` -const data = await graffle.rawString({ - document, - variables: { name: `Pikachu` }, -}) +const data = await graffle.gql(document).send({ name: `Pikachu` }) console.log(data?.pokemonByName) ``` diff --git a/website/content/_snippets/examples/raw/raw-string.detail.md b/website/content/_snippets/examples/gql/gql-string.detail.md similarity index 84% rename from website/content/_snippets/examples/raw/raw-string.detail.md rename to website/content/_snippets/examples/gql/gql-string.detail.md index a632d423..ee2cf246 100644 --- a/website/content/_snippets/examples/raw/raw-string.detail.md +++ b/website/content/_snippets/examples/gql/gql-string.detail.md @@ -1,7 +1,7 @@ ::: details Example
-Raw String +Gql String ```ts twoslash @@ -19,7 +19,7 @@ const document = /* gql */ ` } ` -const data = await graffle.rawString({ document }) +const data = await graffle.gql(document).send() console.log(data) ``` diff --git a/website/content/_snippets/examples/raw/raw-string.md b/website/content/_snippets/examples/gql/gql-string.md similarity index 84% rename from website/content/_snippets/examples/raw/raw-string.md rename to website/content/_snippets/examples/gql/gql-string.md index 5eb12092..19369a71 100644 --- a/website/content/_snippets/examples/raw/raw-string.md +++ b/website/content/_snippets/examples/gql/gql-string.md @@ -1,5 +1,5 @@
-Raw String +Gql String ```ts twoslash @@ -17,7 +17,7 @@ const document = /* gql */ ` } ` -const data = await graffle.rawString({ document }) +const data = await graffle.gql(document).send() console.log(data) ``` diff --git a/website/content/_snippets/examples/other/transport-memory.detail.md b/website/content/_snippets/examples/other/transport-memory.detail.md index 1347d4df..a0942f4c 100644 --- a/website/content/_snippets/examples/other/transport-memory.detail.md +++ b/website/content/_snippets/examples/other/transport-memory.detail.md @@ -22,7 +22,11 @@ const schema = new GraphQLSchema({ const graffle = Graffle.create({ schema }) -const data = await graffle.rawString({ document: `{ foo }` }) +const data = await graffle.gql` + { + foo + } +`.send() console.log(data) ``` diff --git a/website/content/_snippets/examples/other/transport-memory.md b/website/content/_snippets/examples/other/transport-memory.md index c75799a4..0e56ec48 100644 --- a/website/content/_snippets/examples/other/transport-memory.md +++ b/website/content/_snippets/examples/other/transport-memory.md @@ -20,7 +20,11 @@ const schema = new GraphQLSchema({ const graffle = Graffle.create({ schema }) -const data = await graffle.rawString({ document: `{ foo }` }) +const data = await graffle.gql` + { + foo + } +`.send() console.log(data) ``` diff --git a/website/content/_snippets/examples/output/envelope-error-throw.detail.md b/website/content/_snippets/examples/output/envelope-error-throw.detail.md index 1b84767f..00d4cdab 100644 --- a/website/content/_snippets/examples/output/envelope-error-throw.detail.md +++ b/website/content/_snippets/examples/output/envelope-error-throw.detail.md @@ -37,9 +37,8 @@ await pokemon.query.pokemons({ name: true }) ContextualError: There was an error in the extension "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 Object.run (/some/path/to/main.ts:XX:XX:22) - at async run (/some/path/to/client.ts:XX:XX:20) - at async executeDocument (/some/path/to/client.ts:XX:XX:12) - at async executeRootTypeField (/some/path/to/client.ts:XX:XX:20) + at async executeDocument (/some/path/to/requestMethods.ts:XX:XX:18) + at async executeRootTypeField (/some/path/to/requestMethods.ts:XX:XX:18) at async (/some/path/to/output_envelope_envelope_error-throw__envelope-error-throw.ts:XX:XX:1) { context: { hookName: 'encode', diff --git a/website/content/_snippets/examples/output/envelope-error-throw.md b/website/content/_snippets/examples/output/envelope-error-throw.md index 4db2494d..7227ff82 100644 --- a/website/content/_snippets/examples/output/envelope-error-throw.md +++ b/website/content/_snippets/examples/output/envelope-error-throw.md @@ -35,9 +35,8 @@ await pokemon.query.pokemons({ name: true }) ContextualError: There was an error in the extension "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 Object.run (/some/path/to/main.ts:XX:XX:22) - at async run (/some/path/to/client.ts:XX:XX:20) - at async executeDocument (/some/path/to/client.ts:XX:XX:12) - at async executeRootTypeField (/some/path/to/client.ts:XX:XX:20) + at async executeDocument (/some/path/to/requestMethods.ts:XX:XX:18) + at async executeRootTypeField (/some/path/to/requestMethods.ts:XX:XX:18) at async (/some/path/to/output_envelope_envelope_error-throw__envelope-error-throw.ts:XX:XX:1) { context: { hookName: 'encode', diff --git a/website/content/_snippets/examples/output/envelope-error.detail.md b/website/content/_snippets/examples/output/envelope-error.detail.md index 96af4f9a..eaf7007a 100644 --- a/website/content/_snippets/examples/output/envelope-error.detail.md +++ b/website/content/_snippets/examples/output/envelope-error.detail.md @@ -37,9 +37,8 @@ console.log(result) ContextualError: There was an error in the extension "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 Object.run (/some/path/to/main.ts:XX:XX:22) - at async run (/some/path/to/client.ts:XX:XX:20) - at async executeDocument (/some/path/to/client.ts:XX:XX:12) - at async executeRootTypeField (/some/path/to/client.ts:XX:XX:20) + at async executeDocument (/some/path/to/requestMethods.ts:XX:XX:18) + at async executeRootTypeField (/some/path/to/requestMethods.ts:XX:XX:18) at async (/some/path/to/output_envelope_envelope-error__envelope-error.ts:XX:XX:16) { context: { hookName: 'encode', diff --git a/website/content/_snippets/examples/output/envelope-error.md b/website/content/_snippets/examples/output/envelope-error.md index cf74b265..19c73782 100644 --- a/website/content/_snippets/examples/output/envelope-error.md +++ b/website/content/_snippets/examples/output/envelope-error.md @@ -35,9 +35,8 @@ console.log(result) ContextualError: There was an error in the extension "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 Object.run (/some/path/to/main.ts:XX:XX:22) - at async run (/some/path/to/client.ts:XX:XX:20) - at async executeDocument (/some/path/to/client.ts:XX:XX:12) - at async executeRootTypeField (/some/path/to/client.ts:XX:XX:20) + at async executeDocument (/some/path/to/requestMethods.ts:XX:XX:18) + at async executeRootTypeField (/some/path/to/requestMethods.ts:XX:XX:18) at async (/some/path/to/output_envelope_envelope-error__envelope-error.ts:XX:XX:16) { context: { hookName: 'encode', diff --git a/website/content/_snippets/examples/output/envelope.detail.md b/website/content/_snippets/examples/output/envelope.detail.md index 1bf8a84e..f3f4bb83 100644 --- a/website/content/_snippets/examples/output/envelope.detail.md +++ b/website/content/_snippets/examples/output/envelope.detail.md @@ -40,7 +40,7 @@ console.log(result) headers: Headers { 'content-type': 'application/graphql-response+json; charset=utf-8', 'content-length': '142', - date: 'Tue, 01 Oct 2024 17:27:25 GMT', + date: 'Mon, 07 Oct 2024 16:26:17 GMT', connection: 'keep-alive', 'keep-alive': 'timeout=5' }, diff --git a/website/content/_snippets/examples/output/envelope.md b/website/content/_snippets/examples/output/envelope.md index f425f51d..4aaae07e 100644 --- a/website/content/_snippets/examples/output/envelope.md +++ b/website/content/_snippets/examples/output/envelope.md @@ -38,7 +38,7 @@ console.log(result) headers: Headers { 'content-type': 'application/graphql-response+json; charset=utf-8', 'content-length': '142', - date: 'Tue, 01 Oct 2024 17:27:25 GMT', + date: 'Mon, 07 Oct 2024 16:26:17 GMT', connection: 'keep-alive', 'keep-alive': 'timeout=5' }, diff --git a/website/content/_snippets/examples/output/return-error-execution.detail.md b/website/content/_snippets/examples/output/return-error-execution.detail.md index b6f4958d..d4b35c7c 100644 --- a/website/content/_snippets/examples/output/return-error-execution.detail.md +++ b/website/content/_snippets/examples/output/return-error-execution.detail.md @@ -22,7 +22,7 @@ const pokemon = Pokemon type _result = typeof result const result = await pokemon.mutation.addPokemon({ - $: { name: ``, hp: 1, defense: 0, attack: 0, type: `water` }, + $: { name: ``, hp: 1, defense: 0, attack: 0, $type: `water` }, // ^^ name: true, }) @@ -47,10 +47,9 @@ try { ```txt ContextualAggregateError: One or more errors in the execution result. at handleOutput (/some/path/to/handleOutput.ts:XX:XX:19) - at run (/some/path/to/client.ts:XX:XX:12) + at executeDocument (/some/path/to/requestMethods.ts:XX:XX:10) at process.processTicksAndRejections (node:internal/process/task_queues:XX:XX) - at async executeDocument (/some/path/to/client.ts:XX:XX:12) - at async executeRootTypeField (/some/path/to/client.ts:XX:XX:20) + at async executeRootTypeField (/some/path/to/requestMethods.ts:XX:XX:18) at async (/some/path/to/output_return-error_return-error-execution__return-error-execution.ts:XX:XX:16) { context: {}, cause: undefined, @@ -88,9 +87,8 @@ ContextualError: There was an error in the extension "anonymous" (use named func at runPipeline (/some/path/to/runPipeline.ts:XX:XX:18) at process.processTicksAndRejections (node:internal/process/task_queues:XX:XX) at async Object.run (/some/path/to/main.ts:XX:XX:22) - at async run (/some/path/to/client.ts:XX:XX:20) - at async executeDocument (/some/path/to/client.ts:XX:XX:12) - at async executeRootTypeField (/some/path/to/client.ts:XX:XX:20) + at async executeDocument (/some/path/to/requestMethods.ts:XX:XX:18) + at async executeRootTypeField (/some/path/to/requestMethods.ts:XX:XX:18) at async (/some/path/to/output_return-error_return-error-execution__return-error-execution.ts:XX:XX:3) { context: { hookName: 'encode', diff --git a/website/content/_snippets/examples/output/return-error-execution.md b/website/content/_snippets/examples/output/return-error-execution.md index 3eb6d9ff..bf1c8e2c 100644 --- a/website/content/_snippets/examples/output/return-error-execution.md +++ b/website/content/_snippets/examples/output/return-error-execution.md @@ -20,7 +20,7 @@ const pokemon = Pokemon type _result = typeof result const result = await pokemon.mutation.addPokemon({ - $: { name: ``, hp: 1, defense: 0, attack: 0, type: `water` }, + $: { name: ``, hp: 1, defense: 0, attack: 0, $type: `water` }, // ^^ name: true, }) @@ -45,10 +45,9 @@ try { ```txt ContextualAggregateError: One or more errors in the execution result. at handleOutput (/some/path/to/handleOutput.ts:XX:XX:19) - at run (/some/path/to/client.ts:XX:XX:12) + at executeDocument (/some/path/to/requestMethods.ts:XX:XX:10) at process.processTicksAndRejections (node:internal/process/task_queues:XX:XX) - at async executeDocument (/some/path/to/client.ts:XX:XX:12) - at async executeRootTypeField (/some/path/to/client.ts:XX:XX:20) + at async executeRootTypeField (/some/path/to/requestMethods.ts:XX:XX:18) at async (/some/path/to/output_return-error_return-error-execution__return-error-execution.ts:XX:XX:16) { context: {}, cause: undefined, @@ -86,9 +85,8 @@ ContextualError: There was an error in the extension "anonymous" (use named func at runPipeline (/some/path/to/runPipeline.ts:XX:XX:18) at process.processTicksAndRejections (node:internal/process/task_queues:XX:XX) at async Object.run (/some/path/to/main.ts:XX:XX:22) - at async run (/some/path/to/client.ts:XX:XX:20) - at async executeDocument (/some/path/to/client.ts:XX:XX:12) - at async executeRootTypeField (/some/path/to/client.ts:XX:XX:20) + at async executeDocument (/some/path/to/requestMethods.ts:XX:XX:18) + at async executeRootTypeField (/some/path/to/requestMethods.ts:XX:XX:18) at async (/some/path/to/output_return-error_return-error-execution__return-error-execution.ts:XX:XX:3) { context: { hookName: 'encode', diff --git a/website/content/_snippets/examples/output/return-error.detail.md b/website/content/_snippets/examples/output/return-error.detail.md index 99c1d334..ad10679b 100644 --- a/website/content/_snippets/examples/output/return-error.detail.md +++ b/website/content/_snippets/examples/output/return-error.detail.md @@ -34,9 +34,8 @@ console.log(pokemons) ContextualError: There was an error in the extension "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 Object.run (/some/path/to/main.ts:XX:XX:22) - at async run (/some/path/to/client.ts:XX:XX:20) - at async executeDocument (/some/path/to/client.ts:XX:XX:12) - at async executeRootTypeField (/some/path/to/client.ts:XX:XX:20) + at async executeDocument (/some/path/to/requestMethods.ts:XX:XX:18) + at async executeRootTypeField (/some/path/to/requestMethods.ts:XX:XX:18) at async (/some/path/to/output_return-error.ts:XX:XX:18) { context: { hookName: 'encode', diff --git a/website/content/_snippets/examples/output/return-error.md b/website/content/_snippets/examples/output/return-error.md index fb46cbf7..9f0f0f1f 100644 --- a/website/content/_snippets/examples/output/return-error.md +++ b/website/content/_snippets/examples/output/return-error.md @@ -32,9 +32,8 @@ console.log(pokemons) ContextualError: There was an error in the extension "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 Object.run (/some/path/to/main.ts:XX:XX:22) - at async run (/some/path/to/client.ts:XX:XX:20) - at async executeDocument (/some/path/to/client.ts:XX:XX:12) - at async executeRootTypeField (/some/path/to/client.ts:XX:XX:20) + at async executeDocument (/some/path/to/requestMethods.ts:XX:XX:18) + at async executeRootTypeField (/some/path/to/requestMethods.ts:XX:XX:18) at async (/some/path/to/output_return-error.ts:XX:XX:18) { context: { hookName: 'encode', diff --git a/website/content/_snippets/examples/output/standard-graphql.detail.md b/website/content/_snippets/examples/output/standard-graphql.detail.md index 095e3357..d4f12f68 100644 --- a/website/content/_snippets/examples/output/standard-graphql.detail.md +++ b/website/content/_snippets/examples/output/standard-graphql.detail.md @@ -12,7 +12,7 @@ const graffle = Graffle.create({ output: Preset.traditionalGraphqlOutput, }) -const result = await graffle.rawString({ document: `{ query { thisWillError } }` }) +const result = await graffle.gql(`{ query { thisWillError } }`).send() console.log(result) ``` @@ -29,17 +29,14 @@ ContextualError: There was an error in the core implementation of hook "exchange at runPipeline (/some/path/to/runPipeline.ts:XX:XX:18) at async runPipeline (/some/path/to/runPipeline.ts:XX:XX:14) at async runPipeline (/some/path/to/runPipeline.ts:XX:XX:14) - ... 3 lines matching cause stack trace ... - at async Object.raw (/some/path/to/client.ts:XX:XX:14) - at async Proxy.rawString (/some/path/to/client.ts:XX:XX:14) + ... 2 lines matching cause stack trace ... at async (/some/path/to/output_preset__standard-graphql.ts:XX:XX:16) { context: { hookName: 'exchange', source: 'implementation' }, [cause]: TypeError: Failed to parse URL from ... at new Request (node:internal/deps/undici/undici:XX:XX) at Object.run (/some/path/to/core.ts:XX:XX:29) ... 6 lines matching cause stack trace ... - at async runRaw (/some/path/to/client.ts:XX:XX:12) - at async Object.raw (/some/path/to/client.ts:XX:XX:14) { + at async (/some/path/to/output_preset__standard-graphql.ts:XX:XX:16) { [cause]: TypeError: Invalid URL at new URL (node:internal/url:XX:XX) at new Request (node:internal/deps/undici/undici:XX:XX) @@ -49,8 +46,8 @@ ContextualError: There was an error in the core implementation of hook "exchange at runPipeline (/some/path/to/runPipeline.ts:XX:XX:20) at async runPipeline (/some/path/to/runPipeline.ts:XX:XX:14) at async Object.run (/some/path/to/main.ts:XX:XX:22) - at async run (/some/path/to/client.ts:XX:XX:20) - at async runRaw (/some/path/to/client.ts:XX:XX:12) { + at async Object.send (/some/path/to/gql.ts:XX:XX:26) + at async (/some/path/to/output_preset__standard-graphql.ts:XX:XX:16) { code: 'ERR_INVALID_URL', input: '...' } diff --git a/website/content/_snippets/examples/output/standard-graphql.md b/website/content/_snippets/examples/output/standard-graphql.md index c8c7a359..0ec75a9d 100644 --- a/website/content/_snippets/examples/output/standard-graphql.md +++ b/website/content/_snippets/examples/output/standard-graphql.md @@ -10,7 +10,7 @@ const graffle = Graffle.create({ output: Preset.traditionalGraphqlOutput, }) -const result = await graffle.rawString({ document: `{ query { thisWillError } }` }) +const result = await graffle.gql(`{ query { thisWillError } }`).send() console.log(result) ``` @@ -27,17 +27,14 @@ ContextualError: There was an error in the core implementation of hook "exchange at runPipeline (/some/path/to/runPipeline.ts:XX:XX:18) at async runPipeline (/some/path/to/runPipeline.ts:XX:XX:14) at async runPipeline (/some/path/to/runPipeline.ts:XX:XX:14) - ... 3 lines matching cause stack trace ... - at async Object.raw (/some/path/to/client.ts:XX:XX:14) - at async Proxy.rawString (/some/path/to/client.ts:XX:XX:14) + ... 2 lines matching cause stack trace ... at async (/some/path/to/output_preset__standard-graphql.ts:XX:XX:16) { context: { hookName: 'exchange', source: 'implementation' }, [cause]: TypeError: Failed to parse URL from ... at new Request (node:internal/deps/undici/undici:XX:XX) at Object.run (/some/path/to/core.ts:XX:XX:29) ... 6 lines matching cause stack trace ... - at async runRaw (/some/path/to/client.ts:XX:XX:12) - at async Object.raw (/some/path/to/client.ts:XX:XX:14) { + at async (/some/path/to/output_preset__standard-graphql.ts:XX:XX:16) { [cause]: TypeError: Invalid URL at new URL (node:internal/url:XX:XX) at new Request (node:internal/deps/undici/undici:XX:XX) @@ -47,8 +44,8 @@ ContextualError: There was an error in the core implementation of hook "exchange at runPipeline (/some/path/to/runPipeline.ts:XX:XX:20) at async runPipeline (/some/path/to/runPipeline.ts:XX:XX:14) at async Object.run (/some/path/to/main.ts:XX:XX:22) - at async run (/some/path/to/client.ts:XX:XX:20) - at async runRaw (/some/path/to/client.ts:XX:XX:12) { + at async Object.send (/some/path/to/gql.ts:XX:XX:26) + at async (/some/path/to/output_preset__standard-graphql.ts:XX:XX:16) { code: 'ERR_INVALID_URL', input: '...' } diff --git a/website/content/_snippets/examples/raw/raw-document-node-typed.detail.md b/website/content/_snippets/examples/raw/raw-document-node-typed.detail.md deleted file mode 100644 index 498df293..00000000 --- a/website/content/_snippets/examples/raw/raw-document-node-typed.detail.md +++ /dev/null @@ -1,127 +0,0 @@ -::: details Example - -
-Raw Document Node Typed - - -```ts twoslash -import type { TypedQueryDocumentNode } from 'graphql' -import { gql, Graffle } from 'graffle' - -const graffle = Graffle.create({ - schema: `http://localhost:3000/graphql`, -}) - -/*************************************** Variation 1 *************************************** - * - - * - - * - - * You can pass type variables to the `gql` template tag. - * - - */ - -{ - const document = gql< - { - pokemonByName: { - id: string - name: string - hp: number - attack: number - defense: number - trainer: { name: string } - } - }, - { name: string } - >` - query ($name: String!) { - pokemonByName (name: $name) { - name - hp - attack - defense - trainer { - name - } - } - } - ` - - const data = await graffle.raw({ document, variables: { name: `Pikachu` } }) - - console.log(data?.pokemonByName) -} - -/*************************************** Variation 2 *************************************** - * - - * - - * - - * You can also cast the type if you have a reference to a pre constructed type. - * - - */ - -{ - type Document = TypedQueryDocumentNode< - { - pokemonByName: { - id: string - name: string - hp: number - attack: number - defense: number - trainer: { name: string } - } - }, - { name: string } - > - - const document: Document = gql` - query ($name: String!) { - pokemonByName (name: $name) { - name - hp - attack - defense - trainer { - name - } - } - } - ` - - const data = await graffle.raw({ document, variables: { name: `Pikachu` } }) - - console.log(data?.pokemonByName) -} -``` - - - -```txt -[ - { - name: 'Pikachu', - hp: 35, - attack: 55, - defense: 40, - trainer: { name: 'Ash' } - } -] -``` - - -```txt -[ - { - name: 'Pikachu', - hp: 35, - attack: 55, - defense: 40, - trainer: { name: 'Ash' } - } -] -``` - - -
-::: diff --git a/website/content/_snippets/examples/raw/raw-document-node-typed.md b/website/content/_snippets/examples/raw/raw-document-node-typed.md deleted file mode 100644 index 75429b5f..00000000 --- a/website/content/_snippets/examples/raw/raw-document-node-typed.md +++ /dev/null @@ -1,124 +0,0 @@ -
-Raw Document Node Typed - - -```ts twoslash -import type { TypedQueryDocumentNode } from 'graphql' -import { gql, Graffle } from 'graffle' - -const graffle = Graffle.create({ - schema: `http://localhost:3000/graphql`, -}) - -/*************************************** Variation 1 *************************************** - * - - * - - * - - * You can pass type variables to the `gql` template tag. - * - - */ - -{ - const document = gql< - { - pokemonByName: { - id: string - name: string - hp: number - attack: number - defense: number - trainer: { name: string } - } - }, - { name: string } - >` - query ($name: String!) { - pokemonByName (name: $name) { - name - hp - attack - defense - trainer { - name - } - } - } - ` - - const data = await graffle.raw({ document, variables: { name: `Pikachu` } }) - - console.log(data?.pokemonByName) -} - -/*************************************** Variation 2 *************************************** - * - - * - - * - - * You can also cast the type if you have a reference to a pre constructed type. - * - - */ - -{ - type Document = TypedQueryDocumentNode< - { - pokemonByName: { - id: string - name: string - hp: number - attack: number - defense: number - trainer: { name: string } - } - }, - { name: string } - > - - const document: Document = gql` - query ($name: String!) { - pokemonByName (name: $name) { - name - hp - attack - defense - trainer { - name - } - } - } - ` - - const data = await graffle.raw({ document, variables: { name: `Pikachu` } }) - - console.log(data?.pokemonByName) -} -``` - - - -```txt -[ - { - name: 'Pikachu', - hp: 35, - attack: 55, - defense: 40, - trainer: { name: 'Ash' } - } -] -``` - - -```txt -[ - { - name: 'Pikachu', - hp: 35, - attack: 55, - defense: 40, - trainer: { name: 'Ash' } - } -] -``` - - -
diff --git a/website/content/_snippets/examples/raw/raw-document-node.detail.md b/website/content/_snippets/examples/raw/raw-document-node.detail.md deleted file mode 100644 index fab5e302..00000000 --- a/website/content/_snippets/examples/raw/raw-document-node.detail.md +++ /dev/null @@ -1,71 +0,0 @@ -::: details Example - -
-Raw Document Node - - -```ts twoslash -import { Opentelemetry, Throws } from 'graffle/extensions' -import { gql, Graffle } from 'graffle' - -const graffle = Graffle.create({ - schema: `http://localhost:3000/graphql`, -}) - .use(Throws()) - .use(Opentelemetry()) - -const data = await graffle.raw({ - document: gql` - query pokemonByName ($Name: String!) { - pokemonByName (name: $Name) { - name - continent { - name - } - } - } - `, - variables: { name: `Pikachu` }, -}) - -console.log(data) -``` - - - -```txt -/some/path/to/handleOutput.ts:XX:XX - const error = new Errors.ContextualAggregateError( - ^ - - -ContextualAggregateError: One or more errors in the execution result. - at handleOutput (/some/path/to/handleOutput.ts:XX:XX:19) - at run (/some/path/to/client.ts:XX:XX:12) - at process.processTicksAndRejections (node:internal/process/task_queues:XX:XX) - at async runRaw (/some/path/to/client.ts:XX:XX:12) - at async Proxy.raw (/some/path/to/client.ts:XX:XX:14) - at async (/some/path/to/raw_rawDocumentNode__raw-document-node.ts:XX:XX:14) { - context: {}, - cause: undefined, - errors: [ - GraphQLError: Cannot query field "continent" on type "Pokemon". - at (/some/path/to/graphqlHTTP.ts:XX:XX:47) - at Array.map () - at parseExecutionResult (/some/path/to/graphqlHTTP.ts:XX:XX:28) - at Object.unpack (/some/path/to/core.ts:XX:XX:26) - at process.processTicksAndRejections (node:internal/process/task_queues:XX:XX) - at async runHook (/some/path/to/runHook.ts:XX:XX:16) { - path: undefined, - locations: undefined, - extensions: [Object: null prototype] {} - } - ] -} - -Node.js vXX.XX.XX -``` - - -
-::: diff --git a/website/content/_snippets/examples/raw/raw-document-node.md b/website/content/_snippets/examples/raw/raw-document-node.md deleted file mode 100644 index 25dd12dc..00000000 --- a/website/content/_snippets/examples/raw/raw-document-node.md +++ /dev/null @@ -1,68 +0,0 @@ -
-Raw Document Node - - -```ts twoslash -import { Opentelemetry, Throws } from 'graffle/extensions' -import { gql, Graffle } from 'graffle' - -const graffle = Graffle.create({ - schema: `http://localhost:3000/graphql`, -}) - .use(Throws()) - .use(Opentelemetry()) - -const data = await graffle.raw({ - document: gql` - query pokemonByName ($Name: String!) { - pokemonByName (name: $Name) { - name - continent { - name - } - } - } - `, - variables: { name: `Pikachu` }, -}) - -console.log(data) -``` - - - -```txt -/some/path/to/handleOutput.ts:XX:XX - const error = new Errors.ContextualAggregateError( - ^ - - -ContextualAggregateError: One or more errors in the execution result. - at handleOutput (/some/path/to/handleOutput.ts:XX:XX:19) - at run (/some/path/to/client.ts:XX:XX:12) - at process.processTicksAndRejections (node:internal/process/task_queues:XX:XX) - at async runRaw (/some/path/to/client.ts:XX:XX:12) - at async Proxy.raw (/some/path/to/client.ts:XX:XX:14) - at async (/some/path/to/raw_rawDocumentNode__raw-document-node.ts:XX:XX:14) { - context: {}, - cause: undefined, - errors: [ - GraphQLError: Cannot query field "continent" on type "Pokemon". - at (/some/path/to/graphqlHTTP.ts:XX:XX:47) - at Array.map () - at parseExecutionResult (/some/path/to/graphqlHTTP.ts:XX:XX:28) - at Object.unpack (/some/path/to/core.ts:XX:XX:26) - at process.processTicksAndRejections (node:internal/process/task_queues:XX:XX) - at async runHook (/some/path/to/runHook.ts:XX:XX:16) { - path: undefined, - locations: undefined, - extensions: [Object: null prototype] {} - } - ] -} - -Node.js vXX.XX.XX -``` - - -
diff --git a/website/content/_snippets/examples/transport-http/abort.detail.md b/website/content/_snippets/examples/transport-http/abort.detail.md index 16ee55d7..48b82e02 100644 --- a/website/content/_snippets/examples/transport-http/abort.detail.md +++ b/website/content/_snippets/examples/transport-http/abort.detail.md @@ -17,15 +17,14 @@ const graffle = Graffle.create({ const resultPromise = graffle .with({ transport: { signal: abortController.signal } }) // ^^^^^^^^^^^^^^^ - .rawString({ - document: ` - { - pokemon { - name - } + .gql` + { + pokemon { + name } - `, - }) + } + ` + .send() abortController.abort() // ^^^^^ diff --git a/website/content/_snippets/examples/transport-http/abort.md b/website/content/_snippets/examples/transport-http/abort.md index ea8ab351..56e8ef9c 100644 --- a/website/content/_snippets/examples/transport-http/abort.md +++ b/website/content/_snippets/examples/transport-http/abort.md @@ -15,15 +15,14 @@ const graffle = Graffle.create({ const resultPromise = graffle .with({ transport: { signal: abortController.signal } }) // ^^^^^^^^^^^^^^^ - .rawString({ - document: ` - { - pokemon { - name - } + .gql` + { + pokemon { + name } - `, - }) + } + ` + .send() abortController.abort() // ^^^^^ diff --git a/website/content/_snippets/examples/transport-http/custom-fetch.detail.md b/website/content/_snippets/examples/transport-http/custom-fetch.detail.md index 3a686682..65783270 100644 --- a/website/content/_snippets/examples/transport-http/custom-fetch.detail.md +++ b/website/content/_snippets/examples/transport-http/custom-fetch.detail.md @@ -19,7 +19,7 @@ const graffle = Graffle }) ) -const data = await graffle.rawString({ document: `{ pokemon { name } }` }) +const data = await graffle.gql`{ pokemon { name } }`.send() console.log(data) ``` diff --git a/website/content/_snippets/examples/transport-http/custom-fetch.md b/website/content/_snippets/examples/transport-http/custom-fetch.md index a3df4bed..79870556 100644 --- a/website/content/_snippets/examples/transport-http/custom-fetch.md +++ b/website/content/_snippets/examples/transport-http/custom-fetch.md @@ -17,7 +17,7 @@ const graffle = Graffle }) ) -const data = await graffle.rawString({ document: `{ pokemon { name } }` }) +const data = await graffle.gql`{ pokemon { name } }`.send() console.log(data) ``` diff --git a/website/content/_snippets/examples/transport-http/dynamic-headers.detail.md b/website/content/_snippets/examples/transport-http/dynamic-headers.detail.md index 840f838e..7e682007 100644 --- a/website/content/_snippets/examples/transport-http/dynamic-headers.detail.md +++ b/website/content/_snippets/examples/transport-http/dynamic-headers.detail.md @@ -27,7 +27,7 @@ const graffle = Graffle return exchange() }) -await graffle.rawString({ document: `{ pokemons { name } }` }) +await graffle.gql`{ pokemons { name } }`.send() ``` @@ -38,7 +38,7 @@ await graffle.rawString({ document: `{ pokemons { name } }` }) headers: Headers { accept: 'application/graphql-response+json; charset=utf-8, application/json; charset=utf-8', 'content-type': 'application/json', - 'x-sent-at-time': '1727803644880' + 'x-sent-at-time': '1728318376823' }, signal: undefined, method: 'post', diff --git a/website/content/_snippets/examples/transport-http/dynamic-headers.md b/website/content/_snippets/examples/transport-http/dynamic-headers.md index feaecf02..255acdf7 100644 --- a/website/content/_snippets/examples/transport-http/dynamic-headers.md +++ b/website/content/_snippets/examples/transport-http/dynamic-headers.md @@ -25,7 +25,7 @@ const graffle = Graffle return exchange() }) -await graffle.rawString({ document: `{ pokemons { name } }` }) +await graffle.gql`{ pokemons { name } }`.send() ``` @@ -36,7 +36,7 @@ await graffle.rawString({ document: `{ pokemons { name } }` }) headers: Headers { accept: 'application/graphql-response+json; charset=utf-8, application/json; charset=utf-8', 'content-type': 'application/json', - 'x-sent-at-time': '1727803644880' + 'x-sent-at-time': '1728318376823' }, signal: undefined, method: 'post', diff --git a/website/content/_snippets/examples/transport-http/headers.detail.md b/website/content/_snippets/examples/transport-http/headers.detail.md index 98a16049..8f200a1b 100644 --- a/website/content/_snippets/examples/transport-http/headers.detail.md +++ b/website/content/_snippets/examples/transport-http/headers.detail.md @@ -30,7 +30,7 @@ const graffle = Graffle return exchange() }) -await graffle.rawString({ document: `{ pokemons { name } }` }) +await graffle.gql`{ pokemons { name } }`.send() ``` diff --git a/website/content/_snippets/examples/transport-http/headers.md b/website/content/_snippets/examples/transport-http/headers.md index 8b6c6205..b6c6b001 100644 --- a/website/content/_snippets/examples/transport-http/headers.md +++ b/website/content/_snippets/examples/transport-http/headers.md @@ -28,7 +28,7 @@ const graffle = Graffle return exchange() }) -await graffle.rawString({ document: `{ pokemons { name } }` }) +await graffle.gql`{ pokemons { name } }`.send() ``` diff --git a/website/content/_snippets/examples/transport-http/method-get.detail.md b/website/content/_snippets/examples/transport-http/method-get.detail.md index 9fe10591..064e3a37 100644 --- a/website/content/_snippets/examples/transport-http/method-get.detail.md +++ b/website/content/_snippets/examples/transport-http/method-get.detail.md @@ -21,13 +21,11 @@ const graffle = Pokemon // The following request will use an HTTP POST method because it is // using a "mutation" type of operation. -await graffle.rawString({ - document: `mutation { addPokemon(attack:0, defense:0, hp:1, name:"Nano", type: grass) { name } }`, -}) +await graffle.gql`mutation { addPokemon(attack:0, defense:0, hp:1, name:"Nano", type: grass) { name } }`.send() // The following request will use an HTTP GET method because it // is using a "query" type of operation. -await graffle.rawString({ document: `query { pokemonByName(name: "Nano") { hp } }` }) +await graffle.gql`query { pokemonByName(name: "Nano") { hp } }`.send() ``` diff --git a/website/content/_snippets/examples/transport-http/method-get.md b/website/content/_snippets/examples/transport-http/method-get.md index fdf98dbd..1f82038a 100644 --- a/website/content/_snippets/examples/transport-http/method-get.md +++ b/website/content/_snippets/examples/transport-http/method-get.md @@ -19,13 +19,11 @@ const graffle = Pokemon // The following request will use an HTTP POST method because it is // using a "mutation" type of operation. -await graffle.rawString({ - document: `mutation { addPokemon(attack:0, defense:0, hp:1, name:"Nano", type: grass) { name } }`, -}) +await graffle.gql`mutation { addPokemon(attack:0, defense:0, hp:1, name:"Nano", type: grass) { name } }`.send() // The following request will use an HTTP GET method because it // is using a "query" type of operation. -await graffle.rawString({ document: `query { pokemonByName(name: "Nano") { hp } }` }) +await graffle.gql`query { pokemonByName(name: "Nano") { hp } }`.send() ``` diff --git a/website/content/_snippets/examples/transport-http/raw.detail.md b/website/content/_snippets/examples/transport-http/raw.detail.md index 09e1fe83..748b8f28 100644 --- a/website/content/_snippets/examples/transport-http/raw.detail.md +++ b/website/content/_snippets/examples/transport-http/raw.detail.md @@ -21,7 +21,7 @@ const graffle = Graffle return exchange() }) -await graffle.rawString({ document: `{ pokemons { name } }` }) +await graffle.gql`{ pokemons { name } }`.send() ``` diff --git a/website/content/_snippets/examples/transport-http/raw.md b/website/content/_snippets/examples/transport-http/raw.md index 444181b6..823cd2b6 100644 --- a/website/content/_snippets/examples/transport-http/raw.md +++ b/website/content/_snippets/examples/transport-http/raw.md @@ -19,7 +19,7 @@ const graffle = Graffle return exchange() }) -await graffle.rawString({ document: `{ pokemons { name } }` }) +await graffle.gql`{ pokemons { name } }`.send() ``` diff --git a/website/content/examples/10_transport-http/abort.md b/website/content/examples/10_transport-http/abort.md index 69628215..9cf73592 100644 --- a/website/content/examples/10_transport-http/abort.md +++ b/website/content/examples/10_transport-http/abort.md @@ -20,15 +20,14 @@ const graffle = Graffle.create({ const resultPromise = graffle .with({ transport: { signal: abortController.signal } }) // ^^^^^^^^^^^^^^^ - .rawString({ - document: ` - { - pokemon { - name - } + .gql` + { + pokemon { + name } - `, - }) + } + ` + .send() abortController.abort() // ^^^^^ diff --git a/website/content/examples/10_transport-http/custom-fetch.md b/website/content/examples/10_transport-http/custom-fetch.md index 99bd2883..09ee46b5 100644 --- a/website/content/examples/10_transport-http/custom-fetch.md +++ b/website/content/examples/10_transport-http/custom-fetch.md @@ -22,7 +22,7 @@ const graffle = Graffle }) ) -const data = await graffle.rawString({ document: `{ pokemon { name } }` }) +const data = await graffle.gql`{ pokemon { name } }`.send() console.log(data) ``` diff --git a/website/content/examples/10_transport-http/dynamic-headers.md b/website/content/examples/10_transport-http/dynamic-headers.md index d568b27f..aed27c5e 100644 --- a/website/content/examples/10_transport-http/dynamic-headers.md +++ b/website/content/examples/10_transport-http/dynamic-headers.md @@ -30,7 +30,7 @@ const graffle = Graffle return exchange() }) -await graffle.rawString({ document: `{ pokemons { name } }` }) +await graffle.gql`{ pokemons { name } }`.send() ``` @@ -43,7 +43,7 @@ await graffle.rawString({ document: `{ pokemons { name } }` }) headers: Headers { accept: 'application/graphql-response+json; charset=utf-8, application/json; charset=utf-8', 'content-type': 'application/json', - 'x-sent-at-time': '1727803644880' + 'x-sent-at-time': '1728318376823' }, signal: undefined, method: 'post', diff --git a/website/content/examples/10_transport-http/headers.md b/website/content/examples/10_transport-http/headers.md index 1a903412..b80cd95e 100644 --- a/website/content/examples/10_transport-http/headers.md +++ b/website/content/examples/10_transport-http/headers.md @@ -33,7 +33,7 @@ const graffle = Graffle return exchange() }) -await graffle.rawString({ document: `{ pokemons { name } }` }) +await graffle.gql`{ pokemons { name } }`.send() ``` diff --git a/website/content/examples/10_transport-http/method-get.md b/website/content/examples/10_transport-http/method-get.md index c16095cf..2b6861a2 100644 --- a/website/content/examples/10_transport-http/method-get.md +++ b/website/content/examples/10_transport-http/method-get.md @@ -25,13 +25,11 @@ const graffle = Pokemon // The following request will use an HTTP POST method because it is // using a "mutation" type of operation. -await graffle.rawString({ - document: `mutation { addPokemon(attack:0, defense:0, hp:1, name:"Nano", type: grass) { name } }`, -}) +await graffle.gql`mutation { addPokemon(attack:0, defense:0, hp:1, name:"Nano", type: grass) { name } }`.send() // The following request will use an HTTP GET method because it // is using a "query" type of operation. -await graffle.rawString({ document: `query { pokemonByName(name: "Nano") { hp } }` }) +await graffle.gql`query { pokemonByName(name: "Nano") { hp } }`.send() ``` diff --git a/website/content/examples/10_transport-http/raw.md b/website/content/examples/10_transport-http/raw.md index 4f6ebc68..3bd30147 100644 --- a/website/content/examples/10_transport-http/raw.md +++ b/website/content/examples/10_transport-http/raw.md @@ -24,7 +24,7 @@ const graffle = Graffle return exchange() }) -await graffle.rawString({ document: `{ pokemons { name } }` }) +await graffle.gql`{ pokemons { name } }`.send() ``` diff --git a/website/content/examples/20_output/envelope-error-throw.md b/website/content/examples/20_output/envelope-error-throw.md index 416cde31..87b99d27 100644 --- a/website/content/examples/20_output/envelope-error-throw.md +++ b/website/content/examples/20_output/envelope-error-throw.md @@ -42,9 +42,8 @@ await pokemon.query.pokemons({ name: true }) ContextualError: There was an error in the extension "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 Object.run (/some/path/to/main.ts:XX:XX:22) - at async run (/some/path/to/client.ts:XX:XX:20) - at async executeDocument (/some/path/to/client.ts:XX:XX:12) - at async executeRootTypeField (/some/path/to/client.ts:XX:XX:20) + at async executeDocument (/some/path/to/requestMethods.ts:XX:XX:18) + at async executeRootTypeField (/some/path/to/requestMethods.ts:XX:XX:18) at async (/some/path/to/output_envelope_envelope_error-throw__envelope-error-throw.ts:XX:XX:1) { context: { hookName: 'encode', diff --git a/website/content/examples/20_output/envelope-error.md b/website/content/examples/20_output/envelope-error.md index b7b46e83..3495b1ca 100644 --- a/website/content/examples/20_output/envelope-error.md +++ b/website/content/examples/20_output/envelope-error.md @@ -42,9 +42,8 @@ console.log(result) ContextualError: There was an error in the extension "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 Object.run (/some/path/to/main.ts:XX:XX:22) - at async run (/some/path/to/client.ts:XX:XX:20) - at async executeDocument (/some/path/to/client.ts:XX:XX:12) - at async executeRootTypeField (/some/path/to/client.ts:XX:XX:20) + at async executeDocument (/some/path/to/requestMethods.ts:XX:XX:18) + at async executeRootTypeField (/some/path/to/requestMethods.ts:XX:XX:18) at async (/some/path/to/output_envelope_envelope-error__envelope-error.ts:XX:XX:16) { context: { hookName: 'encode', diff --git a/website/content/examples/20_output/envelope.md b/website/content/examples/20_output/envelope.md index 279d1f79..49379de6 100644 --- a/website/content/examples/20_output/envelope.md +++ b/website/content/examples/20_output/envelope.md @@ -45,7 +45,7 @@ console.log(result) headers: Headers { 'content-type': 'application/graphql-response+json; charset=utf-8', 'content-length': '142', - date: 'Tue, 01 Oct 2024 17:27:25 GMT', + date: 'Mon, 07 Oct 2024 16:26:17 GMT', connection: 'keep-alive', 'keep-alive': 'timeout=5' }, diff --git a/website/content/examples/20_output/return-error-execution.md b/website/content/examples/20_output/return-error-execution.md index cd55b168..8f915482 100644 --- a/website/content/examples/20_output/return-error-execution.md +++ b/website/content/examples/20_output/return-error-execution.md @@ -25,7 +25,7 @@ const pokemon = Pokemon type _result = typeof result const result = await pokemon.mutation.addPokemon({ - $: { name: ``, hp: 1, defense: 0, attack: 0, type: `water` }, + $: { name: ``, hp: 1, defense: 0, attack: 0, $type: `water` }, // ^^ name: true, }) @@ -52,10 +52,9 @@ try { ```txt ContextualAggregateError: One or more errors in the execution result. at handleOutput (/some/path/to/handleOutput.ts:XX:XX:19) - at run (/some/path/to/client.ts:XX:XX:12) + at executeDocument (/some/path/to/requestMethods.ts:XX:XX:10) at process.processTicksAndRejections (node:internal/process/task_queues:XX:XX) - at async executeDocument (/some/path/to/client.ts:XX:XX:12) - at async executeRootTypeField (/some/path/to/client.ts:XX:XX:20) + at async executeRootTypeField (/some/path/to/requestMethods.ts:XX:XX:18) at async (/some/path/to/output_return-error_return-error-execution__return-error-execution.ts:XX:XX:16) { context: {}, cause: undefined, @@ -93,9 +92,8 @@ ContextualError: There was an error in the extension "anonymous" (use named func at runPipeline (/some/path/to/runPipeline.ts:XX:XX:18) at process.processTicksAndRejections (node:internal/process/task_queues:XX:XX) at async Object.run (/some/path/to/main.ts:XX:XX:22) - at async run (/some/path/to/client.ts:XX:XX:20) - at async executeDocument (/some/path/to/client.ts:XX:XX:12) - at async executeRootTypeField (/some/path/to/client.ts:XX:XX:20) + at async executeDocument (/some/path/to/requestMethods.ts:XX:XX:18) + at async executeRootTypeField (/some/path/to/requestMethods.ts:XX:XX:18) at async (/some/path/to/output_return-error_return-error-execution__return-error-execution.ts:XX:XX:3) { context: { hookName: 'encode', diff --git a/website/content/examples/20_output/return-error.md b/website/content/examples/20_output/return-error.md index 5354bffc..c2494cb8 100644 --- a/website/content/examples/20_output/return-error.md +++ b/website/content/examples/20_output/return-error.md @@ -39,9 +39,8 @@ console.log(pokemons) ContextualError: There was an error in the extension "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 Object.run (/some/path/to/main.ts:XX:XX:22) - at async run (/some/path/to/client.ts:XX:XX:20) - at async executeDocument (/some/path/to/client.ts:XX:XX:12) - at async executeRootTypeField (/some/path/to/client.ts:XX:XX:20) + at async executeDocument (/some/path/to/requestMethods.ts:XX:XX:18) + at async executeRootTypeField (/some/path/to/requestMethods.ts:XX:XX:18) at async (/some/path/to/output_return-error.ts:XX:XX:18) { context: { hookName: 'encode', diff --git a/website/content/examples/20_output/standard-graphql.md b/website/content/examples/20_output/standard-graphql.md index 78fac730..a1c81ef7 100644 --- a/website/content/examples/20_output/standard-graphql.md +++ b/website/content/examples/20_output/standard-graphql.md @@ -15,7 +15,7 @@ const graffle = Graffle.create({ output: Preset.traditionalGraphqlOutput, }) -const result = await graffle.rawString({ document: `{ query { thisWillError } }` }) +const result = await graffle.gql(`{ query { thisWillError } }`).send() console.log(result) ``` @@ -34,17 +34,14 @@ ContextualError: There was an error in the core implementation of hook "exchange at runPipeline (/some/path/to/runPipeline.ts:XX:XX:18) at async runPipeline (/some/path/to/runPipeline.ts:XX:XX:14) at async runPipeline (/some/path/to/runPipeline.ts:XX:XX:14) - ... 3 lines matching cause stack trace ... - at async Object.raw (/some/path/to/client.ts:XX:XX:14) - at async Proxy.rawString (/some/path/to/client.ts:XX:XX:14) + ... 2 lines matching cause stack trace ... at async (/some/path/to/output_preset__standard-graphql.ts:XX:XX:16) { context: { hookName: 'exchange', source: 'implementation' }, [cause]: TypeError: Failed to parse URL from ... at new Request (node:internal/deps/undici/undici:XX:XX) at Object.run (/some/path/to/core.ts:XX:XX:29) ... 6 lines matching cause stack trace ... - at async runRaw (/some/path/to/client.ts:XX:XX:12) - at async Object.raw (/some/path/to/client.ts:XX:XX:14) { + at async (/some/path/to/output_preset__standard-graphql.ts:XX:XX:16) { [cause]: TypeError: Invalid URL at new URL (node:internal/url:XX:XX) at new Request (node:internal/deps/undici/undici:XX:XX) @@ -54,8 +51,8 @@ ContextualError: There was an error in the core implementation of hook "exchange at runPipeline (/some/path/to/runPipeline.ts:XX:XX:20) at async runPipeline (/some/path/to/runPipeline.ts:XX:XX:14) at async Object.run (/some/path/to/main.ts:XX:XX:22) - at async run (/some/path/to/client.ts:XX:XX:20) - at async runRaw (/some/path/to/client.ts:XX:XX:12) { + at async Object.send (/some/path/to/gql.ts:XX:XX:26) + at async (/some/path/to/output_preset__standard-graphql.ts:XX:XX:16) { code: 'ERR_INVALID_URL', input: '...' } diff --git a/website/content/examples/30_gql/gql-document-node-typed.md b/website/content/examples/30_gql/gql-document-node-typed.md new file mode 100644 index 00000000..6f2fe293 --- /dev/null +++ b/website/content/examples/30_gql/gql-document-node-typed.md @@ -0,0 +1,67 @@ +--- +aside: false +--- + +# Gql Document Node Typed + +This example shows how to use the TypeScript type "TypedQueryDocumentNode" from the +package `graphql` to make a type safe request with gql method. + + +```ts twoslash +import { parse, type TypedQueryDocumentNode } from 'graphql' +import { Graffle } from 'graffle' + +const graffle = Graffle.create({ + schema: `http://localhost:3000/graphql`, +}) + +type Document = TypedQueryDocumentNode< + { + pokemonByName: { + id: string + name: string + hp: number + attack: number + defense: number + trainer: { name: string } + } + }, + { name: string } +> + +const document = parse(` + query ($name: String!) { + pokemonByName (name: $name) { + name + hp + attack + defense + trainer { + name + } + } + } + `) as Document + +const data = await graffle.gql(document).send({ name: `Pikachu` }) + +console.log(data?.pokemonByName) +``` + + +#### Outputs + + +```txt +[ + { + name: 'Pikachu', + hp: 35, + attack: 55, + defense: 40, + trainer: { name: 'Ash' } + } +] +``` + diff --git a/website/content/examples/30_gql/gql-document-node.md b/website/content/examples/30_gql/gql-document-node.md new file mode 100644 index 00000000..e53d26d2 --- /dev/null +++ b/website/content/examples/30_gql/gql-document-node.md @@ -0,0 +1,44 @@ +--- +aside: false +--- + +# Gql Document Node + +This example shows how to send a request using a Document instance for the GraphQL document. + + +```ts twoslash +import { parse } from 'graphql' +import { Opentelemetry, Throws } from 'graffle/extensions' +import { Graffle } from 'graffle' + +const graffle = Graffle.create({ + schema: `http://localhost:3000/graphql`, +}) + .use(Throws()) + .use(Opentelemetry()) + +const data = await graffle.gql(parse(` + query pokemonByName ($name: String!) { + pokemonByName (name: $name) { + name + trainer { + name + } + } + } +`)).send({ name: `Pikachu` }) + +console.log(data) +``` + + +#### Outputs + + +```txt +{ + pokemonByName: [ { name: 'Pikachu', trainer: { name: 'Ash' } } ] +} +``` + diff --git a/website/content/examples/30_raw/raw-string-typed.md b/website/content/examples/30_gql/gql-string-typed.md similarity index 87% rename from website/content/examples/30_raw/raw-string-typed.md rename to website/content/examples/30_gql/gql-string-typed.md index 20ce3702..5f6cec20 100644 --- a/website/content/examples/30_raw/raw-string-typed.md +++ b/website/content/examples/30_gql/gql-string-typed.md @@ -2,7 +2,7 @@ aside: false --- -# Raw String Typed +# Gql String Typed This example shows how to send a request using a string for the GraphQL document while also being typesafe in regards to the passed variables and return type. Note that the typing is a cast and would not catch if the actual GraphQL document disagreed with the types. As the comment suggests below, ideally some sort @@ -10,7 +10,7 @@ of automation would generate the types for you. ```ts twoslash -import { Graffle, type TypedDocumentString } from 'graffle' +import { Graffle, type TypedDocument } from 'graffle' const graffle = Graffle.create({ schema: `http://localhost:3000/graphql`, @@ -22,7 +22,7 @@ const graffle = Graffle.create({ * @see https://the-guild.dev/graphql/codegen/plugins/presets/preset-client#documentmode * @see https://github.com/jasonkuhrt/graffle/issues/997 */ -type Document = TypedDocumentString< +type Document = TypedDocument.String< { pokemonByName: { id: string @@ -52,10 +52,7 @@ const document: Document = /* gql */ ` } ` -const data = await graffle.rawString({ - document, - variables: { name: `Pikachu` }, -}) +const data = await graffle.gql(document).send({ name: `Pikachu` }) console.log(data?.pokemonByName) ``` diff --git a/website/content/examples/30_raw/raw-string.md b/website/content/examples/30_gql/gql-string.md similarity index 90% rename from website/content/examples/30_raw/raw-string.md rename to website/content/examples/30_gql/gql-string.md index ad984830..118838c4 100644 --- a/website/content/examples/30_raw/raw-string.md +++ b/website/content/examples/30_gql/gql-string.md @@ -2,7 +2,7 @@ aside: false --- -# Raw String +# Gql String This example shows how to send a request using a string for the GraphQL document. @@ -22,7 +22,7 @@ const document = /* gql */ ` } ` -const data = await graffle.rawString({ document }) +const data = await graffle.gql(document).send() console.log(data) ``` diff --git a/website/content/examples/30_raw/raw-document-node-typed.md b/website/content/examples/30_raw/raw-document-node-typed.md deleted file mode 100644 index f74443fa..00000000 --- a/website/content/examples/30_raw/raw-document-node-typed.md +++ /dev/null @@ -1,129 +0,0 @@ ---- -aside: false ---- - -# Raw Document Node Typed - -This example shows how to send a request using a Document instance for the GraphQL document while also being typesafe in regards to the passed variables and return type. - - -```ts twoslash -import type { TypedQueryDocumentNode } from 'graphql' -import { gql, Graffle } from 'graffle' - -const graffle = Graffle.create({ - schema: `http://localhost:3000/graphql`, -}) - -/*************************************** Variation 1 *************************************** - * - - * - - * - - * You can pass type variables to the `gql` template tag. - * - - */ - -{ - const document = gql< - { - pokemonByName: { - id: string - name: string - hp: number - attack: number - defense: number - trainer: { name: string } - } - }, - { name: string } - >` - query ($name: String!) { - pokemonByName (name: $name) { - name - hp - attack - defense - trainer { - name - } - } - } - ` - - const data = await graffle.raw({ document, variables: { name: `Pikachu` } }) - - console.log(data?.pokemonByName) -} - -/*************************************** Variation 2 *************************************** - * - - * - - * - - * You can also cast the type if you have a reference to a pre constructed type. - * - - */ - -{ - type Document = TypedQueryDocumentNode< - { - pokemonByName: { - id: string - name: string - hp: number - attack: number - defense: number - trainer: { name: string } - } - }, - { name: string } - > - - const document: Document = gql` - query ($name: String!) { - pokemonByName (name: $name) { - name - hp - attack - defense - trainer { - name - } - } - } - ` - - const data = await graffle.raw({ document, variables: { name: `Pikachu` } }) - - console.log(data?.pokemonByName) -} -``` - - -#### Outputs - - -```txt -[ - { - name: 'Pikachu', - hp: 35, - attack: 55, - defense: 40, - trainer: { name: 'Ash' } - } -] -``` - - -```txt -[ - { - name: 'Pikachu', - hp: 35, - attack: 55, - defense: 40, - trainer: { name: 'Ash' } - } -] -``` - diff --git a/website/content/examples/30_raw/raw-document-node.md b/website/content/examples/30_raw/raw-document-node.md deleted file mode 100644 index 28714828..00000000 --- a/website/content/examples/30_raw/raw-document-node.md +++ /dev/null @@ -1,73 +0,0 @@ ---- -aside: false ---- - -# Raw Document Node - -This example shows how to send a request using a Document instance for the GraphQL document. - - -```ts twoslash -import { Opentelemetry, Throws } from 'graffle/extensions' -import { gql, Graffle } from 'graffle' - -const graffle = Graffle.create({ - schema: `http://localhost:3000/graphql`, -}) - .use(Throws()) - .use(Opentelemetry()) - -const data = await graffle.raw({ - document: gql` - query pokemonByName ($Name: String!) { - pokemonByName (name: $Name) { - name - continent { - name - } - } - } - `, - variables: { name: `Pikachu` }, -}) - -console.log(data) -``` - - -#### Outputs - - -```txt -/some/path/to/handleOutput.ts:XX:XX - const error = new Errors.ContextualAggregateError( - ^ - - -ContextualAggregateError: One or more errors in the execution result. - at handleOutput (/some/path/to/handleOutput.ts:XX:XX:19) - at run (/some/path/to/client.ts:XX:XX:12) - at process.processTicksAndRejections (node:internal/process/task_queues:XX:XX) - at async runRaw (/some/path/to/client.ts:XX:XX:12) - at async Proxy.raw (/some/path/to/client.ts:XX:XX:14) - at async (/some/path/to/raw_rawDocumentNode__raw-document-node.ts:XX:XX:14) { - context: {}, - cause: undefined, - errors: [ - GraphQLError: Cannot query field "continent" on type "Pokemon". - at (/some/path/to/graphqlHTTP.ts:XX:XX:47) - at Array.map () - at parseExecutionResult (/some/path/to/graphqlHTTP.ts:XX:XX:28) - at Object.unpack (/some/path/to/core.ts:XX:XX:26) - at process.processTicksAndRejections (node:internal/process/task_queues:XX:XX) - at async runHook (/some/path/to/runHook.ts:XX:XX:16) { - path: undefined, - locations: undefined, - extensions: [Object: null prototype] {} - } - ] -} - -Node.js vXX.XX.XX -``` - diff --git a/website/content/examples/40_other/transport-memory.md b/website/content/examples/40_other/transport-memory.md index 0e331092..7cd67f16 100644 --- a/website/content/examples/40_other/transport-memory.md +++ b/website/content/examples/40_other/transport-memory.md @@ -25,7 +25,11 @@ const schema = new GraphQLSchema({ const graffle = Graffle.create({ schema }) -const data = await graffle.rawString({ document: `{ foo }` }) +const data = await graffle.gql` + { + foo + } +`.send() console.log(data) ``` diff --git a/website/content/examples/50_anyware/slot-body.md b/website/content/examples/50_anyware/slot-body.md index 301b175e..1c8db128 100644 --- a/website/content/examples/50_anyware/slot-body.md +++ b/website/content/examples/50_anyware/slot-body.md @@ -25,17 +25,14 @@ const graffle = Graffle }) }) -const result = await graffle.rawString({ - document: ` +const result = await graffle.gql` query pokemon { trainers { name } } query trainers { pokemon { name } } - `, - operationName: `pokemon`, -}) + `.send(`pokemon`) console.log(result) ``` diff --git a/website/content/examples/50_anyware/slot-fetch.md b/website/content/examples/50_anyware/slot-fetch.md index 2b0105a0..a4d70ebb 100644 --- a/website/content/examples/50_anyware/slot-fetch.md +++ b/website/content/examples/50_anyware/slot-fetch.md @@ -16,15 +16,19 @@ const graffle = Graffle return await exchange({ using: { fetch: () => { - return new Response(JSON.stringify({ data: { continents: [{ name: `Earthsea` }] } })) + return new Response(JSON.stringify({ data: { trainers: [{ name: `Jason` }] } })) }, }, }) }) -const result = await graffle.rawString({ - document: `query { continents { name } }`, -}) +const result = await graffle.gql` + query { + trainers { + name + } + } +`.send() console.log(result) ``` @@ -34,6 +38,6 @@ console.log(result) ```txt -{ continents: [ { name: 'Earthsea' } ] } +{ trainers: [ { name: 'Jason' } ] } ``` diff --git a/website/content/examples/50_anyware/slot-search-params.md b/website/content/examples/50_anyware/slot-search-params.md index e78a4b03..c943fcef 100644 --- a/website/content/examples/50_anyware/slot-search-params.md +++ b/website/content/examples/50_anyware/slot-search-params.md @@ -25,17 +25,15 @@ const graffle = Graffle }) }) -const result = await graffle.rawString({ - document: ` +const result = await graffle.gql` query trainers { pokemon { name } } query pokemon { trainers { name } } - `, - operationName: `queryCountries`, -}) + ` + .send(`queryCountries`) console.log(result) ``` @@ -54,10 +52,7 @@ ContextualError: There was an error in the core implementation of hook "pack". at runPipeline (/some/path/to/runPipeline.ts:XX:XX:18) at async runPipeline (/some/path/to/runPipeline.ts:XX:XX:14) at async Object.run (/some/path/to/main.ts:XX:XX:22) - at async run (/some/path/to/client.ts:XX:XX:20) - at async runRaw (/some/path/to/client.ts:XX:XX:12) - at async Object.raw (/some/path/to/client.ts:XX:XX:14) - at async Proxy.rawString (/some/path/to/client.ts:XX:XX:14) + at async Object.send (/some/path/to/gql.ts:XX:XX:26) at async (/some/path/to/anyware_slot_slot-body__slot-search-params.ts:XX:XX:16) { context: { hookName: 'pack', source: 'implementation' }, cause: Error: Unexpected null value. diff --git a/website/content/examples/55_generated/document.md b/website/content/examples/55_generated/document.md index 7740b913..09dbcdee 100644 --- a/website/content/examples/55_generated/document.md +++ b/website/content/examples/55_generated/document.md @@ -34,11 +34,11 @@ const pokemons = await pokemon.document({ makeSomeNewPokemons: { addPokemon: [ [`addAngryPikachu`, { - $: { name: `AngryPikachu`, attack: 100, defense: 100, hp: 100, type: `electric` }, + $: { name: `AngryPikachu`, attack: 100, defense: 100, hp: 100, $type: `electric` }, name: true, }], [`addAngryCharizard`, { - $: { name: `AngryCharizard`, attack: 100, defense: 100, hp: 100, type: `fire` }, + $: { name: `AngryCharizard`, attack: 100, defense: 100, hp: 100, $type: `fire` }, name: true, }], ], diff --git a/website/content/examples/60_extension/opentelemetry.md b/website/content/examples/60_extension/opentelemetry.md index 7c4063b0..51f28856 100644 --- a/website/content/examples/60_extension/opentelemetry.md +++ b/website/content/examples/60_extension/opentelemetry.md @@ -21,7 +21,7 @@ provider.addSpanProcessor(processor) provider.register() const graffle = Pokemon.create().use(Opentelemetry()) -const data = await graffle.rawString({ document: `query { pokemons { name } }` }) +const data = await graffle.gql`query { pokemons { name } }`.send() console.log(data) ``` @@ -40,14 +40,14 @@ console.log(data) } }, instrumentationScope: { name: 'graffle', version: undefined, schemaUrl: undefined }, - traceId: 'd7f120898ea4e086c016a9328aeb4588', - parentId: '8977b7ec1a73aa42', + traceId: '1a56566cbf32cac1ab51f61c2296386d', + parentId: 'e9e71e5ac59a4abf', traceState: undefined, name: 'encode', - id: '5c86f62c08b7f3bd', + id: '5dd0dda86a63442a', kind: 0, - timestamp: 1727803645728000, - duration: 748.709, + timestamp: 1728318378110000, + duration: 592.375, attributes: {}, status: { code: 0 }, events: [], @@ -67,14 +67,14 @@ console.log(data) } }, instrumentationScope: { name: 'graffle', version: undefined, schemaUrl: undefined }, - traceId: 'd7f120898ea4e086c016a9328aeb4588', - parentId: '8977b7ec1a73aa42', + traceId: '1a56566cbf32cac1ab51f61c2296386d', + parentId: 'e9e71e5ac59a4abf', traceState: undefined, name: 'pack', - id: 'ac44e7f088223e59', + id: 'c6a933e2385f4f29', kind: 0, - timestamp: 1727803645732000, - duration: 12910.625, + timestamp: 1728318378112000, + duration: 263004.291, attributes: {}, status: { code: 0 }, events: [], @@ -94,14 +94,14 @@ console.log(data) } }, instrumentationScope: { name: 'graffle', version: undefined, schemaUrl: undefined }, - traceId: 'd7f120898ea4e086c016a9328aeb4588', - parentId: '8977b7ec1a73aa42', + traceId: '1a56566cbf32cac1ab51f61c2296386d', + parentId: 'e9e71e5ac59a4abf', traceState: undefined, name: 'exchange', - id: '07c6d24729766b4d', + id: '99259acfe1a55e81', kind: 0, - timestamp: 1727803645745000, - duration: 21332.375, + timestamp: 1728318378377000, + duration: 46421.75, attributes: {}, status: { code: 0 }, events: [], @@ -121,14 +121,14 @@ console.log(data) } }, instrumentationScope: { name: 'graffle', version: undefined, schemaUrl: undefined }, - traceId: 'd7f120898ea4e086c016a9328aeb4588', - parentId: '8977b7ec1a73aa42', + traceId: '1a56566cbf32cac1ab51f61c2296386d', + parentId: 'e9e71e5ac59a4abf', traceState: undefined, name: 'unpack', - id: '14366c75d72eb1d4', + id: '0cef5ce8392b53a8', kind: 0, - timestamp: 1727803645767000, - duration: 1140.625, + timestamp: 1728318378424000, + duration: 1580.666, attributes: {}, status: { code: 0 }, events: [], @@ -148,14 +148,14 @@ console.log(data) } }, instrumentationScope: { name: 'graffle', version: undefined, schemaUrl: undefined }, - traceId: 'd7f120898ea4e086c016a9328aeb4588', - parentId: '8977b7ec1a73aa42', + traceId: '1a56566cbf32cac1ab51f61c2296386d', + parentId: 'e9e71e5ac59a4abf', traceState: undefined, name: 'decode', - id: 'e89206579d516345', + id: '8e7ed7776dfe35b5', kind: 0, - timestamp: 1727803645768000, - duration: 192.958, + timestamp: 1728318378426000, + duration: 207.167, attributes: {}, status: { code: 0 }, events: [], @@ -175,14 +175,14 @@ console.log(data) } }, instrumentationScope: { name: 'graffle', version: undefined, schemaUrl: undefined }, - traceId: 'd7f120898ea4e086c016a9328aeb4588', + traceId: '1a56566cbf32cac1ab51f61c2296386d', parentId: undefined, traceState: undefined, name: 'request', - id: '8977b7ec1a73aa42', + id: 'e9e71e5ac59a4abf', kind: 0, - timestamp: 1727803645728000, - duration: 40803.792, + timestamp: 1728318378109000, + duration: 316401.583, attributes: {}, status: { code: 0 }, events: [], diff --git a/website/content/guides/20_methods/10_gql.md b/website/content/guides/20_methods/10_gql.md new file mode 100644 index 00000000..c0b48153 --- /dev/null +++ b/website/content/guides/20_methods/10_gql.md @@ -0,0 +1,25 @@ +# GQL + + + +The `gql` method allows you to work directly with GraphQL syntax. It approximates what `graphql-request` was before it turned into `graffle`. Its name is also strategically chosen to leverage automatic GraphQL syntax highlighting that editors generally provide. + +## Sending Document Nodes + +Graffle allows you to send `DocumentNode` instances (created from a class in the `graphql` package) directly. + + + +You can attain type safety by creating your document with type variables. In a typical real project this would be something that a tool like [GraphQL Code Generator automatically](https://the-guild.dev/graphql/codegen) does for you. + + + +## Sending Strings + +You can skip creating document nodes if you don't need them, instead just sending a string directly. + + + +You can still attain type safety even for the string input by casting your string to `TypedDocumentString`. + + diff --git a/website/content/guides/20_methods/10_raw.md b/website/content/guides/20_methods/10_raw.md deleted file mode 100644 index f76cb821..00000000 --- a/website/content/guides/20_methods/10_raw.md +++ /dev/null @@ -1,27 +0,0 @@ -# Raw - - - -Raw methods allow you to work directly with GraphQL syntax. They approximate what `graphql-request` was before it turned into `graffle`. - -## Sending Document Nodes - -Graffle allows you to send `DocumentNode` instances (created from a class in the `graphql` package) directly. - -Graffle exports a utility template tag `gql` to easily create them. Its name is also strategically chosen to leverage automatic GraphQL syntax highlighting that editors generally provide. - - - -You can attain type safety by creating your document with type variables. In a typical real project this would be something that a tool like [GraphQL Code Generator automatically](https://the-guild.dev/graphql/codegen) does for you. - - - -## Sending Strings - -You can skip creating document nodes if you don't need them, instead just sending a string directly. - - - -You can still attain type safety even for the string input by casting your string to `TypedDocumentString`. - - diff --git a/website/graffle/modules/Global.ts b/website/graffle/modules/Global.ts index 51bfd4cb..b8c516ad 100644 --- a/website/graffle/modules/Global.ts +++ b/website/graffle/modules/Global.ts @@ -2,7 +2,6 @@ import type * as Data from './Data.js' import type * as MethodsDocument from './MethodsDocument.js' import type * as MethodsRoot from './MethodsRoot.js' import type * as MethodsSelect from './MethodsSelect.js' -import type * as SchemaCustomScalarIndex from './SchemaCustomScalarIndex.js' import type { Index } from './SchemaIndex.js' declare global { diff --git a/website/graffle/modules/RuntimeCustomScalars.ts b/website/graffle/modules/RuntimeCustomScalars.ts new file mode 100644 index 00000000..f76b2632 --- /dev/null +++ b/website/graffle/modules/RuntimeCustomScalars.ts @@ -0,0 +1,72 @@ +import * as CustomScalars from './Scalar.js' +// +// +// +// +// +// +// ================================================================================================== +// GraphQLInputObjectType +// ================================================================================================== +// +// +// +// +// +// + +// None of your GraphQLInputObjectTypes have custom scalars. + +// +// +// +// +// +// +// ================================================================================================== +// GraphQLObjectType +// ================================================================================================== +// +// +// +// +// +// + +// None of your GraphQLObjectTypes have custom scalars. + +// +// +// +// +// +// +// ================================================================================================== +// GraphQLRootType +// ================================================================================================== +// +// +// +// +// +// + +// None of your GraphQLRootTypes have custom scalars. + +// +// +// +// +// +// +// ================================================================================================== +// Index +// ================================================================================================== +// +// +// +// +// +// + +export const $index = {} diff --git a/website/graffle/modules/SchemaIndex.ts b/website/graffle/modules/SchemaIndex.ts index 27a37a81..7698bf60 100644 --- a/website/graffle/modules/SchemaIndex.ts +++ b/website/graffle/modules/SchemaIndex.ts @@ -1,4 +1,5 @@ /* eslint-disable */ +import type * as Utilities from 'graffle/utilities-for-generated' import type * as Data from './Data.js' import type * as MethodsRoot from './MethodsRoot.js' import type * as Schema from './SchemaBuildtime.js' @@ -29,6 +30,7 @@ export interface Index { } unions: {} interfaces: {} + customScalars: Utilities.SchemaIndexBase['customScalars'] error: { objects: {} objectsTypename: {} diff --git a/website/graffle/modules/SchemaRuntime.ts b/website/graffle/modules/SchemaRuntime.ts index a0e24bf9..8675d92b 100644 --- a/website/graffle/modules/SchemaRuntime.ts +++ b/website/graffle/modules/SchemaRuntime.ts @@ -1,6 +1,7 @@ /* eslint-disable */ import * as $ from 'graffle/schema' import * as Data from './Data.js' +import { $index as $customScalarsIndex } from './RuntimeCustomScalars.js' import * as $Scalar from './Scalar.js' import type { Index } from './SchemaIndex.js' export const $defaultSchemaUrl = new URL('https://countries.trevorblades.com/graphql') @@ -138,6 +139,9 @@ export const $Index: Index = { }, unions: {}, interfaces: {}, + customScalars: { + input: $customScalarsIndex, + }, error: { objects: {}, objectsTypename: {}, diff --git a/website/graffle/modules/Select.ts b/website/graffle/modules/Select.ts index f54099fc..44d5befd 100644 --- a/website/graffle/modules/Select.ts +++ b/website/graffle/modules/Select.ts @@ -72,6 +72,7 @@ export namespace Select { // ----------- // -- None -- + // Interface Types // --------------- diff --git a/website/package.json b/website/package.json index 454db68d..3b6c3fc9 100644 --- a/website/package.json +++ b/website/package.json @@ -10,11 +10,11 @@ "vitepress": "^1.3.4" }, "dependencies": { - "@shikijs/twoslash": "^1.21.0", - "@shikijs/vitepress-twoslash": "^1.21.0", + "@shikijs/twoslash": "^1.22.0", + "@shikijs/vitepress-twoslash": "^1.22.0", "@tsconfig/node20": "^20.1.4", "@tsconfig/strictest": "^2.0.5", - "es-toolkit": "^1.23.0", + "es-toolkit": "^1.24.0", "floating-vue": "^5.2.2", "globby": "^14.0.2", "graffle": "link:..", diff --git a/website/pnpm-lock.yaml b/website/pnpm-lock.yaml index 5ee667d1..21747388 100644 --- a/website/pnpm-lock.yaml +++ b/website/pnpm-lock.yaml @@ -9,11 +9,11 @@ importers: .: dependencies: '@shikijs/twoslash': - specifier: ^1.21.0 - version: 1.21.0(typescript@5.6.2) + specifier: ^1.22.0 + version: 1.22.0(typescript@5.6.2) '@shikijs/vitepress-twoslash': - specifier: ^1.21.0 - version: 1.21.0(typescript@5.6.2) + specifier: ^1.22.0 + version: 1.22.0(typescript@5.6.2) '@tsconfig/node20': specifier: ^20.1.4 version: 20.1.4 @@ -21,11 +21,11 @@ importers: specifier: ^2.0.5 version: 2.0.5 es-toolkit: - specifier: ^1.23.0 - version: 1.23.0 + specifier: ^1.24.0 + version: 1.24.0 floating-vue: specifier: ^5.2.2 - version: 5.2.2(vue@3.5.10(typescript@5.6.2)) + version: 5.2.2(vue@3.5.11(typescript@5.6.2)) globby: specifier: ^14.0.2 version: 14.0.2 @@ -43,7 +43,7 @@ importers: version: 5.6.2 vitepress-plugin-tabs: specifier: ^0.5.0 - version: 0.5.0(vitepress@1.3.4(@algolia/client-search@5.7.0)(postcss@8.4.47)(search-insights@2.17.2)(typescript@5.6.2))(vue@3.5.10(typescript@5.6.2)) + version: 0.5.0(vitepress@1.3.4(@algolia/client-search@5.7.0)(postcss@8.4.47)(search-insights@2.17.2)(typescript@5.6.2))(vue@3.5.11(typescript@5.6.2)) vitepress-sidebar: specifier: ^1.27.1 version: 1.27.1 @@ -139,21 +139,21 @@ packages: '@algolia/transporter@4.24.0': resolution: {integrity: sha512-86nI7w6NzWxd1Zp9q3413dRshDqAzSbsQjhcDhPIatEFiZrL1/TjnHL8S7jVKFePlIMzDsZWXAXwXzcok9c5oA==} - '@babel/helper-string-parser@7.24.8': - resolution: {integrity: sha512-pO9KhhRcuUyGnJWwyEgnRJTSIZHiT+vMD0kPeD+so0l7mxkMT19g3pjY9GTnHySck/hDzq+dtW/4VgnMkippsQ==} + '@babel/helper-string-parser@7.25.7': + resolution: {integrity: sha512-CbkjYdsJNHFk8uqpEkpCvRs3YRp9tY6FmFY7wLMSYuGYkrdUi7r2lc4/wqsvlHoMznX3WJ9IP8giGPq68T/Y6g==} engines: {node: '>=6.9.0'} - '@babel/helper-validator-identifier@7.24.7': - resolution: {integrity: sha512-rR+PBcQ1SMQDDyF6X0wxtG8QyLCgUB0eRAGguqRLfkCA87l7yAP7ehq8SNj96OOGTO8OBV70KhuFYcIkHXOg0w==} + '@babel/helper-validator-identifier@7.25.7': + resolution: {integrity: sha512-AM6TzwYqGChO45oiuPqwL2t20/HdMC1rTPAesnBCgPCSF1x3oN9MVUwQV2iyz4xqWrctwK5RNC8LV22kaQCNYg==} engines: {node: '>=6.9.0'} - '@babel/parser@7.25.6': - resolution: {integrity: sha512-trGdfBdbD0l1ZPmcJ83eNxB9rbEax4ALFTF7fN386TMYbeCQbyme5cOEXQhbGXKebwGaB/J52w1mrklMcbgy6Q==} + '@babel/parser@7.25.7': + resolution: {integrity: sha512-aZn7ETtQsjjGG5HruveUK06cU3Hljuhd9Iojm4M8WWv3wLE6OkE5PWbDUkItmMgegmccaITudyuW5RPYrYlgWw==} engines: {node: '>=6.0.0'} hasBin: true - '@babel/types@7.25.6': - resolution: {integrity: sha512-/l42B1qxpG6RdfYf343Uw1vmDjeNhneUXtzhojE7pDgfpEypmRhI6j1kr17XCVv4Cgl9HdAiQY2x0GwKm7rWCw==} + '@babel/types@7.25.7': + resolution: {integrity: sha512-vwIVdXG+j+FOpkwqHRcBgHLYNL7XMkufrlaFvL9o6Ai9sJn9+PdyIL5qa0XzTZw084c+u9LOls53eoZWP/W5WQ==} engines: {node: '>=6.9.0'} '@docsearch/css@3.6.2': @@ -493,109 +493,109 @@ packages: resolution: {integrity: sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==} engines: {node: '>=14'} - '@rollup/rollup-android-arm-eabi@4.23.0': - resolution: {integrity: sha512-8OR+Ok3SGEMsAZispLx8jruuXw0HVF16k+ub2eNXKHDmdxL4cf9NlNpAzhlOhNyXzKDEJuFeq0nZm+XlNb1IFw==} + '@rollup/rollup-android-arm-eabi@4.24.0': + resolution: {integrity: sha512-Q6HJd7Y6xdB48x8ZNVDOqsbh2uByBhgK8PiQgPhwkIw/HC/YX5Ghq2mQY5sRMZWHb3VsFkWooUVOZHKr7DmDIA==} cpu: [arm] os: [android] - '@rollup/rollup-android-arm64@4.23.0': - resolution: {integrity: sha512-rEFtX1nP8gqmLmPZsXRMoLVNB5JBwOzIAk/XAcEPuKrPa2nPJ+DuGGpfQUR0XjRm8KjHfTZLpWbKXkA5BoFL3w==} + '@rollup/rollup-android-arm64@4.24.0': + resolution: {integrity: sha512-ijLnS1qFId8xhKjT81uBHuuJp2lU4x2yxa4ctFPtG+MqEE6+C5f/+X/bStmxapgmwLwiL3ih122xv8kVARNAZA==} cpu: [arm64] os: [android] - '@rollup/rollup-darwin-arm64@4.23.0': - resolution: {integrity: sha512-ZbqlMkJRMMPeapfaU4drYHns7Q5MIxjM/QeOO62qQZGPh9XWziap+NF9fsqPHT0KzEL6HaPspC7sOwpgyA3J9g==} + '@rollup/rollup-darwin-arm64@4.24.0': + resolution: {integrity: sha512-bIv+X9xeSs1XCk6DVvkO+S/z8/2AMt/2lMqdQbMrmVpgFvXlmde9mLcbQpztXm1tajC3raFDqegsH18HQPMYtA==} cpu: [arm64] os: [darwin] - '@rollup/rollup-darwin-x64@4.23.0': - resolution: {integrity: sha512-PfmgQp78xx5rBCgn2oYPQ1rQTtOaQCna0kRaBlc5w7RlA3TDGGo7m3XaptgitUZ54US9915i7KeVPHoy3/W8tA==} + '@rollup/rollup-darwin-x64@4.24.0': + resolution: {integrity: sha512-X6/nOwoFN7RT2svEQWUsW/5C/fYMBe4fnLK9DQk4SX4mgVBiTA9h64kjUYPvGQ0F/9xwJ5U5UfTbl6BEjaQdBQ==} cpu: [x64] os: [darwin] - '@rollup/rollup-linux-arm-gnueabihf@4.23.0': - resolution: {integrity: sha512-WAeZfAAPus56eQgBioezXRRzArAjWJGjNo/M+BHZygUcs9EePIuGI1Wfc6U/Ki+tMW17FFGvhCfYnfcKPh18SA==} + '@rollup/rollup-linux-arm-gnueabihf@4.24.0': + resolution: {integrity: sha512-0KXvIJQMOImLCVCz9uvvdPgfyWo93aHHp8ui3FrtOP57svqrF/roSSR5pjqL2hcMp0ljeGlU4q9o/rQaAQ3AYA==} cpu: [arm] os: [linux] - '@rollup/rollup-linux-arm-musleabihf@4.23.0': - resolution: {integrity: sha512-v7PGcp1O5XKZxKX8phTXtmJDVpE20Ub1eF6w9iMmI3qrrPak6yR9/5eeq7ziLMrMTjppkkskXyxnmm00HdtXjA==} + '@rollup/rollup-linux-arm-musleabihf@4.24.0': + resolution: {integrity: sha512-it2BW6kKFVh8xk/BnHfakEeoLPv8STIISekpoF+nBgWM4d55CZKc7T4Dx1pEbTnYm/xEKMgy1MNtYuoA8RFIWw==} cpu: [arm] os: [linux] - '@rollup/rollup-linux-arm64-gnu@4.23.0': - resolution: {integrity: sha512-nAbWsDZ9UkU6xQiXEyXBNHAKbzSAi95H3gTStJq9UGiS1v+YVXwRHcQOQEF/3CHuhX5BVhShKoeOf6Q/1M+Zhg==} + '@rollup/rollup-linux-arm64-gnu@4.24.0': + resolution: {integrity: sha512-i0xTLXjqap2eRfulFVlSnM5dEbTVque/3Pi4g2y7cxrs7+a9De42z4XxKLYJ7+OhE3IgxvfQM7vQc43bwTgPwA==} cpu: [arm64] os: [linux] - '@rollup/rollup-linux-arm64-musl@4.23.0': - resolution: {integrity: sha512-5QT/Di5FbGNPaVw8hHO1wETunwkPuZBIu6W+5GNArlKHD9fkMHy7vS8zGHJk38oObXfWdsuLMogD4sBySLJ54g==} + '@rollup/rollup-linux-arm64-musl@4.24.0': + resolution: {integrity: sha512-9E6MKUJhDuDh604Qco5yP/3qn3y7SLXYuiC0Rpr89aMScS2UAmK1wHP2b7KAa1nSjWJc/f/Lc0Wl1L47qjiyQw==} cpu: [arm64] os: [linux] - '@rollup/rollup-linux-powerpc64le-gnu@4.23.0': - resolution: {integrity: sha512-Sefl6vPyn5axzCsO13r1sHLcmPuiSOrKIImnq34CBurntcJ+lkQgAaTt/9JkgGmaZJ+OkaHmAJl4Bfd0DmdtOQ==} + '@rollup/rollup-linux-powerpc64le-gnu@4.24.0': + resolution: {integrity: sha512-2XFFPJ2XMEiF5Zi2EBf4h73oR1V/lycirxZxHZNc93SqDN/IWhYYSYj8I9381ikUFXZrz2v7r2tOVk2NBwxrWw==} cpu: [ppc64] os: [linux] - '@rollup/rollup-linux-riscv64-gnu@4.23.0': - resolution: {integrity: sha512-o4QI2KU/QbP7ZExMse6ULotdV3oJUYMrdx3rBZCgUF3ur3gJPfe8Fuasn6tia16c5kZBBw0aTmaUygad6VB/hQ==} + '@rollup/rollup-linux-riscv64-gnu@4.24.0': + resolution: {integrity: sha512-M3Dg4hlwuntUCdzU7KjYqbbd+BLq3JMAOhCKdBE3TcMGMZbKkDdJ5ivNdehOssMCIokNHFOsv7DO4rlEOfyKpg==} cpu: [riscv64] os: [linux] - '@rollup/rollup-linux-s390x-gnu@4.23.0': - resolution: {integrity: sha512-+bxqx+V/D4FGrpXzPGKp/SEZIZ8cIW3K7wOtcJAoCrmXvzRtmdUhYNbgd+RztLzfDEfA2WtKj5F4tcbNPuqgeg==} + '@rollup/rollup-linux-s390x-gnu@4.24.0': + resolution: {integrity: sha512-mjBaoo4ocxJppTorZVKWFpy1bfFj9FeCMJqzlMQGjpNPY9JwQi7OuS1axzNIk0nMX6jSgy6ZURDZ2w0QW6D56g==} cpu: [s390x] os: [linux] - '@rollup/rollup-linux-x64-gnu@4.23.0': - resolution: {integrity: sha512-I/eXsdVoCKtSgK9OwyQKPAfricWKUMNCwJKtatRYMmDo5N859tbO3UsBw5kT3dU1n6ZcM1JDzPRSGhAUkxfLxw==} + '@rollup/rollup-linux-x64-gnu@4.24.0': + resolution: {integrity: sha512-ZXFk7M72R0YYFN5q13niV0B7G8/5dcQ9JDp8keJSfr3GoZeXEoMHP/HlvqROA3OMbMdfr19IjCeNAnPUG93b6A==} cpu: [x64] os: [linux] - '@rollup/rollup-linux-x64-musl@4.23.0': - resolution: {integrity: sha512-4ZoDZy5ShLbbe1KPSafbFh1vbl0asTVfkABC7eWqIs01+66ncM82YJxV2VtV3YVJTqq2P8HMx3DCoRSWB/N3rw==} + '@rollup/rollup-linux-x64-musl@4.24.0': + resolution: {integrity: sha512-w1i+L7kAXZNdYl+vFvzSZy8Y1arS7vMgIy8wusXJzRrPyof5LAb02KGr1PD2EkRcl73kHulIID0M501lN+vobQ==} cpu: [x64] os: [linux] - '@rollup/rollup-win32-arm64-msvc@4.23.0': - resolution: {integrity: sha512-+5Ky8dhft4STaOEbZu3/NU4QIyYssKO+r1cD3FzuusA0vO5gso15on7qGzKdNXnc1gOrsgCqZjRw1w+zL4y4hQ==} + '@rollup/rollup-win32-arm64-msvc@4.24.0': + resolution: {integrity: sha512-VXBrnPWgBpVDCVY6XF3LEW0pOU51KbaHhccHw6AS6vBWIC60eqsH19DAeeObl+g8nKAz04QFdl/Cefta0xQtUQ==} cpu: [arm64] os: [win32] - '@rollup/rollup-win32-ia32-msvc@4.23.0': - resolution: {integrity: sha512-0SPJk4cPZQhq9qA1UhIRumSE3+JJIBBjtlGl5PNC///BoaByckNZd53rOYD0glpTkYFBQSt7AkMeLVPfx65+BQ==} + '@rollup/rollup-win32-ia32-msvc@4.24.0': + resolution: {integrity: sha512-xrNcGDU0OxVcPTH/8n/ShH4UevZxKIO6HJFK0e15XItZP2UcaiLFd5kiX7hJnqCbSztUF8Qot+JWBC/QXRPYWQ==} cpu: [ia32] os: [win32] - '@rollup/rollup-win32-x64-msvc@4.23.0': - resolution: {integrity: sha512-lqCK5GQC8fNo0+JvTSxcG7YB1UKYp8yrNLhsArlvPWN+16ovSZgoehlVHg6X0sSWPUkpjRBR5TuR12ZugowZ4g==} + '@rollup/rollup-win32-x64-msvc@4.24.0': + resolution: {integrity: sha512-fbMkAF7fufku0N2dE5TBXcNlg0pt0cJue4xBRE2Qc5Vqikxr4VCgKj/ht6SMdFcOacVA9rqF70APJ8RN/4vMJw==} cpu: [x64] os: [win32] - '@shikijs/core@1.21.0': - resolution: {integrity: sha512-zAPMJdiGuqXpZQ+pWNezQAk5xhzRXBNiECFPcJLtUdsFM3f//G95Z15EHTnHchYycU8kIIysqGgxp8OVSj1SPQ==} + '@shikijs/core@1.22.0': + resolution: {integrity: sha512-S8sMe4q71TJAW+qG93s5VaiihujRK6rqDFqBnxqvga/3LvqHEnxqBIOPkt//IdXVtHkQWKu4nOQNk0uBGicU7Q==} - '@shikijs/engine-javascript@1.21.0': - resolution: {integrity: sha512-jxQHNtVP17edFW4/0vICqAVLDAxmyV31MQJL4U/Kg+heQALeKYVOWo0sMmEZ18FqBt+9UCdyqGKYE7bLRtk9mg==} + '@shikijs/engine-javascript@1.22.0': + resolution: {integrity: sha512-AeEtF4Gcck2dwBqCFUKYfsCq0s+eEbCEbkUuFou53NZ0sTGnJnJ/05KHQFZxpii5HMXbocV9URYVowOP2wH5kw==} - '@shikijs/engine-oniguruma@1.21.0': - resolution: {integrity: sha512-AIZ76XocENCrtYzVU7S4GY/HL+tgHGbVU+qhiDyNw1qgCA5OSi4B4+HY4BtAoJSMGuD/L5hfTzoRVbzEm2WTvg==} + '@shikijs/engine-oniguruma@1.22.0': + resolution: {integrity: sha512-5iBVjhu/DYs1HB0BKsRRFipRrD7rqjxlWTj4F2Pf+nQSPqc3kcyqFFeZXnBMzDf0HdqaFVvhDRAGiYNvyLP+Mw==} - '@shikijs/transformers@1.21.0': - resolution: {integrity: sha512-aA+XGGSzipcvqdsOYL8l6Q2RYiMuJNdhdt9eZnkJmW+wjSOixN/I7dBq3fISwvEMDlawrtuXM3eybLCEC+Fjlg==} + '@shikijs/transformers@1.22.0': + resolution: {integrity: sha512-k7iMOYuGQA62KwAuJOQBgH2IQb5vP8uiB3lMvAMGUgAMMurePOx3Z7oNqJdcpxqZP6I9cc7nc4DNqSKduCxmdg==} - '@shikijs/twoslash@1.21.0': - resolution: {integrity: sha512-91HTpoIsx6vsJZ0DE1fs/jNeEAL5xJ5hWMVPUSp3iGHxOLH59nGrOcsjSgv4lKaxeE2i6VFvnPANQ5q8I5k2AQ==} + '@shikijs/twoslash@1.22.0': + resolution: {integrity: sha512-r5F/x4GTh18XzhAREehgT9lCDFZlISBSIsOFZQQaqjiOLG81PIqJN1I1D6XY58UN9OJt+3mffuKq19K4FOJKJA==} - '@shikijs/types@1.21.0': - resolution: {integrity: sha512-tzndANDhi5DUndBtpojEq/42+dpUF2wS7wdCDQaFtIXm3Rd1QkrcVgSSRLOvEwexekihOXfbYJINW37g96tJRw==} + '@shikijs/types@1.22.0': + resolution: {integrity: sha512-Fw/Nr7FGFhlQqHfxzZY8Cwtwk5E9nKDUgeLjZgt3UuhcM3yJR9xj3ZGNravZZok8XmEZMiYkSMTPlPkULB8nww==} - '@shikijs/vitepress-twoslash@1.21.0': - resolution: {integrity: sha512-/B/edWFxZ6Tdfj0Jj+jxJOKsHRd89NZ57tK0E68kvaWbbnBw3UaLCixDL+SvdeGFMov2uN1URXgCdBQTR6daZg==} + '@shikijs/vitepress-twoslash@1.22.0': + resolution: {integrity: sha512-NN2AP412MDBP2HwpnKAokvZdoHfWMPIBCW4eYWyjuEqW3OUGFLY7dmsJbYIf1EsjUFcYktHpk0yA/nL9tSocFA==} - '@shikijs/vscode-textmate@9.2.2': - resolution: {integrity: sha512-TMp15K+GGYrWlZM8+Lnj9EaHEFmOen0WJBrfa17hF7taDOYthuPPV0GWzfd/9iMij0akS/8Yw2ikquH7uVi/fg==} + '@shikijs/vscode-textmate@9.3.0': + resolution: {integrity: sha512-jn7/7ky30idSkd/O5yDBfAnVt+JJpepofP/POZ1iMOxK59cOfqIgg/Dj0eFsjOTMw+4ycJN0uhZH/Eb0bs/EUA==} '@sindresorhus/merge-streams@2.3.0': resolution: {integrity: sha512-LtoMMhxAlorcGhmFYI+LhPgbPZCkgP6ra1YL604EeF6U98pLlQ3iWIGMdWSC+vWmPBWBNgmDBAhnAobLROJmwg==} @@ -652,23 +652,23 @@ packages: vite: ^5.0.0 vue: ^3.2.25 - '@volar/language-core@2.4.5': - resolution: {integrity: sha512-F4tA0DCO5Q1F5mScHmca0umsi2ufKULAnMOVBfMsZdT4myhVl4WdKRwCaKcfOkIEuyrAVvtq1ESBdZ+rSyLVww==} + '@volar/language-core@2.4.6': + resolution: {integrity: sha512-FxUfxaB8sCqvY46YjyAAV6c3mMIq/NWQMVvJ+uS4yxr1KzOvyg61gAuOnNvgCvO4TZ7HcLExBEsWcDu4+K4E8A==} - '@volar/source-map@2.4.5': - resolution: {integrity: sha512-varwD7RaKE2J/Z+Zu6j3mNNJbNT394qIxXwdvz/4ao/vxOfyClZpSDtLKkwWmecinkOVos5+PWkWraelfMLfpw==} + '@volar/source-map@2.4.6': + resolution: {integrity: sha512-Nsh7UW2ruK+uURIPzjJgF0YRGP5CX9nQHypA2OMqdM2FKy7rh+uv3XgPnWPw30JADbKvZ5HuBzG4gSbVDYVtiw==} - '@vue/compiler-core@3.5.10': - resolution: {integrity: sha512-iXWlk+Cg/ag7gLvY0SfVucU8Kh2CjysYZjhhP70w9qI4MvSox4frrP+vDGvtQuzIcgD8+sxM6lZvCtdxGunTAA==} + '@vue/compiler-core@3.5.11': + resolution: {integrity: sha512-PwAdxs7/9Hc3ieBO12tXzmTD+Ln4qhT/56S+8DvrrZ4kLDn4Z/AMUr8tXJD0axiJBS0RKIoNaR0yMuQB9v9Udg==} - '@vue/compiler-dom@3.5.10': - resolution: {integrity: sha512-DyxHC6qPcktwYGKOIy3XqnHRrrXyWR2u91AjP+nLkADko380srsC2DC3s7Y1Rk6YfOlxOlvEQKa9XXmLI+W4ZA==} + '@vue/compiler-dom@3.5.11': + resolution: {integrity: sha512-pyGf8zdbDDRkBrEzf8p7BQlMKNNF5Fk/Cf/fQ6PiUz9at4OaUfyXW0dGJTo2Vl1f5U9jSLCNf0EZJEogLXoeew==} - '@vue/compiler-sfc@3.5.10': - resolution: {integrity: sha512-to8E1BgpakV7224ZCm8gz1ZRSyjNCAWEplwFMWKlzCdP9DkMKhRRwt0WkCjY7jkzi/Vz3xgbpeig5Pnbly4Tow==} + '@vue/compiler-sfc@3.5.11': + resolution: {integrity: sha512-gsbBtT4N9ANXXepprle+X9YLg2htQk1sqH/qGJ/EApl+dgpUBdTv3yP7YlR535uHZY3n6XaR0/bKo0BgwwDniw==} - '@vue/compiler-ssr@3.5.10': - resolution: {integrity: sha512-hxP4Y3KImqdtyUKXDRSxKSRkSm1H9fCvhojEYrnaoWhE4w/y8vwWhnosJoPPe2AXm5sU7CSbYYAgkt2ZPhDz+A==} + '@vue/compiler-ssr@3.5.11': + resolution: {integrity: sha512-P4+GPjOuC2aFTk1Z4WANvEhyOykcvEd5bIj2KVNGKGfM745LaXGr++5njpdBTzVz5pZifdlR1kpYSJJpIlSePA==} '@vue/compiler-vue2@2.7.16': resolution: {integrity: sha512-qYC3Psj9S/mfu9uVi5WvNZIzq+xnXMhOwbTFKKDD7b1lhpnn71jXSFdTQ+WsIEk0ONCd7VV2IMm7ONl6tbQ86A==} @@ -690,22 +690,22 @@ packages: typescript: optional: true - '@vue/reactivity@3.5.10': - resolution: {integrity: sha512-kW08v06F6xPSHhid9DJ9YjOGmwNDOsJJQk0ax21wKaUYzzuJGEuoKNU2Ujux8FLMrP7CFJJKsHhXN9l2WOVi2g==} + '@vue/reactivity@3.5.11': + resolution: {integrity: sha512-Nqo5VZEn8MJWlCce8XoyVqHZbd5P2NH+yuAaFzuNSR96I+y1cnuUiq7xfSG+kyvLSiWmaHTKP1r3OZY4mMD50w==} - '@vue/runtime-core@3.5.10': - resolution: {integrity: sha512-9Q86I5Qq3swSkFfzrZ+iqEy7Vla325M7S7xc1NwKnRm/qoi1Dauz0rT6mTMmscqx4qz0EDJ1wjB+A36k7rl8mA==} + '@vue/runtime-core@3.5.11': + resolution: {integrity: sha512-7PsxFGqwfDhfhh0OcDWBG1DaIQIVOLgkwA5q6MtkPiDFjp5gohVnJEahSktwSFLq7R5PtxDKy6WKURVN1UDbzA==} - '@vue/runtime-dom@3.5.10': - resolution: {integrity: sha512-t3x7ht5qF8ZRi1H4fZqFzyY2j+GTMTDxRheT+i8M9Ph0oepUxoadmbwlFwMoW7RYCpNQLpP2Yx3feKs+fyBdpA==} + '@vue/runtime-dom@3.5.11': + resolution: {integrity: sha512-GNghjecT6IrGf0UhuYmpgaOlN7kxzQBhxWEn08c/SQDxv1yy4IXI1bn81JgEpQ4IXjRxWtPyI8x0/7TF5rPfYQ==} - '@vue/server-renderer@3.5.10': - resolution: {integrity: sha512-IVE97tt2kGKwHNq9yVO0xdh1IvYfZCShvDSy46JIh5OQxP1/EXSpoDqetVmyIzL7CYOWnnmMkVqd7YK2QSWkdw==} + '@vue/server-renderer@3.5.11': + resolution: {integrity: sha512-cVOwYBxR7Wb1B1FoxYvtjJD8X/9E5nlH4VSkJy2uMA1MzYNdzAAB//l8nrmN9py/4aP+3NjWukf9PZ3TeWULaA==} peerDependencies: - vue: 3.5.10 + vue: 3.5.11 - '@vue/shared@3.5.10': - resolution: {integrity: sha512-VkkBhU97Ki+XJ0xvl4C9YJsIZ2uIlQ7HqPpZOS3m9VCvmROPaChZU6DexdMJqvz9tbgG+4EtFVrSuailUq5KGQ==} + '@vue/shared@3.5.11': + resolution: {integrity: sha512-W8GgysJVnFo81FthhzurdRAWP/byq3q2qIw70e0JWblzVhjgOMiC2GyovXrZTFQJnFVryYaKGP3Tc9vYzYm6PQ==} '@vueuse/core@11.1.0': resolution: {integrity: sha512-P6dk79QYA6sKQnghrUz/1tHi0n9mrb/iO1WTMk/ElLmTyNqgDeSZ3wcDf6fRBGzRJbeG1dxzEOvLENMjr+E3fg==} @@ -863,8 +863,8 @@ packages: resolution: {integrity: sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==} engines: {node: '>=0.12'} - es-toolkit@1.23.0: - resolution: {integrity: sha512-1Caq9T90fX973dnm8BIEBN9l9pffbxxbZYZYwIy/B4g8oFwNTMcbbqzvIWV4XVZlHY6A8RLZvI/3agxF0CmOPA==} + es-toolkit@1.24.0: + resolution: {integrity: sha512-nZM+MRSGhKjCdjvqWEFr5Jns6vxoXtBcsl4/cEsGMgsMx8Z2ato4vBTGMUSIQBZJgEdKyNcgGh42yu9xiuNYtQ==} esbuild@0.21.5: resolution: {integrity: sha512-mg3OPMV4hXywwpoDxu3Qda5xCKQi+vCTZq8S9J/EpkhB2HzKXq4SNFZE3+NK93JYxc8VMSep+lOUSC/RVKaBqw==} @@ -1187,8 +1187,8 @@ packages: resolution: {integrity: sha512-56rxCq7G/XfB4EkXq9Egn5GCqugWvDFjafDOThIdMBsI15iqPqR5r15TfSr1YPYeEI19YeaXMCbY6u88Y76GLQ==} engines: {node: ^10 || ^12 || >=14} - preact@10.24.1: - resolution: {integrity: sha512-PnBAwFI3Yjxxcxw75n6VId/5TFxNW/81zexzWD9jn1+eSrOP84NdsS38H5IkF/UH3frqRPT+MvuCoVHjTDTnDw==} + preact@10.24.2: + resolution: {integrity: sha512-1cSoF0aCC8uaARATfrlz4VCBqE8LwZwRfLgkxJOQwAlQt6ayTmi0D9OF7nXid1POI5SZidFuG9CnlXbDfLqY/Q==} property-information@6.5.0: resolution: {integrity: sha512-PgTgs/BlvHxOu8QuEN7wi5A0OmXaBcHpmCSTehcs6Uuu9IkDIEo13Hy7n898RHfrQ49vKCoGeWZSaAK01nwVig==} @@ -1196,8 +1196,8 @@ packages: queue-microtask@1.2.3: resolution: {integrity: sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==} - regex@4.3.2: - resolution: {integrity: sha512-kK/AA3A9K6q2js89+VMymcboLOlF5lZRCYJv3gzszXFHBr6kO6qLGzbm+UIugBEV8SMMKCTR59txoY6ctRHYVw==} + regex@4.3.3: + resolution: {integrity: sha512-r/AadFO7owAq1QJVeZ/nq9jNS1vyZt+6t1p/E59B56Rn2GCya+gr1KSyOzNL/er+r+B7phv5jG2xU2Nz1YkmJg==} resolve-pkg-maps@1.0.0: resolution: {integrity: sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==} @@ -1209,8 +1209,8 @@ packages: rfdc@1.4.1: resolution: {integrity: sha512-q1b3N5QkRUWUl7iyylaaj3kOpIT0N2i9MqIEQXP73GVsN9cw3fdx8X63cEmWhJGi2PPCF23Ijp7ktmd39rawIA==} - rollup@4.23.0: - resolution: {integrity: sha512-vXB4IT9/KLDrS2WRXmY22sVB2wTsTwkpxjB8Q3mnakTENcYw3FRmfdYDy/acNmls+lHmDazgrRjK/yQ6hQAtwA==} + rollup@4.24.0: + resolution: {integrity: sha512-DOmrlGSXNk1DM0ljiQA+i+o0rSLhtii1je5wgk60j49d1jHT5YYttBv1iWOnYSTG+fZZESUOSNiAl89SIet+Cg==} engines: {node: '>=18.0.0', npm: '>=8.0.0'} hasBin: true @@ -1232,8 +1232,8 @@ packages: resolution: {integrity: sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==} engines: {node: '>=8'} - shiki@1.21.0: - resolution: {integrity: sha512-apCH5BoWTrmHDPGgg3RF8+HAAbEL/CdbYr8rMw7eIrdhCkZHdVGat5mMNlRtd1erNG01VPMIKHNQ0Pj2HMAiog==} + shiki@1.22.0: + resolution: {integrity: sha512-/t5LlhNs+UOKQCYBtl5ZsH/Vclz73GIqT2yQsCBygr8L/ppTdmpL4w3kPLoZJbMKVWtoG77Ue1feOjZfDxvMkw==} signal-exit@4.1.0: resolution: {integrity: sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==} @@ -1415,8 +1415,8 @@ packages: peerDependencies: vue: ^3.0.0 - vue@3.5.10: - resolution: {integrity: sha512-Vy2kmJwHPlouC/tSnIgXVg03SG+9wSqT1xu1Vehc+ChsXsRd7jLkKgMltVEFOzUdBr3uFwBCG+41LJtfAcBRng==} + vue@3.5.11: + resolution: {integrity: sha512-/8Wurrd9J3lb72FTQS7gRMNQD4nztTtKPmuDuPuhqXmmpD6+skVjAeahNpVzsuky6Sy9gy7wn8UadqPtt9SQIg==} peerDependencies: typescript: '*' peerDependenciesMeta: @@ -1566,18 +1566,18 @@ snapshots: '@algolia/logger-common': 4.24.0 '@algolia/requester-common': 4.24.0 - '@babel/helper-string-parser@7.24.8': {} + '@babel/helper-string-parser@7.25.7': {} - '@babel/helper-validator-identifier@7.24.7': {} + '@babel/helper-validator-identifier@7.25.7': {} - '@babel/parser@7.25.6': + '@babel/parser@7.25.7': dependencies: - '@babel/types': 7.25.6 + '@babel/types': 7.25.7 - '@babel/types@7.25.6': + '@babel/types@7.25.7': dependencies: - '@babel/helper-string-parser': 7.24.8 - '@babel/helper-validator-identifier': 7.24.7 + '@babel/helper-string-parser': 7.25.7 + '@babel/helper-validator-identifier': 7.25.7 to-fast-properties: 2.0.0 '@docsearch/css@3.6.2': {} @@ -1585,7 +1585,7 @@ snapshots: '@docsearch/js@3.6.2(@algolia/client-search@5.7.0)(search-insights@2.17.2)': dependencies: '@docsearch/react': 3.6.2(@algolia/client-search@5.7.0)(search-insights@2.17.2) - preact: 10.24.1 + preact: 10.24.2 transitivePeerDependencies: - '@algolia/client-search' - '@types/react' @@ -1781,109 +1781,109 @@ snapshots: '@pkgjs/parseargs@0.11.0': optional: true - '@rollup/rollup-android-arm-eabi@4.23.0': + '@rollup/rollup-android-arm-eabi@4.24.0': optional: true - '@rollup/rollup-android-arm64@4.23.0': + '@rollup/rollup-android-arm64@4.24.0': optional: true - '@rollup/rollup-darwin-arm64@4.23.0': + '@rollup/rollup-darwin-arm64@4.24.0': optional: true - '@rollup/rollup-darwin-x64@4.23.0': + '@rollup/rollup-darwin-x64@4.24.0': optional: true - '@rollup/rollup-linux-arm-gnueabihf@4.23.0': + '@rollup/rollup-linux-arm-gnueabihf@4.24.0': optional: true - '@rollup/rollup-linux-arm-musleabihf@4.23.0': + '@rollup/rollup-linux-arm-musleabihf@4.24.0': optional: true - '@rollup/rollup-linux-arm64-gnu@4.23.0': + '@rollup/rollup-linux-arm64-gnu@4.24.0': optional: true - '@rollup/rollup-linux-arm64-musl@4.23.0': + '@rollup/rollup-linux-arm64-musl@4.24.0': optional: true - '@rollup/rollup-linux-powerpc64le-gnu@4.23.0': + '@rollup/rollup-linux-powerpc64le-gnu@4.24.0': optional: true - '@rollup/rollup-linux-riscv64-gnu@4.23.0': + '@rollup/rollup-linux-riscv64-gnu@4.24.0': optional: true - '@rollup/rollup-linux-s390x-gnu@4.23.0': + '@rollup/rollup-linux-s390x-gnu@4.24.0': optional: true - '@rollup/rollup-linux-x64-gnu@4.23.0': + '@rollup/rollup-linux-x64-gnu@4.24.0': optional: true - '@rollup/rollup-linux-x64-musl@4.23.0': + '@rollup/rollup-linux-x64-musl@4.24.0': optional: true - '@rollup/rollup-win32-arm64-msvc@4.23.0': + '@rollup/rollup-win32-arm64-msvc@4.24.0': optional: true - '@rollup/rollup-win32-ia32-msvc@4.23.0': + '@rollup/rollup-win32-ia32-msvc@4.24.0': optional: true - '@rollup/rollup-win32-x64-msvc@4.23.0': + '@rollup/rollup-win32-x64-msvc@4.24.0': optional: true - '@shikijs/core@1.21.0': + '@shikijs/core@1.22.0': dependencies: - '@shikijs/engine-javascript': 1.21.0 - '@shikijs/engine-oniguruma': 1.21.0 - '@shikijs/types': 1.21.0 - '@shikijs/vscode-textmate': 9.2.2 + '@shikijs/engine-javascript': 1.22.0 + '@shikijs/engine-oniguruma': 1.22.0 + '@shikijs/types': 1.22.0 + '@shikijs/vscode-textmate': 9.3.0 '@types/hast': 3.0.4 hast-util-to-html: 9.0.3 - '@shikijs/engine-javascript@1.21.0': + '@shikijs/engine-javascript@1.22.0': dependencies: - '@shikijs/types': 1.21.0 - '@shikijs/vscode-textmate': 9.2.2 + '@shikijs/types': 1.22.0 + '@shikijs/vscode-textmate': 9.3.0 oniguruma-to-js: 0.4.3 - '@shikijs/engine-oniguruma@1.21.0': + '@shikijs/engine-oniguruma@1.22.0': dependencies: - '@shikijs/types': 1.21.0 - '@shikijs/vscode-textmate': 9.2.2 + '@shikijs/types': 1.22.0 + '@shikijs/vscode-textmate': 9.3.0 - '@shikijs/transformers@1.21.0': + '@shikijs/transformers@1.22.0': dependencies: - shiki: 1.21.0 + shiki: 1.22.0 - '@shikijs/twoslash@1.21.0(typescript@5.6.2)': + '@shikijs/twoslash@1.22.0(typescript@5.6.2)': dependencies: - '@shikijs/core': 1.21.0 - '@shikijs/types': 1.21.0 + '@shikijs/core': 1.22.0 + '@shikijs/types': 1.22.0 twoslash: 0.2.12(typescript@5.6.2) transitivePeerDependencies: - supports-color - typescript - '@shikijs/types@1.21.0': + '@shikijs/types@1.22.0': dependencies: - '@shikijs/vscode-textmate': 9.2.2 + '@shikijs/vscode-textmate': 9.3.0 '@types/hast': 3.0.4 - '@shikijs/vitepress-twoslash@1.21.0(typescript@5.6.2)': + '@shikijs/vitepress-twoslash@1.22.0(typescript@5.6.2)': dependencies: - '@shikijs/twoslash': 1.21.0(typescript@5.6.2) - floating-vue: 5.2.2(vue@3.5.10(typescript@5.6.2)) + '@shikijs/twoslash': 1.22.0(typescript@5.6.2) + floating-vue: 5.2.2(vue@3.5.11(typescript@5.6.2)) mdast-util-from-markdown: 2.0.1 mdast-util-gfm: 3.0.0 mdast-util-to-hast: 13.2.0 - shiki: 1.21.0 + shiki: 1.22.0 twoslash: 0.2.12(typescript@5.6.2) twoslash-vue: 0.2.12(typescript@5.6.2) - vue: 3.5.10(typescript@5.6.2) + vue: 3.5.11(typescript@5.6.2) transitivePeerDependencies: - '@nuxt/kit' - supports-color - typescript - '@shikijs/vscode-textmate@9.2.2': {} + '@shikijs/vscode-textmate@9.3.0': {} '@sindresorhus/merge-streams@2.3.0': {} @@ -1929,46 +1929,46 @@ snapshots: '@ungap/structured-clone@1.2.0': {} - '@vitejs/plugin-vue@5.1.4(vite@5.4.8)(vue@3.5.10(typescript@5.6.2))': + '@vitejs/plugin-vue@5.1.4(vite@5.4.8)(vue@3.5.11(typescript@5.6.2))': dependencies: vite: 5.4.8 - vue: 3.5.10(typescript@5.6.2) + vue: 3.5.11(typescript@5.6.2) - '@volar/language-core@2.4.5': + '@volar/language-core@2.4.6': dependencies: - '@volar/source-map': 2.4.5 + '@volar/source-map': 2.4.6 - '@volar/source-map@2.4.5': {} + '@volar/source-map@2.4.6': {} - '@vue/compiler-core@3.5.10': + '@vue/compiler-core@3.5.11': dependencies: - '@babel/parser': 7.25.6 - '@vue/shared': 3.5.10 + '@babel/parser': 7.25.7 + '@vue/shared': 3.5.11 entities: 4.5.0 estree-walker: 2.0.2 source-map-js: 1.2.1 - '@vue/compiler-dom@3.5.10': + '@vue/compiler-dom@3.5.11': dependencies: - '@vue/compiler-core': 3.5.10 - '@vue/shared': 3.5.10 + '@vue/compiler-core': 3.5.11 + '@vue/shared': 3.5.11 - '@vue/compiler-sfc@3.5.10': + '@vue/compiler-sfc@3.5.11': dependencies: - '@babel/parser': 7.25.6 - '@vue/compiler-core': 3.5.10 - '@vue/compiler-dom': 3.5.10 - '@vue/compiler-ssr': 3.5.10 - '@vue/shared': 3.5.10 + '@babel/parser': 7.25.7 + '@vue/compiler-core': 3.5.11 + '@vue/compiler-dom': 3.5.11 + '@vue/compiler-ssr': 3.5.11 + '@vue/shared': 3.5.11 estree-walker: 2.0.2 magic-string: 0.30.11 postcss: 8.4.47 source-map-js: 1.2.1 - '@vue/compiler-ssr@3.5.10': + '@vue/compiler-ssr@3.5.11': dependencies: - '@vue/compiler-dom': 3.5.10 - '@vue/shared': 3.5.10 + '@vue/compiler-dom': 3.5.11 + '@vue/shared': 3.5.11 '@vue/compiler-vue2@2.7.16': dependencies: @@ -1995,10 +1995,10 @@ snapshots: '@vue/language-core@2.1.6(typescript@5.6.2)': dependencies: - '@volar/language-core': 2.4.5 - '@vue/compiler-dom': 3.5.10 + '@volar/language-core': 2.4.6 + '@vue/compiler-dom': 3.5.11 '@vue/compiler-vue2': 2.7.16 - '@vue/shared': 3.5.10 + '@vue/shared': 3.5.11 computeds: 0.0.1 minimatch: 9.0.5 muggle-string: 0.4.1 @@ -2006,45 +2006,45 @@ snapshots: optionalDependencies: typescript: 5.6.2 - '@vue/reactivity@3.5.10': + '@vue/reactivity@3.5.11': dependencies: - '@vue/shared': 3.5.10 + '@vue/shared': 3.5.11 - '@vue/runtime-core@3.5.10': + '@vue/runtime-core@3.5.11': dependencies: - '@vue/reactivity': 3.5.10 - '@vue/shared': 3.5.10 + '@vue/reactivity': 3.5.11 + '@vue/shared': 3.5.11 - '@vue/runtime-dom@3.5.10': + '@vue/runtime-dom@3.5.11': dependencies: - '@vue/reactivity': 3.5.10 - '@vue/runtime-core': 3.5.10 - '@vue/shared': 3.5.10 + '@vue/reactivity': 3.5.11 + '@vue/runtime-core': 3.5.11 + '@vue/shared': 3.5.11 csstype: 3.1.3 - '@vue/server-renderer@3.5.10(vue@3.5.10(typescript@5.6.2))': + '@vue/server-renderer@3.5.11(vue@3.5.11(typescript@5.6.2))': dependencies: - '@vue/compiler-ssr': 3.5.10 - '@vue/shared': 3.5.10 - vue: 3.5.10(typescript@5.6.2) + '@vue/compiler-ssr': 3.5.11 + '@vue/shared': 3.5.11 + vue: 3.5.11(typescript@5.6.2) - '@vue/shared@3.5.10': {} + '@vue/shared@3.5.11': {} - '@vueuse/core@11.1.0(vue@3.5.10(typescript@5.6.2))': + '@vueuse/core@11.1.0(vue@3.5.11(typescript@5.6.2))': dependencies: '@types/web-bluetooth': 0.0.20 '@vueuse/metadata': 11.1.0 - '@vueuse/shared': 11.1.0(vue@3.5.10(typescript@5.6.2)) - vue-demi: 0.14.10(vue@3.5.10(typescript@5.6.2)) + '@vueuse/shared': 11.1.0(vue@3.5.11(typescript@5.6.2)) + vue-demi: 0.14.10(vue@3.5.11(typescript@5.6.2)) transitivePeerDependencies: - '@vue/composition-api' - vue - '@vueuse/integrations@11.1.0(focus-trap@7.6.0)(vue@3.5.10(typescript@5.6.2))': + '@vueuse/integrations@11.1.0(focus-trap@7.6.0)(vue@3.5.11(typescript@5.6.2))': dependencies: - '@vueuse/core': 11.1.0(vue@3.5.10(typescript@5.6.2)) - '@vueuse/shared': 11.1.0(vue@3.5.10(typescript@5.6.2)) - vue-demi: 0.14.10(vue@3.5.10(typescript@5.6.2)) + '@vueuse/core': 11.1.0(vue@3.5.11(typescript@5.6.2)) + '@vueuse/shared': 11.1.0(vue@3.5.11(typescript@5.6.2)) + vue-demi: 0.14.10(vue@3.5.11(typescript@5.6.2)) optionalDependencies: focus-trap: 7.6.0 transitivePeerDependencies: @@ -2053,9 +2053,9 @@ snapshots: '@vueuse/metadata@11.1.0': {} - '@vueuse/shared@11.1.0(vue@3.5.10(typescript@5.6.2))': + '@vueuse/shared@11.1.0(vue@3.5.11(typescript@5.6.2))': dependencies: - vue-demi: 0.14.10(vue@3.5.10(typescript@5.6.2)) + vue-demi: 0.14.10(vue@3.5.11(typescript@5.6.2)) transitivePeerDependencies: - '@vue/composition-api' - vue @@ -2158,7 +2158,7 @@ snapshots: entities@4.5.0: {} - es-toolkit@1.23.0: {} + es-toolkit@1.24.0: {} esbuild@0.21.5: optionalDependencies: @@ -2239,11 +2239,11 @@ snapshots: dependencies: to-regex-range: 5.0.1 - floating-vue@5.2.2(vue@3.5.10(typescript@5.6.2)): + floating-vue@5.2.2(vue@3.5.11(typescript@5.6.2)): dependencies: '@floating-ui/dom': 1.1.1 - vue: 3.5.10(typescript@5.6.2) - vue-resize: 2.0.0-alpha.1(vue@3.5.10(typescript@5.6.2)) + vue: 3.5.11(typescript@5.6.2) + vue-resize: 2.0.0-alpha.1(vue@3.5.11(typescript@5.6.2)) focus-trap@7.6.0: dependencies: @@ -2630,7 +2630,7 @@ snapshots: oniguruma-to-js@0.4.3: dependencies: - regex: 4.3.2 + regex: 4.3.3 package-json-from-dist@1.0.1: {} @@ -2657,13 +2657,13 @@ snapshots: picocolors: 1.1.0 source-map-js: 1.2.1 - preact@10.24.1: {} + preact@10.24.2: {} property-information@6.5.0: {} queue-microtask@1.2.3: {} - regex@4.3.2: {} + regex@4.3.3: {} resolve-pkg-maps@1.0.0: {} @@ -2671,26 +2671,26 @@ snapshots: rfdc@1.4.1: {} - rollup@4.23.0: + rollup@4.24.0: dependencies: '@types/estree': 1.0.6 optionalDependencies: - '@rollup/rollup-android-arm-eabi': 4.23.0 - '@rollup/rollup-android-arm64': 4.23.0 - '@rollup/rollup-darwin-arm64': 4.23.0 - '@rollup/rollup-darwin-x64': 4.23.0 - '@rollup/rollup-linux-arm-gnueabihf': 4.23.0 - '@rollup/rollup-linux-arm-musleabihf': 4.23.0 - '@rollup/rollup-linux-arm64-gnu': 4.23.0 - '@rollup/rollup-linux-arm64-musl': 4.23.0 - '@rollup/rollup-linux-powerpc64le-gnu': 4.23.0 - '@rollup/rollup-linux-riscv64-gnu': 4.23.0 - '@rollup/rollup-linux-s390x-gnu': 4.23.0 - '@rollup/rollup-linux-x64-gnu': 4.23.0 - '@rollup/rollup-linux-x64-musl': 4.23.0 - '@rollup/rollup-win32-arm64-msvc': 4.23.0 - '@rollup/rollup-win32-ia32-msvc': 4.23.0 - '@rollup/rollup-win32-x64-msvc': 4.23.0 + '@rollup/rollup-android-arm-eabi': 4.24.0 + '@rollup/rollup-android-arm64': 4.24.0 + '@rollup/rollup-darwin-arm64': 4.24.0 + '@rollup/rollup-darwin-x64': 4.24.0 + '@rollup/rollup-linux-arm-gnueabihf': 4.24.0 + '@rollup/rollup-linux-arm-musleabihf': 4.24.0 + '@rollup/rollup-linux-arm64-gnu': 4.24.0 + '@rollup/rollup-linux-arm64-musl': 4.24.0 + '@rollup/rollup-linux-powerpc64le-gnu': 4.24.0 + '@rollup/rollup-linux-riscv64-gnu': 4.24.0 + '@rollup/rollup-linux-s390x-gnu': 4.24.0 + '@rollup/rollup-linux-x64-gnu': 4.24.0 + '@rollup/rollup-linux-x64-musl': 4.24.0 + '@rollup/rollup-win32-arm64-msvc': 4.24.0 + '@rollup/rollup-win32-ia32-msvc': 4.24.0 + '@rollup/rollup-win32-x64-msvc': 4.24.0 fsevents: 2.3.3 run-parallel@1.2.0: @@ -2710,13 +2710,13 @@ snapshots: shebang-regex@3.0.0: {} - shiki@1.21.0: + shiki@1.22.0: dependencies: - '@shikijs/core': 1.21.0 - '@shikijs/engine-javascript': 1.21.0 - '@shikijs/engine-oniguruma': 1.21.0 - '@shikijs/types': 1.21.0 - '@shikijs/vscode-textmate': 9.2.2 + '@shikijs/core': 1.22.0 + '@shikijs/engine-javascript': 1.22.0 + '@shikijs/engine-oniguruma': 1.22.0 + '@shikijs/types': 1.22.0 + '@shikijs/vscode-textmate': 9.3.0 '@types/hast': 3.0.4 signal-exit@4.1.0: {} @@ -2839,14 +2839,14 @@ snapshots: dependencies: esbuild: 0.21.5 postcss: 8.4.47 - rollup: 4.23.0 + rollup: 4.24.0 optionalDependencies: fsevents: 2.3.3 - vitepress-plugin-tabs@0.5.0(vitepress@1.3.4(@algolia/client-search@5.7.0)(postcss@8.4.47)(search-insights@2.17.2)(typescript@5.6.2))(vue@3.5.10(typescript@5.6.2)): + vitepress-plugin-tabs@0.5.0(vitepress@1.3.4(@algolia/client-search@5.7.0)(postcss@8.4.47)(search-insights@2.17.2)(typescript@5.6.2))(vue@3.5.11(typescript@5.6.2)): dependencies: vitepress: 1.3.4(@algolia/client-search@5.7.0)(postcss@8.4.47)(search-insights@2.17.2)(typescript@5.6.2) - vue: 3.5.10(typescript@5.6.2) + vue: 3.5.11(typescript@5.6.2) vitepress-sidebar@1.27.1: dependencies: @@ -2857,20 +2857,20 @@ snapshots: dependencies: '@docsearch/css': 3.6.2 '@docsearch/js': 3.6.2(@algolia/client-search@5.7.0)(search-insights@2.17.2) - '@shikijs/core': 1.21.0 - '@shikijs/transformers': 1.21.0 + '@shikijs/core': 1.22.0 + '@shikijs/transformers': 1.22.0 '@types/markdown-it': 14.1.2 - '@vitejs/plugin-vue': 5.1.4(vite@5.4.8)(vue@3.5.10(typescript@5.6.2)) + '@vitejs/plugin-vue': 5.1.4(vite@5.4.8)(vue@3.5.11(typescript@5.6.2)) '@vue/devtools-api': 7.4.6 - '@vue/shared': 3.5.10 - '@vueuse/core': 11.1.0(vue@3.5.10(typescript@5.6.2)) - '@vueuse/integrations': 11.1.0(focus-trap@7.6.0)(vue@3.5.10(typescript@5.6.2)) + '@vue/shared': 3.5.11 + '@vueuse/core': 11.1.0(vue@3.5.11(typescript@5.6.2)) + '@vueuse/integrations': 11.1.0(focus-trap@7.6.0)(vue@3.5.11(typescript@5.6.2)) focus-trap: 7.6.0 mark.js: 8.11.1 minisearch: 7.1.0 - shiki: 1.21.0 + shiki: 1.22.0 vite: 5.4.8 - vue: 3.5.10(typescript@5.6.2) + vue: 3.5.11(typescript@5.6.2) optionalDependencies: postcss: 8.4.47 transitivePeerDependencies: @@ -2901,21 +2901,21 @@ snapshots: - typescript - universal-cookie - vue-demi@0.14.10(vue@3.5.10(typescript@5.6.2)): + vue-demi@0.14.10(vue@3.5.11(typescript@5.6.2)): dependencies: - vue: 3.5.10(typescript@5.6.2) + vue: 3.5.11(typescript@5.6.2) - vue-resize@2.0.0-alpha.1(vue@3.5.10(typescript@5.6.2)): + vue-resize@2.0.0-alpha.1(vue@3.5.11(typescript@5.6.2)): dependencies: - vue: 3.5.10(typescript@5.6.2) + vue: 3.5.11(typescript@5.6.2) - vue@3.5.10(typescript@5.6.2): + vue@3.5.11(typescript@5.6.2): dependencies: - '@vue/compiler-dom': 3.5.10 - '@vue/compiler-sfc': 3.5.10 - '@vue/runtime-dom': 3.5.10 - '@vue/server-renderer': 3.5.10(vue@3.5.10(typescript@5.6.2)) - '@vue/shared': 3.5.10 + '@vue/compiler-dom': 3.5.11 + '@vue/compiler-sfc': 3.5.11 + '@vue/runtime-dom': 3.5.11 + '@vue/server-renderer': 3.5.11(vue@3.5.11(typescript@5.6.2)) + '@vue/shared': 3.5.11 optionalDependencies: typescript: 5.6.2 diff --git a/website/pokemon/modules/Global.ts b/website/pokemon/modules/Global.ts index b74f948a..050afdf8 100644 --- a/website/pokemon/modules/Global.ts +++ b/website/pokemon/modules/Global.ts @@ -2,7 +2,6 @@ import type * as Data from './Data.js' import type * as MethodsDocument from './MethodsDocument.js' import type * as MethodsRoot from './MethodsRoot.js' import type * as MethodsSelect from './MethodsSelect.js' -import type * as SchemaCustomScalarIndex from './SchemaCustomScalarIndex.js' import type { Index } from './SchemaIndex.js' declare global { diff --git a/website/pokemon/modules/RuntimeCustomScalars.ts b/website/pokemon/modules/RuntimeCustomScalars.ts new file mode 100644 index 00000000..f76b2632 --- /dev/null +++ b/website/pokemon/modules/RuntimeCustomScalars.ts @@ -0,0 +1,72 @@ +import * as CustomScalars from './Scalar.js' +// +// +// +// +// +// +// ================================================================================================== +// GraphQLInputObjectType +// ================================================================================================== +// +// +// +// +// +// + +// None of your GraphQLInputObjectTypes have custom scalars. + +// +// +// +// +// +// +// ================================================================================================== +// GraphQLObjectType +// ================================================================================================== +// +// +// +// +// +// + +// None of your GraphQLObjectTypes have custom scalars. + +// +// +// +// +// +// +// ================================================================================================== +// GraphQLRootType +// ================================================================================================== +// +// +// +// +// +// + +// None of your GraphQLRootTypes have custom scalars. + +// +// +// +// +// +// +// ================================================================================================== +// Index +// ================================================================================================== +// +// +// +// +// +// + +export const $index = {} diff --git a/website/pokemon/modules/SchemaIndex.ts b/website/pokemon/modules/SchemaIndex.ts index aec1fbea..df7d5b1c 100644 --- a/website/pokemon/modules/SchemaIndex.ts +++ b/website/pokemon/modules/SchemaIndex.ts @@ -1,4 +1,5 @@ /* eslint-disable */ +import type * as Utilities from 'graffle/utilities-for-generated' import type * as Data from './Data.js' import type * as MethodsRoot from './MethodsRoot.js' import type * as Schema from './SchemaBuildtime.js' @@ -45,6 +46,7 @@ export interface Index { interfaces: { Being: Schema.Interface.Being } + customScalars: Utilities.SchemaIndexBase['customScalars'] error: { objects: {} objectsTypename: {} diff --git a/website/pokemon/modules/SchemaRuntime.ts b/website/pokemon/modules/SchemaRuntime.ts index 96908065..04db7fb1 100644 --- a/website/pokemon/modules/SchemaRuntime.ts +++ b/website/pokemon/modules/SchemaRuntime.ts @@ -1,6 +1,7 @@ /* eslint-disable */ import * as $ from 'graffle/schema' import * as Data from './Data.js' +import { $index as $customScalarsIndex } from './RuntimeCustomScalars.js' import * as $Scalar from './Scalar.js' import type { Index } from './SchemaIndex.js' export const $defaultSchemaUrl = new URL('http://localhost:3000/graphql') @@ -212,6 +213,9 @@ export const $Index: Index = { interfaces: { Being, }, + customScalars: { + input: $customScalarsIndex, + }, error: { objects: {}, objectsTypename: {}, diff --git a/website/pokemon/modules/SelectionSets.ts b/website/pokemon/modules/SelectionSets.ts index 466ca6f2..0655efe3 100644 --- a/website/pokemon/modules/SelectionSets.ts +++ b/website/pokemon/modules/SelectionSets.ts @@ -94,7 +94,7 @@ export namespace Mutation { defense?: number | undefined | null hp?: number | undefined | null name: string - type: _RefDefs._PokemonType + $type: _RefDefs._PokemonType } } export type addPokemon$Expanded = addPokemon