---
id: "packages/active-grid/api/types-server-contract"
title: "Server contract (types)"
description: "AggregateCountMapping, AggregateOp, AggregateScalarMapping, FilterFieldMapping and 14 more: generated from the source of active-grid."
url: "/packages/active-grid/api/types-server-contract"
locale: "en"
revision: "g0mvjxwj5c-88bdbe1c:types-server-contract"
---

# Server contract (types)

Exported by `@workspace/active-grid`. Generated from the package source; part of [the index of every export](/packages/active-grid/api).

## Types

**AggregateCountMapping**

```ts
interface AggregateCountMapping {
  readonly _kind: 'aggregate:count';
  readonly relation: string | null;
}
```

**AggregateOp**

```ts
type AggregateOp = 'sum' | 'avg' | 'min' | 'max' | 'count';
```

**AggregateScalarMapping**

```ts
interface AggregateScalarMapping {
  readonly _kind: 'aggregate:scalar';
  readonly path?: string;
  readonly ops: readonly AggregateOp[];
}
```

**FilterFieldMapping**

```ts
interface FilterFieldMapping {
  readonly _kind: 'filter:field';
  readonly path?: string;
  readonly filterType?: ColumnFilterType;
  readonly nullable?: boolean;
}
```

**FilterMultiFieldMapping**

```ts
interface FilterMultiFieldMapping {
  readonly _kind: 'filter:multiField';
  readonly paths: readonly string[];
  readonly filterType?: ColumnFilterType;
}
```

**FilterRelationMapping**

```ts
interface FilterRelationMapping {
  readonly _kind: 'filter:relation';
  readonly relation: string;
  readonly path: string;
  readonly op: 'some' | 'every' | 'none';
  readonly filterType?: ColumnFilterType;
}
```

**GlobalFieldMapping**

```ts
interface GlobalFieldMapping {
  readonly _kind: 'global:field';
  readonly path?: string;
  readonly operator?: 'contains' | 'startsWith' | 'equals';
}
```

**GlobalRelationMapping**

```ts
interface GlobalRelationMapping {
  readonly _kind: 'global:relation';
  readonly relation: string;
  readonly path: string;
  readonly op: 'some' | 'every' | 'none';
  readonly operator?: 'contains' | 'startsWith' | 'equals';
}
```

**GroupByFieldMapping**

```ts
interface GroupByFieldMapping {
  readonly _kind: 'groupBy:field';
  readonly path?: string;
}
```

**GroupByRelationMapping**

```ts
interface GroupByRelationMapping {
  readonly _kind: 'groupBy:relation';
  readonly relation: string;
  readonly path: string;
}
```

**SerializableAggregateMapping**

```ts
type SerializableAggregateMapping =
  AggregateScalarMapping | AggregateCountMapping;
```

**SerializableFilterMapping**

```ts
type SerializableFilterMapping =
  FilterFieldMapping | FilterMultiFieldMapping | FilterRelationMapping;
```

**SerializableGlobalMapping**

```ts
type SerializableGlobalMapping =
  GlobalFieldMapping | GlobalRelationMapping;
```

**SerializableGroupByMapping**

```ts
type SerializableGroupByMapping =
  GroupByFieldMapping | GroupByRelationMapping;
```

**SerializableSortMapping**

```ts
type SerializableSortMapping = SortFieldMapping | SortCountMapping;
```

**ServerColumnContract**

```ts
interface ServerColumnContract {
  sort?: false | SerializableSortMapping;
  filter?: false | SerializableFilterMapping;
  global?: false | SerializableGlobalMapping;
  groupBy?: false | SerializableGroupByMapping;
  aggregate?: false | SerializableAggregateMapping;
}
```

Client-side query-contract for a column. Lives on `GridColumnDef.server`
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-grid`: the sole consumer is the
grid's own hydration path (`extractWireContract` in `use-grid-setup`), 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`, `groupBy` +
`aggregate`. All values are serializable — no closures.

**SortCountMapping**

```ts
interface SortCountMapping {
  readonly _kind: 'sort:count';
  readonly relation: string;
}
```

**SortFieldMapping**

```ts
interface SortFieldMapping {
  readonly _kind: 'sort:field';
  readonly path?: string;
}
```
