Skip to content

Commit

Permalink
eliminate HttpApiEndpoint context in .handle
Browse files Browse the repository at this point in the history
  • Loading branch information
tim-smart committed Oct 25, 2024
1 parent d58bd18 commit 2362779
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 8 deletions.
5 changes: 5 additions & 0 deletions .changeset/lemon-fishes-think.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@effect/platform": patch
---

eliminate HttpApiEndpoint context in .handle
20 changes: 18 additions & 2 deletions packages/platform/src/HttpApiBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,15 @@ export interface Handlers<
): Handlers<
E,
Provides,
R | Exclude<HttpApiEndpoint.HttpApiEndpoint.ExcludeProvided<Endpoints, Name, R1>, Provides>,
| R
| Exclude<
HttpApiEndpoint.HttpApiEndpoint.ExcludeProvided<
Endpoints,
Name,
R1 | HttpApiEndpoint.HttpApiEndpoint.ContextWithName<Endpoints, Name>
>,
Provides
>,
HttpApiEndpoint.HttpApiEndpoint.ExcludeName<Endpoints, Name>
>

Expand All @@ -236,7 +244,15 @@ export interface Handlers<
): Handlers<
E,
Provides,
R | Exclude<HttpApiEndpoint.HttpApiEndpoint.ExcludeProvided<Endpoints, Name, R1>, Provides>,
| R
| Exclude<
HttpApiEndpoint.HttpApiEndpoint.ExcludeProvided<
Endpoints,
Name,
R1 | HttpApiEndpoint.HttpApiEndpoint.ContextWithName<Endpoints, Name>
>,
Provides
>,
HttpApiEndpoint.HttpApiEndpoint.ExcludeName<Endpoints, Name>
>
}
Expand Down
8 changes: 2 additions & 6 deletions packages/platform/src/HttpApiGroup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -227,12 +227,8 @@ export declare namespace HttpApiGroup {
*/
export type Context<Group> = Group extends
HttpApiGroup<infer _Name, infer _Endpoints, infer _Error, infer _R, infer _TopLevel> ?
| HttpApiMiddleware.HttpApiMiddleware.Only<_R>
| Exclude<
HttpApiEndpoint.HttpApiEndpoint.Context<_Endpoints>,
HttpApiMiddleware.HttpApiMiddleware.ExtractProvides<HttpApiEndpoint.HttpApiEndpoint.Context<_Endpoints> | _R>
>
: never
HttpApiMiddleware.HttpApiMiddleware.Only<_R> :
never

/**
* @since 1.0.0
Expand Down

0 comments on commit 2362779

Please sign in to comment.