fix(gitlab)!: align nullable and conditional profile fields

This commit is contained in:
Taesu
2026-10-16 09:59:03 +09:00
parent 2c7833fad6
commit 19f6df4d85
3 changed files with 52 additions and 14 deletions
+5
View File
@@ -0,0 +1,5 @@
---
"@better-auth/core": minor
---
GitLab profile callbacks now accept null profile details and omitted conditional fields, including compute-minute limits on Free instances. Profile mappings must handle these null or missing values.
@@ -0,0 +1,33 @@
import { assertType, it } from "vitest";
import type { GitlabProfile } from "./gitlab";
/**
* @see https://docs.gitlab.com/api/users/#retrieve-the-current-user
* @see https://github.com/gitlabhq/gitlabhq/blob/master/lib/api/entities/user_public.rb
*/
it("accepts nullable and conditional GitLab profile fields", () => {
const profileFields = {
location: null,
work_information: null,
public_email: null,
local_time: null,
last_sign_in_at: null,
confirmed_at: null,
theme_id: null,
last_activity_on: null,
current_sign_in_at: null,
shared_runners_minutes_limit: null,
extra_shared_runners_minutes_limit: null,
};
assertType<Pick<GitlabProfile, keyof typeof profileFields>>(profileFields);
assertType<
Pick<
GitlabProfile,
| "followers"
| "following"
| "skype"
| "shared_runners_minutes_limit"
| "extra_shared_runners_minutes_limit"
>
>({});
});
+14 -14
View File
@@ -16,9 +16,9 @@ export interface GitlabProfile extends Record<string, any> {
web_url: string;
created_at: string;
bio: string;
location?: string | undefined;
public_email: string;
skype: string;
location?: string | null | undefined;
public_email: string | null;
skype?: string;
linkedin: string;
twitter: string;
website_url: string;
@@ -26,17 +26,17 @@ export interface GitlabProfile extends Record<string, any> {
job_title: string;
pronouns: string;
bot: boolean;
work_information?: string | undefined;
followers: number;
following: number;
local_time: string;
last_sign_in_at: string;
confirmed_at: string;
theme_id: number;
last_activity_on: string;
work_information?: string | null | undefined;
followers?: number;
following?: number;
local_time: string | null;
last_sign_in_at: string | null;
confirmed_at: string | null;
theme_id: number | null;
last_activity_on: string | null;
color_scheme_id: number;
projects_limit: number;
current_sign_in_at: string;
current_sign_in_at: string | null;
identities: Array<{
provider: string;
extern_uid: string;
@@ -47,8 +47,8 @@ export interface GitlabProfile extends Record<string, any> {
external: boolean;
private_profile: boolean;
commit_email: string;
shared_runners_minutes_limit: number;
extra_shared_runners_minutes_limit: number;
shared_runners_minutes_limit?: number | null;
extra_shared_runners_minutes_limit?: number | null;
email_verified?: boolean | undefined;
}