diff --git a/packages/server/src/api.ts b/packages/server/src/api.ts index 9f50b390..7610c97f 100644 --- a/packages/server/src/api.ts +++ b/packages/server/src/api.ts @@ -1,5 +1,5 @@ import * as API from '@ucanto/interface' -import { InferCaveats, CanIssue } from '@ucanto/interface' +import { InferCaveats, CanIssue, ParsedCapability } from '@ucanto/interface' export * from '@ucanto/interface' @@ -28,3 +28,10 @@ export interface ProviderContext< context: API.InvocationContext } + +export interface ProviderInput { + capability: T + invocation: API.Invocation & T['caveats']> + + context: API.InvocationContext +} diff --git a/packages/server/src/handler.js b/packages/server/src/handler.js index 20ef648d..f2a9afed 100644 --- a/packages/server/src/handler.js +++ b/packages/server/src/handler.js @@ -2,15 +2,11 @@ import * as API from './api.js' import { access } from '@ucanto/validator' /** - * @template {API.Ability} A - * @template {API.Caveats} C - * @template {API.URI} R + * @template {API.ParsedCapability} T * @template {unknown} U - * @template {API.Match} Z - * @template {API.ParsedCapability>} T - * @param {API.CapabilityParser>} capability - * @param {(input:API.ProviderContext) => API.Await} handler - * @returns {API.ServiceMethod & API.InferCaveats, Exclude, Exclude>>} + * @param {API.CapabilityParser>} capability + * @param {(input:API.ProviderInput) => API.Await} handler + * @returns {API.ServiceMethod & T['caveats'], Exclude, Exclude>>} */ export const provide = @@ -18,7 +14,6 @@ export const provide = /** * @param {API.Invocation & T['caveats']>} invocation * @param {API.InvocationContext} options - * @return {Promise, Exclude>|API.InvocationError>>} */ async (invocation, options) => { const authorization = await access(invocation, {