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.

20 lines (18 loc) • 930 B
import { User } from "./user.js"; import { DatasourceAction, ReadShape } from "../action.js"; import { GetRecord } from "../datasource/record.js"; import "@tanstack/react-start/server-only"; //#region src/auth/current-user-row.d.ts /** * The signed-in visitor's own row of the Users table, found by email, or null when they are signed out * or the table holds no row for them. For a "mine" filter, an owner set on create, or a page scoped to * what the visitor owns: the row's id is what a link to Users holds. * * @example * const me = await auth.currentUserRow(context.user, usersQuery, 'email') * if (me === null) return [] * return ds.list(tasks).where((q) => q.assignee.isOneOf([me.id])) */ declare function currentUserRow<TShape extends ReadShape>(user: User | null, usersQuery: DatasourceAction<TShape>, email: keyof TShape["fields"] & string): Promise<GetRecord<TShape>>; //#endregion export { currentUserRow };