Server contract (types)
AggregateCountMapping, AggregateOp, AggregateScalarMapping, FilterFieldMapping and 14 more: generated from the source of active-grid.
Exported by @workspace/. Generated from the package source; part of the index of every export.
Types#
interface AggregateCountMapping {
readonly _kind: 'aggregate:count';
readonly relation: string | null;
}type AggregateOp = 'sum' | 'avg' | 'min' | 'max' | 'count';interface AggregateScalarMapping {
readonly _kind: 'aggregate:scalar';
readonly path?: string;
readonly ops: readonly AggregateOp[];
}interface FilterFieldMapping {
readonly _kind: 'filter:field';
readonly path?: string;
readonly filterType?: ColumnFilterType;
readonly nullable?: boolean;
}interface FilterMultiFieldMapping {
readonly _kind: 'filter:multiField';
readonly paths: readonly string[];
readonly filterType?: ColumnFilterType;
}interface FilterRelationMapping {
readonly _kind: 'filter:relation';
readonly relation: string;
readonly path: string;
readonly op: 'some' | 'every' | 'none';
readonly filterType?: ColumnFilterType;
}interface GlobalFieldMapping {
readonly _kind: 'global:field';
readonly path?: string;
readonly operator?: 'contains' | 'startsWith' | 'equals';
}interface GlobalRelationMapping {
readonly _kind: 'global:relation';
readonly relation: string;
readonly path: string;
readonly op: 'some' | 'every' | 'none';
readonly operator?: 'contains' | 'startsWith' | 'equals';
}interface GroupByFieldMapping {
readonly _kind: 'groupBy:field';
readonly path?: string;
}interface GroupByRelationMapping {
readonly _kind: 'groupBy:relation';
readonly relation: string;
readonly path: string;
}type SerializableAggregateMapping =
AggregateScalarMapping | AggregateCountMapping;type SerializableFilterMapping =
FilterFieldMapping | FilterMultiFieldMapping | FilterRelationMapping;type SerializableGlobalMapping =
GlobalFieldMapping | GlobalRelationMapping;type SerializableGroupByMapping =
GroupByFieldMapping | GroupByRelationMapping;type SerializableSortMapping = SortFieldMapping | SortCountMapping;Client-side query-contract for a column. Lives on Grid and is a plain, serializable declaration of how the column maps onto a server field for sort / filter / global-search / group-by / aggregate.
There is no server-side resolver in active-: the sole consumer is the grid's own hydration path (extract in use-), which reads the contract to prune a stale persisted/URL sort or filter that the column does not declare (contract-aware hydration pruning). A hand-rolled server action that wants to act on these mappings resolves them itself; the grid ships no resolver or raw-closure escape-hatch.
Five sub-keys: sort + filter, global, group + aggregate. All values are serializable — no closures.
interface ServerColumnContract {
sort?: false | SerializableSortMapping;
filter?: false | SerializableFilterMapping;
global?: false | SerializableGlobalMapping;
groupBy?: false | SerializableGroupByMapping;
aggregate?: false | SerializableAggregateMapping;
}interface SortCountMapping {
readonly _kind: 'sort:count';
readonly relation: string;
}interface SortFieldMapping {
readonly _kind: 'sort:field';
readonly path?: string;
}