Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changeset/thick-icons-invite.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@genseki/plugins": patch
"@genseki/react": patch
---

- fix `RecordifyFlattenApiRouter` wrong implementation
- fix wrong phone plguin login path
2 changes: 1 addition & 1 deletion packages/plugins/src/phone/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export function phone<
context,
{
method: 'POST',
path: '/auth/phone/sign-up/otp',
path: '/auth/phone/login',
body: z.object({
phone: z.string().min(1),
password: z.string().min(1),
Expand Down
12 changes: 5 additions & 7 deletions packages/react/src/core/endpoint.ts
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you enlighten me about what's changed in effect?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's already in the PR's description

Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,11 @@ export function flattenApiRoutes<TApiRouter extends AnyApiRouter>(
return flattened as FlattenApiRoutes<TApiRouter>
}

export type RecordifyFlattenApiRouter<TApiRoutes extends ApiRoute[]> =
TApiRoutes[number] extends infer TApiRoute extends ApiRoute
? {
[K in `${TApiRoute['schema']['method']} ${TApiRoute['schema']['path']}`]: TApiRoute
}
: never
export type RecordifyFlattenApiRouter<TApiRoutes extends ApiRoute[]> = {
[TApiRoute in TApiRoutes[number] as TApiRoute extends ApiRoute
? `${TApiRoute['schema']['method']} ${TApiRoute['schema']['path']}`
: never]: TApiRoute extends ApiRoute ? TApiRoute : never
}

export function recordifyFlattenApiRoutes<TApiRoutes extends ApiRoute[]>(
routes: TApiRoutes
Expand Down Expand Up @@ -93,7 +92,6 @@ export type FilterByMethod<TApiRoute extends ApiRoute, TMethod extends string> =
{ schema: { method: TMethod } }
>

// TODO: With IsNever, the performance is not good. Need to fix it.
type GetBody<TApiRouteSchema extends ApiRouteSchema> =
IsNever<TApiRouteSchema['body']> extends false ? Output<TApiRouteSchema['body']> : never

Expand Down
Loading