UNPKG

@softr/sdk

Version:

The SDK for building Softr apps on TanStack Start. It lets an app interact with Softr: auth, datasources, workflows and integrations.

35 lines (33 loc) • 1.19 kB
import { z } from "zod"; //#region src/auth/user.d.ts /** * The app's group ids. The app's generated types declare them, the predefined * groups included. Every group id the SDK takes and returns narrows to them. * Never declare it by hand: a second declaration does not merge with the * generated one. */ interface SoftrUserGroups {} /** A Softr user group id, narrowed to the app's own ids by {@link SoftrUserGroups}. */ type SoftrUserGroupId = SoftrUserGroups extends { ids: infer Id extends string; } ? Id : string; /** * The fields of the visitor's row that softr.json declares under * `user.properties`, keyed by their aliases. The app's generated types declare * it. */ interface SoftrUserProperties {} /** The signed-in visitor. */ type User = { id: string; email: string; fullName: string; userGroupIds: Array<SoftrUserGroupId>; /** Their photo, or `null` when they have none. Show their initials then. */ avatarUrl: string | null; /** Whether `auth.updateProfile` can change their photo in this app. */ avatarEditable: boolean; properties: SoftrUserProperties; }; //#endregion export { SoftrUserGroupId, SoftrUserGroups, SoftrUserProperties, User };