* Adds a middleware function to the procedure chain. * * @see https://jstack.app/docs/backend/middleware * @param handler - A middleware function that can modify the context * * @example * ```ts * // Create a middleware that adds user data to context * const withUser = j.mi
(
handler: MiddlewareFunction<Ctx, Return, E>,
)
| 189 | * ``` |
| 190 | */ |
| 191 | use<T, Return = void>( |
| 192 | handler: MiddlewareFunction<Ctx, Return, E>, |
| 193 | ): Procedure<E, Ctx & T & Return, InputSchema, Incoming, Outgoing> { |
| 194 | return new Procedure<E, Ctx & T & Return, InputSchema, Incoming, Outgoing>( |
| 195 | [...this.middlewares, handler as any], |
| 196 | this.inputSchema, |
| 197 | this.incomingSchema, |
| 198 | this.outgoingSchema, |
| 199 | ) |
| 200 | } |
| 201 | |
| 202 | get<Return extends OptionalPromise<ResponseType<any>>>( |
| 203 | handler: ({ |
no outgoing calls
no test coverage detected