fix(org): update type to include undefined (#5003)

This commit is contained in:
Alex Yang
2025-09-30 14:45:25 -07:00
committed by GitHub
parent 6fec478174
commit 61b446ae9f
4 changed files with 19 additions and 10 deletions

View File

@@ -85,7 +85,7 @@ export const createOrgRole = <O extends OrganizationOptions>(options: O) => {
metadata: {
$Infer: {
body: {} as {
organizationId?: string;
organizationId?: string | undefined;
role: string;
permission: Record<string, string[]>;
} & (IsExactlyEmptyObject<AdditionalFields> extends true
@@ -311,7 +311,7 @@ export const deleteOrgRole = <O extends OrganizationOptions>(options: O) => {
| {
roleId: string;
}
) & { organizationId?: string },
) & { organizationId?: string | undefined },
},
},
},
@@ -494,6 +494,15 @@ export const listOrgRoles = <O extends OrganizationOptions>(options: O) => {
}),
})
.optional(),
metadata: {
$Infer: {
query: {} as
| {
organizationId?: string | undefined;
}
| undefined,
},
},
},
async (ctx) => {
const { session, user } = ctx.context.session;
@@ -622,7 +631,7 @@ export const getOrgRole = <O extends OrganizationOptions>(options: O) => {
metadata: {
$Infer: {
query: {} as {
organizationId?: string;
organizationId?: string | undefined;
} & ({ roleName: string } | { roleId: string }),
},
},
@@ -793,10 +802,10 @@ export const updateOrgRole = <O extends OrganizationOptions>(options: O) => {
metadata: {
$Infer: {
body: {} as {
organizationId?: string;
organizationId?: string | undefined;
data: {
permission?: Record<string, string[]>;
roleName?: string;
permission?: Record<string, string[]> | undefined;
roleName?: string | undefined;
} & AdditionalFields;
} & ({ roleName: string } | { roleId: string }),
},

View File

@@ -100,7 +100,7 @@ export const createInvitation = <O extends OrganizationOptions>(option: O) => {
* The organization ID to invite
* the user to
*/
organizationId?: string;
organizationId?: string | undefined;
/**
* Resend the invitation email, if
* the user is already invited

View File

@@ -59,9 +59,9 @@ export const addMember = <O extends OrganizationOptions>(option: O) => {
role:
| InferOrganizationRolesFromOption<O>
| InferOrganizationRolesFromOption<O>[];
organizationId?: string;
organizationId?: string | undefined;
} & (O extends { teams: { enabled: true } }
? { teamId?: string }
? { teamId?: string | undefined }
: {}) &
InferAdditionalFieldsFromPluginOptions<"member", O>,
},

View File

@@ -374,7 +374,7 @@ export const updateOrganization = <O extends OrganizationOptions>(
logo?: string;
metadata?: Record<string, any>;
} & Partial<InferAdditionalFieldsFromPluginOptions<"organization", O>>;
organizationId: string;
organizationId?: string | undefined;
};
return createAuthEndpoint(
"/organization/update",