Server contract (helpers)
aggregateCount, aggregateScalar, byCount, byField and 12 more: generated from the source of active-grid.
Exported by @workspace/. Generated from the package source; part of the index of every export.
Functions, hooks and constants#
Aggregate mapping for a count. With relation: produces Prisma _ — number of related records per group. With relation: null or omitted: produces Prisma _ — number of rows per group, regardless of any specific field.
(args?: { relation?: string; }) => AggregateCountMappingFields of args
The object it takes.
- Type
string
Aggregate mapping on a scalar field. Declares and selects: under the single-source-of-truth model, the listed ops are both "what is possible for this column" and "what is displayed per group". There is no aggregate-toggle UI; a separate selection layer (engine-state or opt-in prop) could sit on top of this declaration without breaking it.
If path is omitted, the column-id is used. ops must be a non-empty subset of Aggregate (sum | avg | min | max | count). Prisma's _/_/_/_/_-blocks are built from this list.
Note: count here is the non-null-count on the scalar (Prisma _). For relation-counts use aggregate with a relation argument.
No DMMF-derived default for aggregates. Auto-defaulting sum/avg over every numeric scalar is semantically dangerous — a version column is valid Prisma but nonsensical UX. Consumer declares aggregate explicitly per column.
- Type
(relation: string) => SortCount Mapping
Sort mapping on the count of a relation. Produces Prisma order.
- Type
(path?: string) => SortField Mapping
Sort mapping on a scalar field. If path is omitted, the server uses the column-id as path.
Filter mapping with relation every. The filter passes only if every related record matches.
(args: { relation: string; path: string; filterType?: ColumnFilterType; }) => FilterRelationMappingFields of args
The object it takes.
- Type
string
The relation on the record the condition runs through, as the server query names it (user in user).
- Type
string
The field of the related record, as a dotted path (role.).
- Type
ColumnFilter Type
Overrides type-inference when the operator alone is ambiguous (equals can be text, number or date).
Filter mapping on a scalar field. If path is omitted, the server uses the column-id as path. filter overrides type-inference when the operator alone is ambiguous (e.g. equals can be text / number / date).
(path?: string, options?: { filterType?: ColumnFilterType; }) => FilterFieldMappingFields of options
The object it takes.
- Type
ColumnFilter Type
Overrides type-inference when the operator alone is ambiguous (equals can be text, number or date).
Global-search mapping with relation every. The column participates in the search only if every related record matches the query.
(args: { relation: string; path: string; operator?: GlobalOperator; }) => GlobalRelationMappingFields of args
The object it takes.
- Type
string
The relation on the record the condition runs through, as the server query names it (user in user).
- Type
string
The field of the related record, as a dotted path (role.).
- Type
GlobalOperator
How the query matches: "contains" (case-insensitive) when omitted, "starts for a prefix match, "equals" for an exact match.
Mark a column as participating in the global search-box (the toolbar's single-search input). When the user types a query and column. is set on at least one column, the server-action wraps the per-column conditions in an OR-clause that is ANDed with the column-filters and extra.
If path is omitted, the column-id is used (consistent with by / field). operator defaults to "contains" (case-insensitive) on the server side; override for prefix-match ("starts) or exact-match ("equals") semantics.
(path?: string, options?: { operator?: GlobalOperator; }) => GlobalFieldMappingFields of options
The object it takes.
- Type
GlobalOperator
How the query matches: "contains" (case-insensitive) when omitted, "starts for a prefix match, "equals" for an exact match.
Global-search mapping with relation none. The column participates in the search only if no related record matches the query.
(args: { relation: string; path: string; operator?: GlobalOperator; }) => GlobalRelationMappingFields of args
The object it takes.
- Type
string
The relation on the record the condition runs through, as the server query names it (user in user).
- Type
string
The field of the related record, as a dotted path (role.).
- Type
GlobalOperator
How the query matches: "contains" (case-insensitive) when omitted, "starts for a prefix match, "equals" for an exact match.
Global-search mapping with relation some. The column participates in the search if at least one related record matches the query.
(args: { relation: string; path: string; operator?: GlobalOperator; }) => GlobalRelationMappingFields of args
The object it takes.
- Type
string
The relation on the record the condition runs through, as the server query names it (user in user).
- Type
string
The field of the related record, as a dotted path (role.).
- Type
GlobalOperator
How the query matches: "contains" (case-insensitive) when omitted, "starts for a prefix match, "equals" for an exact match.
- Type
(path?: string) => GroupBy Field Mapping
Group-by mapping on a scalar field. If path is omitted, the column-id is used as path (same convention as by / field / global).
Prisma's group only accepts scalar field-names in by. group is the helper for that direct case; for grouping through a 1:1 relation (where the FK is a scalar on the model itself) use group. One-to-many relations are not expressible as a declarative group key (grouping through a to-many relation is ambiguous); server-side grouping for such cases belongs in a resource view (@workspace/).
Group-by mapping that resolves through a relation. Intended for 1:1 relations where the FK lives as a scalar on the to-be-grouped model — e.g. provider (FK provider) with name as the display key. The server uses provider for Prisma's group and path for downstream display resolution; same pattern as how scalar separates Prisma-path from column-id.
For one-to-many relations grouping is ambiguous (which related record's value determines the group?) — those are not expressible here; server-side grouping for such cases belongs in a resource view.
(args: { relation: string; path: string; }) => GroupByRelationMappingFilter mapping that ORs across multiple scalar paths.
(paths: readonly string[], options?: { filterType?: ColumnFilterType; }) => FilterMultiFieldMappingFields of options
The object it takes.
- Type
ColumnFilter Type
Overrides type-inference when the operator alone is ambiguous (equals can be text, number or date).
Filter mapping with relation none. The filter passes only if no related record matches.
(args: { relation: string; path: string; filterType?: ColumnFilterType; }) => FilterRelationMappingFields of args
The object it takes.
- Type
string
The relation on the record the condition runs through, as the server query names it (user in user).
- Type
string
The field of the related record, as a dotted path (role.).
- Type
ColumnFilter Type
Overrides type-inference when the operator alone is ambiguous (equals can be text, number or date).
Shortcut that fills both sort and filter for a scalar column. The 80%-case helper.
scalar— uses the column-id as path (deferred resolution on the server when the column-id is dotted).Field() scalar— explicit nested path; both sort and filter use this path.Field("user. email")
Returns a Pick<Server that can be spread or assigned directly to column..
(path?: string) => Pick<ServerColumnContract, "sort" | "filter">Filter mapping with relation some. The filter passes if at least one related record matches.
(args: { relation: string; path: string; filterType?: ColumnFilterType; }) => FilterRelationMappingFields of args
The object it takes.
- Type
string
The relation on the record the condition runs through, as the server query names it (user in user).
- Type
string
The field of the related record, as a dotted path (role.).
- Type
ColumnFilter Type
Overrides type-inference when the operator alone is ambiguous (equals can be text, number or date).