Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
@better-auth/api-key
better-auth
auth
@better-auth/core
@better-auth/drizzle-adapter
@better-auth/electron
@better-auth/expo
@better-auth/i18n
@better-auth/kysely-adapter
@better-auth/memory-adapter
@better-auth/mongo-adapter
@better-auth/oauth-provider
@better-auth/passkey
@better-auth/prisma-adapter
@better-auth/redis-storage
@better-auth/scim
@better-auth/sso
@better-auth/stripe
@better-auth/telemetry
@better-auth/test-utils
commit: |
e093ff8 to
106213b
Compare
There was a problem hiding this comment.
Pull request overview
Updates the workspace to consume the better-call “v2” build (via a PR tarball) and applies the corresponding type-shape adjustments across @better-auth/core and better-auth (endpoints, contexts, client inference, and OpenAPI generation), plus test updates to match the new typings.
Changes:
- Pin
better-callto a pkg.pr.new tarball in the workspace catalog/lockfile. - Update endpoint/context-related TypeScript types to match better-call v2 generic parameters and runtime option types.
- Adjust client/type tests and some schemas to compile under the new better-call typings.
Reviewed changes
Copilot reviewed 26 out of 28 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| pnpm-workspace.yaml | Pins better-call to a pkg.pr.new tarball via the workspace catalog. |
| pnpm-lock.yaml | Updates lockfile entries to use the tarball specifier and adds the tarball package resolution/snapshot. |
| packages/core/src/types/plugin.ts | Updates hook endpoint context typing and broadens hook handler typing. |
| packages/core/src/types/context.ts | Updates GenericEndpointContext typing to match new EndpointContext generic shape. |
| packages/core/src/context/endpoint-context.ts | Updates AuthEndpointContext typing to new better-call v2 generics. |
| packages/core/src/api/index.ts | Reworks createAuthEndpoint typing/overloads for better-call v2 and updates exported types. |
| packages/better-auth/src/types/helper.ts | Adjusts HasRequiredKeys to behave better with any/non-object inputs. |
| packages/better-auth/src/types/api.ts | Updates API filtering types to infer endpoint metadata via Endpoint generics. |
| packages/better-auth/src/plugins/organization/schema.ts | Switches Prettify import from better-call to a local helper type. |
| packages/better-auth/src/plugins/organization/routes/crud-members.test.ts | Test typing adjustments for org member invite role validation. |
| packages/better-auth/src/plugins/organization/routes/crud-access-control.test.ts | Test typing adjustments (as string/as any) for org IDs and request bodies. |
| packages/better-auth/src/plugins/organization/organization.ts | Updates has-permission request schema (notably permission/permissions fields). |
| packages/better-auth/src/plugins/organization/organization.test.ts | Updates type assertions and adds as any casts due to runtime schema merges / new endpoint typings. |
| packages/better-auth/src/plugins/organization/client.test.ts | Updates typing tests to compile under new inference (casts to any). |
| packages/better-auth/src/plugins/open-api/generator.ts | Switches option typing to EndpointRuntimeOptions for better-call v2. |
| packages/better-auth/src/plugins/anonymous/types.ts | Updates EndpointContext generic parameters to match v2. |
| packages/better-auth/src/plugins/admin/routes.ts | Updates has-permission request schema (notably permission/permissions fields). |
| packages/better-auth/src/client/path-to-object.ts | Updates client route/input inference types for new InputContext/Endpoint metadata generics. |
| packages/better-auth/src/client/client.test.ts | Updates expected error type shape under better-call v2 endpoint generic behavior. |
| packages/better-auth/src/api/to-auth-endpoints.ts | Updates internal endpoint/context typings and hook handler typing to match v2. |
| packages/better-auth/src/api/to-auth-endpoints.test.ts | Adjusts tests with casts to satisfy new endpoint input typings. |
| packages/better-auth/src/api/routes/update-user.ts | Normalizes @ts-expect-error comment formatting. |
| packages/better-auth/src/api/routes/update-user.test.ts | Removes an expectation of a TS error for an extra field (typing change). |
| packages/better-auth/src/api/routes/sign-up.test.ts | Removes a @ts-expect-error suppression for a custom field (typing change). |
| packages/better-auth/src/api/routes/account.ts | Forces query: undefined when calling getAccessToken from accountInfo. |
| packages/better-auth/src/api/rate-limiter/rate-limiter.test.ts | Adds @ts-expect-error for extra runtime query param on fetch options. |
| packages/better-auth/src/api/middlewares/origin-check.test.ts | Adds @ts-expect-error for extra runtime query param on fetch options. |
| packages/better-auth/src/api/index.test.ts | Casts test middleware context to any to satisfy updated middleware typing. |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| Opts extends EndpointOptions, | ||
| R, | ||
| > = ReturnType<typeof createAuthEndpoint<Path, Opts, R>>; | ||
| export type AuthEndpoint = ReturnType<typeof createAuthEndpoint>; |
There was a problem hiding this comment.
export type AuthEndpoint = ReturnType<typeof createAuthEndpoint> is no longer parameterized, which is a breaking type-level API change for any consumers that previously referenced AuthEndpoint<Path, Opts, R>. Consider reintroducing a generic AuthEndpoint<...> alias (possibly mapping to the new better-call v2 Endpoint<...> shape) and/or keeping this non-generic alias under a different name to avoid downstream breakage.
| export type AuthEndpoint = ReturnType<typeof createAuthEndpoint>; | |
| export type AuthEndpoint< | |
| Path extends string = string, | |
| Method extends HTTPMethod | HTTPMethod[] | "*" = any, | |
| Body = any, | |
| Query = any, | |
| Headers = any, | |
| R = unknown, | |
| Meta extends EndpointMetadata | undefined = undefined, | |
| > = Endpoint<Path, Method, Body, Query, Headers, R, Meta>; | |
| export type AuthEndpointInstance = ReturnType<typeof createAuthEndpoint>; |
| z.union([ | ||
| z.object({ | ||
| permission: z.record(z.string(), z.array(z.string())), | ||
| permissions: z.undefined(), | ||
| permissions: z.record(z.string(), z.array(z.string())).optional(), | ||
| }), | ||
| z.object({ | ||
| permission: z.undefined(), | ||
| permission: z.record(z.string(), z.array(z.string())).optional(), | ||
| permissions: z.record(z.string(), z.array(z.string())), | ||
| }), |
There was a problem hiding this comment.
createHasPermissionBodySchema no longer enforces mutual exclusivity between permission (deprecated) and permissions. With the new .optional() fields, requests providing only permission will now pass schema validation but ctx.body.permissions will be undefined and get forwarded into hasPermission(...), producing incorrect results. Restore the XOR behavior (e.g., use z.never().optional() for the disallowed key) and/or add explicit mapping so deprecated permission is handled correctly.
pnpm-workspace.yaml
Outdated
| '@better-auth/utils': 0.3.1 | ||
| '@better-fetch/fetch': 1.1.21 | ||
| better-call: 1.3.2 | ||
| better-call: https://pkg.pr.new/better-call@382e963 | ||
| tsdown: ^0.20.3 |
There was a problem hiding this comment.
The PR description says better-call is pinned to the v2 PR tarball at https://pkg.pr.new/better-auth/better-call@109, but the workspace catalog is actually set to https://pkg.pr.new/better-call@382e963. Please align the description and the pinned tarball URL (and ideally document why we’re relying on a pkg.pr.new tarball instead of a published version, since it can affect long-term reproducibility).
386ab15 to
5e56ce7
Compare
RelatedZod type re-export / namespace leaking
"Cannot be named without a reference" (TS2742) — type portability
Type instantiation / TypeScript performance
Zod schema type inference
Bundle size (related to zod bundling)
|
499c244 to
702da0c
Compare
702da0c to
7320ee3
Compare
This reverts commit f67aef5.
Summary by cubic
Pinned better-call to the v2 PR tarball across the workspace to adopt the new build without changing app code.
Written for commit 8b2ecbe. Summary will update on new commits.