AdminLoaderData
AdminLoaderData = {
recentItems:RecentItem[];stats:DashboardStat[];tables:object[];user:AdminUser;view:"dashboard"; } | {columns:AdminColumnConfig[];items:Record<string,unknown>[];page:number;search:string;searchable:string[];sort: {column:string;direction:"asc"|"desc"; };tableLabel:string;tableName:string;tables:object[];total:number;totalPages:number;user:AdminUser;view:"list"; } | {columns:AdminColumnConfig[];item:Record<string,unknown>;tableLabel:string;tableName:string;tables:object[];user:AdminUser;view:"detail"; } | {columns:AdminColumnConfig[];tableLabel:string;tableName:string;tables:object[];user:AdminUser;view:"create"; } | {columns:AdminColumnConfig[];item:Record<string,unknown>;tableLabel:string;tableName:string;tables:object[];user:AdminUser;view:"edit"; } | {assignableRoles:string[];items:AdminUser&object[];page:number;search:string;tables:object[];total:number;totalPages:number;user:AdminUser;view:"users"; } | {assignableRoles:string[];tables:object[];targetUser:AdminUser&object;user:AdminUser;view:"user-detail"; } | {message:string;tables:object[];user:AdminUser;view:"error"; }
Defined in: packages/admin/src/types.ts:415
Discriminated union of all data shapes returned by the admin loader.
The view field determines which admin view to render:
"dashboard"— the admin index page with stats and recent items"list"— paginated table list with search and sorting"detail"— single record detail view"create"— new record form"edit"— edit existing record form"users"— user management list"user-detail"— single user detail with role management"error"— error message display
Every variant includes the current AdminUser and the sidebar table list.
Type Declaration
Section titled “Type Declaration”{ recentItems: RecentItem[]; stats: DashboardStat[]; tables: object[]; user: AdminUser; view: "dashboard"; }
recentItems
Section titled “recentItems”recentItems:
RecentItem[]
Recent item sections to display on the dashboard.
stats:
DashboardStat[]
Stat cards to display on the dashboard.
tables
Section titled “tables”tables:
object[]
Table list for the sidebar navigation.
user:
AdminUser
The authenticated admin user.
view:
"dashboard"
Dashboard view identifier.
{ columns: AdminColumnConfig[]; items: Record<string, unknown>[]; page: number; search: string; searchable: string[]; sort: { column: string; direction: "asc" | "desc"; }; tableLabel: string; tableName: string; tables: object[]; total: number; totalPages: number; user: AdminUser; view: "list"; }
columns
Section titled “columns”columns:
AdminColumnConfig[]
Column metadata for rendering the list.
items:
Record<string,unknown>[]
The page of records to display.
page:
number
Current page number (1-based).
search
Section titled “search”search:
string
Current search query string.
searchable
Section titled “searchable”searchable:
string[]
Column names that support search.
sort:
object
Current sort column and direction.
sort.column
Section titled “sort.column”column:
string
sort.direction
Section titled “sort.direction”direction:
"asc"|"desc"
tableLabel
Section titled “tableLabel”tableLabel:
string
Human-readable table label.
tableName
Section titled “tableName”tableName:
string
The Drizzle table name being listed.
tables
Section titled “tables”tables:
object[]
Table list for the sidebar navigation.
total:
number
Total number of records matching the current search/filter.
totalPages
Section titled “totalPages”totalPages:
number
Total number of pages.
user:
AdminUser
The authenticated admin user.
view:
"list"
Table list view identifier.
{ columns: AdminColumnConfig[]; item: Record<string, unknown>; tableLabel: string; tableName: string; tables: object[]; user: AdminUser; view: "detail"; }
columns
Section titled “columns”columns:
AdminColumnConfig[]
Column metadata for rendering the detail fields.
item:
Record<string,unknown>
The record data as a key-value object.
tableLabel
Section titled “tableLabel”tableLabel:
string
Human-readable table label.
tableName
Section titled “tableName”tableName:
string
The Drizzle table name of the record.
tables
Section titled “tables”tables:
object[]
Table list for the sidebar navigation.
user:
AdminUser
The authenticated admin user.
view:
"detail"
Record detail view identifier.
{ columns: AdminColumnConfig[]; tableLabel: string; tableName: string; tables: object[]; user: AdminUser; view: "create"; }
columns
Section titled “columns”columns:
AdminColumnConfig[]
Column metadata for rendering form fields.
tableLabel
Section titled “tableLabel”tableLabel:
string
Human-readable table label.
tableName
Section titled “tableName”tableName:
string
The Drizzle table name for the new record.
tables
Section titled “tables”tables:
object[]
Table list for the sidebar navigation.
user:
AdminUser
The authenticated admin user.
view:
"create"
Create form view identifier.
{ columns: AdminColumnConfig[]; item: Record<string, unknown>; tableLabel: string; tableName: string; tables: object[]; user: AdminUser; view: "edit"; }
columns
Section titled “columns”columns:
AdminColumnConfig[]
Column metadata for rendering form fields.
item:
Record<string,unknown>
The existing record data to pre-fill the form.
tableLabel
Section titled “tableLabel”tableLabel:
string
Human-readable table label.
tableName
Section titled “tableName”tableName:
string
The Drizzle table name of the record being edited.
tables
Section titled “tables”tables:
object[]
Table list for the sidebar navigation.
user:
AdminUser
The authenticated admin user.
view:
"edit"
Edit form view identifier.
{ assignableRoles: string[]; items: AdminUser & object[]; page: number; search: string; tables: object[]; total: number; totalPages: number; user: AdminUser; view: "users"; }
assignableRoles
Section titled “assignableRoles”assignableRoles:
string[]
Roles that can be assigned via the admin UI.
items:
AdminUser&object[]
The page of user records enriched with role data.
page:
number
Current page number (1-based).
search
Section titled “search”search:
string
Current search query string.
tables
Section titled “tables”tables:
object[]
Table list for the sidebar navigation.
total:
number
Total number of users matching the search.
totalPages
Section titled “totalPages”totalPages:
number
Total number of pages.
user:
AdminUser
The authenticated admin user.
view:
"users"
User list view identifier.
{ assignableRoles: string[]; tables: object[]; targetUser: AdminUser & object; user: AdminUser; view: "user-detail"; }
assignableRoles
Section titled “assignableRoles”assignableRoles:
string[]
Roles that can be assigned via the admin UI.
tables
Section titled “tables”tables:
object[]
Table list for the sidebar navigation.
targetUser
Section titled “targetUser”targetUser:
AdminUser&object
The user being viewed, enriched with role and creation date data.
Type Declaration
Section titled “Type Declaration”createdAt?
Section titled “createdAt?”
optionalcreatedAt:string
user:
AdminUser
The authenticated admin user.
view:
"user-detail"
User detail view identifier.
{ message: string; tables: object[]; user: AdminUser; view: "error"; }
message
Section titled “message”message:
string
The error message to display.
tables
Section titled “tables”tables:
object[]
Table list for the sidebar navigation.
user:
AdminUser
The authenticated admin user.
view:
"error"
Error view identifier.