From c3a1718a91052af29e1331dc54e2ddd0557f87ab Mon Sep 17 00:00:00 2001 From: Jason Kuhrt Date: Thu, 4 Jul 2024 23:03:06 -0400 Subject: [PATCH] feat: raw overload (#968) --- README.md | 34 ++++++------- examples/Graffle.ts | 21 ++++++++ .../configuration-fetch-options.ts | 2 +- .../configuration-incremental-endpoint.ts | 2 +- ...nfiguration-incremental-request-headers.ts | 2 +- .../configuration-request-json-serializer.ts | 2 +- .../{ => legacy}/graphql-batching-requests.ts | 2 +- .../graphql-document-variables.ts | 2 +- examples/{ => legacy}/graphql-mutations.ts | 2 +- examples/{ => legacy}/other-error-handling.ts | 2 +- examples/{ => legacy}/other-middleware.ts | 4 +- .../request-authentication-via-http-header.ts | 2 +- examples/{ => legacy}/request-cancellation.ts | 2 +- .../request-handle-raw-response.ts | 2 +- .../request-headers-dynamic-per-request.ts | 2 +- .../request-headers-static-per-request.ts | 2 +- examples/{ => legacy}/request-method-get.ts | 2 +- examples/{ => legacy}/schema.graphql | 0 .../typescript-typed-document-node.ts | 2 +- src/entrypoints/alpha/main.ts | 1 + src/layers/0_functions/requestOrExecute.ts | 0 src/layers/5_core/core.ts | 20 ++++---- src/layers/6_client/client.raw.test.ts | 32 ++++++++++++- src/layers/6_client/client.test.ts | 4 +- src/layers/6_client/client.ts | 48 ++++++++++++++----- 25 files changed, 136 insertions(+), 58 deletions(-) create mode 100644 examples/Graffle.ts rename examples/{ => legacy}/configuration-fetch-options.ts (87%) rename examples/{ => legacy}/configuration-incremental-endpoint.ts (83%) rename examples/{ => legacy}/configuration-incremental-request-headers.ts (87%) rename examples/{ => legacy}/configuration-request-json-serializer.ts (89%) rename examples/{ => legacy}/graphql-batching-requests.ts (93%) rename examples/{ => legacy}/graphql-document-variables.ts (87%) rename examples/{ => legacy}/graphql-mutations.ts (88%) rename examples/{ => legacy}/other-error-handling.ts (89%) rename examples/{ => legacy}/other-middleware.ts (91%) rename examples/{ => legacy}/request-authentication-via-http-header.ts (87%) rename examples/{ => legacy}/request-cancellation.ts (93%) rename examples/{ => legacy}/request-handle-raw-response.ts (90%) rename examples/{ => legacy}/request-headers-dynamic-per-request.ts (89%) rename examples/{ => legacy}/request-headers-static-per-request.ts (91%) rename examples/{ => legacy}/request-method-get.ts (89%) rename examples/{ => legacy}/schema.graphql (100%) rename examples/{ => legacy}/typescript-typed-document-node.ts (91%) delete mode 100644 src/layers/0_functions/requestOrExecute.ts diff --git a/README.md b/README.md index 1854e9705..d29cac298 100644 --- a/README.md +++ b/README.md @@ -101,26 +101,26 @@ await client.request(document) ## Examples - Request: - - [Authentication via HTTP header](./examples/request-authentication-via-http-header.ts) - - [Method GET](./examples/request-method-get.ts) - - [Cancellation](./examples/request-cancellation.ts) - - [Headers Per Request (static)](./examples/request-headers-static-per-request.ts) - - [Headers Per Request (dynamic)](./examples/request-headers-dynamic-per-request.ts) - - [Handle Raw Response](./examples/request-handle-raw-response.ts) + - [Authentication via HTTP header](./examples/legacy/request-authentication-via-http-header.ts) + - [Method GET](./examples/legacy/request-method-get.ts) + - [Cancellation](./examples/legacy/request-cancellation.ts) + - [Headers Per Request (static)](./examples/legacy/request-headers-static-per-request.ts) + - [Headers Per Request (dynamic)](./examples/legacy/request-headers-dynamic-per-request.ts) + - [Handle Raw Response](./examples/legacy/request-handle-raw-response.ts) - GraphQL: - - [Document Variables](./examples/graphql-document-variables.ts) - - [Mutation](./examples/graphql-mutations.ts) - - [Batching Requests](./examples/graphql-batching-requests.ts) + - [Document Variables](./examples/legacy/graphql-document-variables.ts) + - [Mutation](./examples/legacy/graphql-mutations.ts) + - [Batching Requests](./examples/legacy/graphql-batching-requests.ts) - Configuration: - - [Fetch: Passing Options](./examples/configuration-fetch-options.ts) - - [Custom JSON Serializer](./examples/configuration-request-json-serializer.ts) - - [Incremental: Set Endpoint](./examples/configuration-incremental-endpoint.ts) - - [Incremental: Set Request Headers](./examples/configuration-incremental-request-headers.ts) + - [Fetch: Passing Options](./examples/legacy/configuration-fetch-options.ts) + - [Custom JSON Serializer](./examples/legacy/configuration-request-json-serializer.ts) + - [Incremental: Set Endpoint](./examples/legacy/configuration-incremental-endpoint.ts) + - [Incremental: Set Request Headers](./examples/legacy/configuration-incremental-request-headers.ts) - TypeScript: - - [Use `TypedDocumentNode`](./examples/typescript-typed-document-node.ts) + - [Use `TypedDocumentNode`](./examples/legacy/typescript-typed-document-node.ts) - Other: - - [Middleware](./examples/other-middleware.ts) - - [Error Handling](./examples/other-error-handling.ts) + - [Middleware](./examples/legacy/other-middleware.ts) + - [Error Handling](./examples/legacy/other-error-handling.ts) ## Node Version Support @@ -136,7 +136,7 @@ Any issue that exists solely for an unsupported version of Nodejs will be reject ## Reference -⚠️ This reference is incomplete. Check out the [examples](./examples/) for more reference material. +⚠️ This reference is incomplete. Check out the [examples](./examples/legacy/) for more reference material. ### Configuration diff --git a/examples/Graffle.ts b/examples/Graffle.ts new file mode 100644 index 000000000..ced4137c1 --- /dev/null +++ b/examples/Graffle.ts @@ -0,0 +1,21 @@ +import { gql, Graffle } from '../src/entrypoints/alpha/main.js' + +const request = Graffle.create({ schema: `https://countries.trevorblades.com/graphql` }).rawOrThrow // eslint-disable-line + +// todo typed document node +// interface Data { +// countries: { name }[] +// } +// const { data } = await request( + +const { data } = await request( + gql` + { + countries { + name + } + } + `, +) + +console.log(data) diff --git a/examples/configuration-fetch-options.ts b/examples/legacy/configuration-fetch-options.ts similarity index 87% rename from examples/configuration-fetch-options.ts rename to examples/legacy/configuration-fetch-options.ts index e412eec75..82781e9e8 100644 --- a/examples/configuration-fetch-options.ts +++ b/examples/legacy/configuration-fetch-options.ts @@ -1,4 +1,4 @@ -import { gql, GraphQLClient } from '../src/entrypoints/main.js' +import { gql, GraphQLClient } from '../../src/entrypoints/main.js' const endpoint = `https://api.graph.cool/simple/v1/cixos23120m0n0173veiiwrjr` diff --git a/examples/configuration-incremental-endpoint.ts b/examples/legacy/configuration-incremental-endpoint.ts similarity index 83% rename from examples/configuration-incremental-endpoint.ts rename to examples/legacy/configuration-incremental-endpoint.ts index bb60c1136..415a9a60d 100644 --- a/examples/configuration-incremental-endpoint.ts +++ b/examples/legacy/configuration-incremental-endpoint.ts @@ -2,7 +2,7 @@ * If you want to change the endpoint after the GraphQLClient has been initialized, you can use the `setEndpoint()` function. */ -import { GraphQLClient } from '../src/entrypoints/main.js' +import { GraphQLClient } from '../../src/entrypoints/main.js' const client = new GraphQLClient(`https://api.graph.cool/simple/v1/cixos23120m0n0173veiiwrjr`) diff --git a/examples/configuration-incremental-request-headers.ts b/examples/legacy/configuration-incremental-request-headers.ts similarity index 87% rename from examples/configuration-incremental-request-headers.ts rename to examples/legacy/configuration-incremental-request-headers.ts index 1ef60bd52..e7189fb46 100644 --- a/examples/configuration-incremental-request-headers.ts +++ b/examples/legacy/configuration-incremental-request-headers.ts @@ -2,7 +2,7 @@ * If you want to set headers after the GraphQLClient has been initialized, you can use the `setHeader()` or `setHeaders()` functions. */ -import { GraphQLClient } from '../src/entrypoints/main.js' +import { GraphQLClient } from '../../src/entrypoints/main.js' const client = new GraphQLClient(`https://api.graph.cool/simple/v1/cixos23120m0n0173veiiwrjr`) diff --git a/examples/configuration-request-json-serializer.ts b/examples/legacy/configuration-request-json-serializer.ts similarity index 89% rename from examples/configuration-request-json-serializer.ts rename to examples/legacy/configuration-request-json-serializer.ts index a7300b6ed..5ca480b2f 100644 --- a/examples/configuration-request-json-serializer.ts +++ b/examples/legacy/configuration-request-json-serializer.ts @@ -4,7 +4,7 @@ */ import JSONbig from 'json-bigint' -import { gql, GraphQLClient } from '../src/entrypoints/main.js' +import { gql, GraphQLClient } from '../../src/entrypoints/main.js' const jsonSerializer = JSONbig({ useNativeBigInt: true }) const graphQLClient = new GraphQLClient(`https://some-api`, { jsonSerializer }) diff --git a/examples/graphql-batching-requests.ts b/examples/legacy/graphql-batching-requests.ts similarity index 93% rename from examples/graphql-batching-requests.ts rename to examples/legacy/graphql-batching-requests.ts index 1a5a6685b..e25e55d0f 100644 --- a/examples/graphql-batching-requests.ts +++ b/examples/legacy/graphql-batching-requests.ts @@ -2,7 +2,7 @@ * It is possible with `graphql-request` to use batching via the `batchRequests()` function. * @see https://github.com/graphql/graphql-over-http/blob/main/rfcs/Batching.md */ -import { batchRequests, gql } from '../src/entrypoints/main.js' +import { batchRequests, gql } from '../../src/entrypoints/main.js' const endpoint = `https://api.spacex.land/graphql/` diff --git a/examples/graphql-document-variables.ts b/examples/legacy/graphql-document-variables.ts similarity index 87% rename from examples/graphql-document-variables.ts rename to examples/legacy/graphql-document-variables.ts index 45dfa3272..34dc01300 100644 --- a/examples/graphql-document-variables.ts +++ b/examples/legacy/graphql-document-variables.ts @@ -1,4 +1,4 @@ -import { gql, request } from '../src/entrypoints/main.js' +import { gql, request } from '../../src/entrypoints/main.js' const endpoint = `https://api.graph.cool/simple/v1/cixos23120m0n0173veiiwrjr` diff --git a/examples/graphql-mutations.ts b/examples/legacy/graphql-mutations.ts similarity index 88% rename from examples/graphql-mutations.ts rename to examples/legacy/graphql-mutations.ts index 405bd1be5..7c5515d5d 100644 --- a/examples/graphql-mutations.ts +++ b/examples/legacy/graphql-mutations.ts @@ -1,4 +1,4 @@ -import { gql, GraphQLClient } from '../src/entrypoints/main.js' +import { gql, GraphQLClient } from '../../src/entrypoints/main.js' const endpoint = `https://api.graph.cool/simple/v1/cixos23120m0n0173veiiwrjr` diff --git a/examples/other-error-handling.ts b/examples/legacy/other-error-handling.ts similarity index 89% rename from examples/other-error-handling.ts rename to examples/legacy/other-error-handling.ts index 4a2a46170..89112f753 100644 --- a/examples/other-error-handling.ts +++ b/examples/legacy/other-error-handling.ts @@ -1,4 +1,4 @@ -import { gql, request } from '../src/entrypoints/main.js' +import { gql, request } from '../../src/entrypoints/main.js' const endpoint = `https://api.graph.cool/simple/v1/cixos23120m0n0173veiiwrjr` diff --git a/examples/other-middleware.ts b/examples/legacy/other-middleware.ts similarity index 91% rename from examples/other-middleware.ts rename to examples/legacy/other-middleware.ts index 474f823a5..f4abebde9 100644 --- a/examples/other-middleware.ts +++ b/examples/legacy/other-middleware.ts @@ -2,8 +2,8 @@ * It's possible to use a middleware to pre-process any request or handle raw response. */ -import type { RequestMiddleware, ResponseMiddleware } from '../src/entrypoints/main.js' -import { GraphQLClient } from '../src/entrypoints/main.js' +import type { RequestMiddleware, ResponseMiddleware } from '../../src/entrypoints/main.js' +import { GraphQLClient } from '../../src/entrypoints/main.js' const endpoint = `https://api.spacex.land/graphql/` diff --git a/examples/request-authentication-via-http-header.ts b/examples/legacy/request-authentication-via-http-header.ts similarity index 87% rename from examples/request-authentication-via-http-header.ts rename to examples/legacy/request-authentication-via-http-header.ts index ab26ba00b..3e442e111 100644 --- a/examples/request-authentication-via-http-header.ts +++ b/examples/legacy/request-authentication-via-http-header.ts @@ -1,4 +1,4 @@ -import { gql, GraphQLClient } from '../src/entrypoints/main.js' +import { gql, GraphQLClient } from '../../src/entrypoints/main.js' const endpoint = `https://api.graph.cool/simple/v1/cixos23120m0n0173veiiwrjr` diff --git a/examples/request-cancellation.ts b/examples/legacy/request-cancellation.ts similarity index 93% rename from examples/request-cancellation.ts rename to examples/legacy/request-cancellation.ts index b9df5fde5..04445c084 100644 --- a/examples/request-cancellation.ts +++ b/examples/legacy/request-cancellation.ts @@ -2,7 +2,7 @@ * It is possible to cancel a request using an `AbortController` signal. */ -import { gql, GraphQLClient } from '../src/entrypoints/main.js' +import { gql, GraphQLClient } from '../../src/entrypoints/main.js' const endpoint = `https://api.graph.cool/simple/v1/cixos23120m0n0173veiiwrjr` diff --git a/examples/request-handle-raw-response.ts b/examples/legacy/request-handle-raw-response.ts similarity index 90% rename from examples/request-handle-raw-response.ts rename to examples/legacy/request-handle-raw-response.ts index 4b680bd52..e4a0aea43 100644 --- a/examples/request-handle-raw-response.ts +++ b/examples/legacy/request-handle-raw-response.ts @@ -3,7 +3,7 @@ * If you need to access the `extensions` key you can use the `rawRequest` method: */ -import { gql, rawRequest } from '../src/entrypoints/main.js' +import { gql, rawRequest } from '../../src/entrypoints/main.js' const endpoint = `https://api.graph.cool/simple/v1/cixos23120m0n0173veiiwrjr` diff --git a/examples/request-headers-dynamic-per-request.ts b/examples/legacy/request-headers-dynamic-per-request.ts similarity index 89% rename from examples/request-headers-dynamic-per-request.ts rename to examples/legacy/request-headers-dynamic-per-request.ts index ebede9862..e2ad97657 100644 --- a/examples/request-headers-dynamic-per-request.ts +++ b/examples/legacy/request-headers-dynamic-per-request.ts @@ -3,7 +3,7 @@ * To do that, pass a function that returns the headers to the `headers` property when creating a new `GraphQLClient`. */ -import { gql, GraphQLClient } from '../src/entrypoints/main.js' +import { gql, GraphQLClient } from '../../src/entrypoints/main.js' const client = new GraphQLClient(`https://some-api`, { headers: () => ({ 'X-Sent-At-Time': Date.now().toString() }), diff --git a/examples/request-headers-static-per-request.ts b/examples/legacy/request-headers-static-per-request.ts similarity index 91% rename from examples/request-headers-static-per-request.ts rename to examples/legacy/request-headers-static-per-request.ts index 5e13dc412..a7f4336ef 100644 --- a/examples/request-headers-static-per-request.ts +++ b/examples/legacy/request-headers-static-per-request.ts @@ -2,7 +2,7 @@ * It is possible to pass custom headers for each request. `request()` and `rawRequest()` accept a header object as the third parameter */ -import { gql, GraphQLClient } from '../src/entrypoints/main.js' +import { gql, GraphQLClient } from '../../src/entrypoints/main.js' const endpoint = `https://api.graph.cool/simple/v1/cixos23120m0n0173veiiwrjr` diff --git a/examples/request-method-get.ts b/examples/legacy/request-method-get.ts similarity index 89% rename from examples/request-method-get.ts rename to examples/legacy/request-method-get.ts index 068605540..6b076d6c1 100644 --- a/examples/request-method-get.ts +++ b/examples/legacy/request-method-get.ts @@ -1,7 +1,7 @@ /** * Queries can be sent as an HTTP GET request: */ -import { gql, GraphQLClient } from '../src/entrypoints/main.js' +import { gql, GraphQLClient } from '../../src/entrypoints/main.js' const endpoint = `https://api.graph.cool/simple/v1/cixos23120m0n0173veiiwrjr` diff --git a/examples/schema.graphql b/examples/legacy/schema.graphql similarity index 100% rename from examples/schema.graphql rename to examples/legacy/schema.graphql diff --git a/examples/typescript-typed-document-node.ts b/examples/legacy/typescript-typed-document-node.ts similarity index 91% rename from examples/typescript-typed-document-node.ts rename to examples/legacy/typescript-typed-document-node.ts index aae922903..f936d3fbc 100644 --- a/examples/typescript-typed-document-node.ts +++ b/examples/legacy/typescript-typed-document-node.ts @@ -1,6 +1,6 @@ import type { TypedDocumentNode } from '@graphql-typed-document-node/core' import { parse } from 'graphql' -import { gql, GraphQLClient, request } from '../src/entrypoints/main.js' +import { gql, GraphQLClient, request } from '../../src/entrypoints/main.js' { const endpoint = `https://graphql-yoga.com/api/graphql` diff --git a/src/entrypoints/alpha/main.ts b/src/entrypoints/alpha/main.ts index adb68dd33..f6fe1e835 100644 --- a/src/entrypoints/alpha/main.ts +++ b/src/entrypoints/alpha/main.ts @@ -1,3 +1,4 @@ export { execute } from '../../layers/0_functions/execute.js' export { request } from '../../layers/0_functions/request.js' +export { gql } from '../../legacy/functions/gql.js' export * from './__Graffle.js' diff --git a/src/layers/0_functions/requestOrExecute.ts b/src/layers/0_functions/requestOrExecute.ts deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/layers/5_core/core.ts b/src/layers/5_core/core.ts index 92de45bd1..c9a163ca8 100644 --- a/src/layers/5_core/core.ts +++ b/src/layers/5_core/core.ts @@ -28,25 +28,25 @@ const getRootIndexOrThrow = (context: ContextInterfaceTyped, rootTypeName: strin } // eslint-disable-next-line -type InterfaceInput = +type InterfaceInput = | ({ interface: InterfaceTyped context: ContextInterfaceTyped rootTypeName: Schema.RootTypeName - } & A) + } & TypedProperties) | ({ interface: InterfaceRaw context: ContextInterfaceRaw - } & B) + } & RawProperties) // eslint-disable-next-line -type TransportInput = +type TransportInput = | ({ transport: TransportHttp - } & A) + } & HttpProperties) | ({ transport: TransportMemory - } & B) + } & MemoryProperties) export const hookNamesOrderedBySequence = [`encode`, `pack`, `exchange`, `unpack`, `decode`] as const @@ -56,7 +56,7 @@ export type HookDefEncode = { input: & InterfaceInput< { selection: GraphQLObjectSelection }, - { document: string | DocumentNode; variables?: StandardScalarVariables } + { document: string | DocumentNode; variables?: StandardScalarVariables; operationName?: string } > & TransportInput<{ schema: string | URL }, { schema: GraphQLSchema }> slots: { @@ -163,6 +163,7 @@ export const anyware = Anyware.create({ run: ({ input, slots }) => { let document: string let variables: StandardScalarVariables | undefined = undefined + let operationName: string | undefined = undefined switch (input.interface) { case `raw`: { @@ -171,6 +172,7 @@ export const anyware = Anyware.create({ : print(input.document) document = documentPrinted variables = input.variables + operationName = input.operationName break } case `typed`: { @@ -192,7 +194,7 @@ export const anyware = Anyware.create({ const body = slots.body({ query: document, variables, - operationName: `todo`, + operationName, }) return { @@ -207,7 +209,7 @@ export const anyware = Anyware.create({ schema: input.schema, query: document, variables, - // operationName: '', + operationName, } } } diff --git a/src/layers/6_client/client.raw.test.ts b/src/layers/6_client/client.raw.test.ts index 8dbfc43df..2d8687aa2 100644 --- a/src/layers/6_client/client.raw.test.ts +++ b/src/layers/6_client/client.raw.test.ts @@ -1,6 +1,8 @@ -import { expect, test } from 'vitest' +import { beforeEach, describe, expect } from 'vitest' +import { test } from '../../../tests/_/helpers.js' import { Graffle } from '../../../tests/_/schema/generated/__.js' import { schema } from '../../../tests/_/schema/schema.js' +import { createExtension } from '../5_createExtension/createExtension.js' // todo test with custom scalars @@ -21,3 +23,31 @@ test(`.raw() returns errors in array`, async () => { } `) }) + +describe(`memory transport`, () => { + let input: object | undefined + const peakInput = createExtension({ + name: `peak`, + anyware: ({ exchange }) => { + if (exchange.input.transport === `memory`) { + input = exchange.input + } + return exchange() + }, + }) + beforeEach(() => { + input = undefined + }) + describe(`operationName`, () => { + test(`undefined by default`, async () => { + await graffle.use(peakInput).raw(`query { id }`) + expect(input).toMatchObject({ operationName: undefined }) + }) + test(`reflects explicit value`, async () => { + await graffle.use(peakInput).raw(`query { id }`, { operationName: `foo` }) + expect(input).toMatchObject({ operationName: `foo` }) + }) + }) +}) + +// todo http transport diff --git a/src/layers/6_client/client.test.ts b/src/layers/6_client/client.test.ts index 80168c27e..7d7981965 100644 --- a/src/layers/6_client/client.test.ts +++ b/src/layers/6_client/client.test.ts @@ -19,8 +19,8 @@ describe(`without schemaIndex only raw is available`, () => { }) test(`available methods`, () => { - expect(graffle.raw).toBeTypeOf(`function`) - expect(graffle.rawOrThrow).toBeTypeOf(`function`) + expect(graffle.raw).toBeTypeOf(`function`) // eslint-disable-line + expect(graffle.rawOrThrow).toBeTypeOf(`function`) // eslint-disable-line }) }) diff --git a/src/layers/6_client/client.ts b/src/layers/6_client/client.ts index 023df54f5..8a5600a7f 100644 --- a/src/layers/6_client/client.ts +++ b/src/layers/6_client/client.ts @@ -25,10 +25,6 @@ import type { GetRootTypeMethods } from './RootTypeMethods.js' export type SchemaInput = URLInput | GraphQLSchema -export interface RawInput extends BaseInput { - schema: SchemaInput -} - // todo could list specific errors here // Anyware entrypoint // Extension @@ -50,10 +46,29 @@ export type TypedContext = Context & { const isTypedContext = (context: Context): context is TypedContext => `schemaIndex` in context +interface RawInput extends BaseInput {} + +type RawParameters = + | [RawInput] + | [ + document: RawInput['document'], + options?: Omit, + ] + // todo no config needed? export type ClientRaw<_$Config extends Config> = { - raw: (input: Omit) => Promise - rawOrThrow: (input: Omit) => Promise + raw(input: RawInput): Promise + // todo test this overload + raw( + document: RawInput['document'], + options?: Omit, + ): Promise + + rawOrThrow(input: RawInput): Promise + rawOrThrow( + document: RawInput['document'], + options?: Omit, + ): Promise } export type Extension = { @@ -287,22 +302,31 @@ export const createInternal = ( config: context.config, }, variables: rawInput.variables, + operationName: rawInput.operationName, } as HookDefEncode['input'] return await run(context, initialInput) } + const resolveRawParameters = (parameters: RawParameters) => { + return parameters.length === 2 + ? { document: parameters[0], ...parameters[1] } + : typeof parameters[0] === `string` || `kind` in parameters[0] + ? { document: parameters[0], ...parameters[1] } + : parameters[0] + } // @ts-expect-error ignoreme const client: Client = { - raw: async (rawInput: RawInput) => { + raw: async (...args: RawParameters) => { + const input = resolveRawParameters(args) const contextWithReturnModeSet = updateContextConfig(context, { returnMode: `graphql` }) - return await runRaw(contextWithReturnModeSet, rawInput) + return await runRaw(contextWithReturnModeSet, input) }, - rawOrThrow: async ( - rawInput: RawInput, - ) => { + rawOrThrow: async (...args: RawParameters) => { + const input = resolveRawParameters(args) const contextWithReturnModeSet = updateContextConfig(context, { returnMode: `graphqlSuccess` }) - return await runRaw(contextWithReturnModeSet, rawInput) + return await runRaw(contextWithReturnModeSet, input) }, + // todo $use use: (extensionOrAnyware: Extension | Anyware.Extension2) => { const extension = typeof extensionOrAnyware === `function` ? { anyware: extensionOrAnyware, name: extensionOrAnyware.name }