diff --git a/endpoint-spec/package.json b/endpoint-spec/package.json index 5c8cd4c..98c5332 100644 --- a/endpoint-spec/package.json +++ b/endpoint-spec/package.json @@ -1,6 +1,6 @@ { "name": "@ty-ras/endpoint-spec", - "version": "2.2.1", + "version": "2.2.2", "author": { "name": "Stanislav Muhametsin", "email": "346799+stazz@users.noreply.github.com", diff --git a/endpoint-spec/src/api.types/url.types.ts b/endpoint-spec/src/api.types/url.types.ts index 857aed3..e4e2271 100644 --- a/endpoint-spec/src/api.types/url.types.ts +++ b/endpoint-spec/src/api.types/url.types.ts @@ -393,11 +393,11 @@ export type GetMethodArgsGeneric< TProtocolSpec extends protocol.ProtocolSpecCore, TStateSpec, > = { - context: TServerContext; state: dataBE.MaterializeRuntimeState; -} & (TProtocolSpec extends protocol.ProtocolSpecURL - ? { url: protocol.RuntimeOf } - : {}) & +} & (never extends TServerContext ? {} : { context: TServerContext }) & + (TProtocolSpec extends protocol.ProtocolSpecURL + ? { url: protocol.RuntimeOf } + : {}) & (TProtocolSpec extends protocol.ProtocolSpecQuery ? { query: protocol.RuntimeOf } : {}) & diff --git a/endpoint-spec/src/implementation/app.ts b/endpoint-spec/src/implementation/app.ts index f58cef4..eb8af8b 100644 --- a/endpoint-spec/src/implementation/app.ts +++ b/endpoint-spec/src/implementation/app.ts @@ -303,7 +303,7 @@ function newBuilderGenericImpl< ? processMethodArg : (pArgs) => { const boundMethod = processMethodArg(pArgs) ?? pArgs.boundMethod; - return ({ context: _, ...args }) => boundMethod(args as any); // eslint-disable-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unused-vars + return (args) => boundMethod(data.omit(args, "context" as any) as any); // eslint-disable-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unused-vars }; // Define resetMetadataProviders separately, as defining it inline causes problems with function overload having different argument count. const resetMetadataProviders: api.ApplicationBuilderGeneric<