feat(anonymous): update generateName to support returning a promise (#3259)

This commit is contained in:
Jack
2025-07-05 06:48:00 +12:00
committed by GitHub
parent e82bcb719c
commit 57baf02f84

View File

@@ -58,7 +58,7 @@ export interface AnonymousOptions {
},
AuthContext
>,
) => string;
) => Promise<string> | string;
/**
* Custom schema for the anonymous plugin
*/
@@ -121,7 +121,7 @@ export const anonymous = (options?: AnonymousOptions) => {
options || {};
const id = ctx.context.generateId({ model: "user" });
const email = `temp-${id}@${emailDomainName}`;
const name = options?.generateName?.(ctx) || "Anonymous";
const name = (await options?.generateName?.(ctx)) || "Anonymous";
const newUser = await ctx.context.internalAdapter.createUser(
{
email,