//#region src/runtime/idp.d.ts /** * IDP (Identity Provider) utilities. * * Thin typed wrapper around the platform-provided `tailor.idp` runtime API. * At runtime this delegates to `globalThis.tailor.idp`. Use `mockIdp` from * `@tailor-platform/sdk/vitest` to mock these calls in unit tests. * @example * import { idp } from "@tailor-platform/sdk/runtime"; * * const client = new idp.Client({ namespace: "my-namespace" }); * const { users } = await client.users({ first: 10 }); */ /** Configuration object for `idp.Client`. */ export interface ClientConfig { namespace: string; } /** User record returned by IDP operations. */ export interface User { id: string; name: string; disabled: boolean; createdAt?: string; /** * True when the user has at least one enrolled MFA second factor. False when * the namespace has MFA disabled or the user has not enrolled a factor. */ mfaEnrolled: boolean; /** * Enrolled MFA second factor IDs. Pass an entry into * `idp.Client.unenrollMfa()` to remove that factor. */ mfaFactorIds: string[]; } /** Filter options for `idp.Client.users()`. */ export interface UserQuery { /** Filter by user IDs */ ids?: string[]; /** Filter by user names */ names?: string[]; } /** Pagination/filter options for `idp.Client.users()`. */ export interface ListUsersOptions { /** Maximum number of users to return */ first?: number; /** Page token for pagination */ after?: string; /** Query filter for users */ query?: UserQuery; } /** Response shape for `idp.Client.users()`. */ export interface ListUsersResponse { users: User[]; nextPageToken: string | null; totalCount: number; } /** Input for `idp.Client.createUser()`. */ export interface CreateUserInput { /** The user's name (typically email) */ name: string; /** The user's password. If omitted, the user is created without a password (cannot log in with any password). */ password?: string; /** Whether the user is disabled */ disabled?: boolean; } /** Input for `idp.Client.updateUser()`. */ export interface UpdateUserInput { /** The user's ID */ id: string; /** New name for the user */ name?: string; /** New password for the user. Cannot be used with clearPassword. */ password?: string; /** If true, remove the user's password. Cannot be used with password. */ clearPassword?: boolean; /** New disabled status for the user */ disabled?: boolean; } /** Input for `idp.Client.sendPasswordResetEmail()`. */ export interface SendPasswordResetEmailInput { /** The ID of the user */ userId: string; /** The URI to redirect to after password reset */ redirectUri: string; /** The sender display name. Defaults to 'Tailor Platform IdP'. */ fromName?: string; /** The email subject line. Defaults to the localized default subject. */ subject?: string; } /** Input for `idp.Client.unenrollMfa()`. */ export interface UnenrollMfaInput { /** The ID of the user whose factor will be unenrolled. */ userId: string; /** * The ID of the factor to unenroll. Factor IDs are exposed on the user * record (see {@link User.mfaFactorIds}). */ mfaFactorId: string; } /** Instance methods exposed by `tailor.idp.Client`. */ export interface IdpClientInstance { users(options?: ListUsersOptions): Promise; user(userId: string): Promise; userByName(name: string): Promise; createUser(input: CreateUserInput): Promise; updateUser(input: UpdateUserInput): Promise; deleteUser(userId: string): Promise; sendPasswordResetEmail(input: SendPasswordResetEmailInput): Promise; unenrollMfa(input: UnenrollMfaInput): Promise; } /** * Constructor shape for `tailor.idp.Client`. * @internal */ export interface IdpClientConstructor { new (config: ClientConfig): IdpClientInstance; } /** * Platform API surface for `tailor.idp`. Describes the shape the platform * runtime injects on `globalThis.tailor.idp`. * @internal */ export interface TailorIdpAPI { Client: IdpClientConstructor; } /** Runtime API for `tailor.idp`. */ export declare const idp: TailorIdpAPI; //#endregion