web / lib/utils/event-params
lib/utils/event-params
Shared utilities for extracting and building event filter parameters.
This module consolidates common parameter extraction patterns used across event API routes (list, histogram, map-clusters, cluster-stats). By centralizing this logic, we ensure consistent parameter handling and reduce code duplication.
Interfaces
BaseEventParameters
Base parameters common to all event queries.
Extended by
Properties
catalog
catalog:
null|string
Catalog slug or ID to filter by
datasets
datasets:
string[]
Array of dataset slugs or IDs to filter by
startDate
startDate:
null|string
Start date for temporal filtering (ISO 8601)
endDate
endDate:
null|string
End date for temporal filtering (ISO 8601)
ListParameters
Parameters for the events list endpoint.
Extends
Properties
catalog
catalog:
null|string
Catalog slug or ID to filter by
Inherited from
datasets
datasets:
string[]
Array of dataset slugs or IDs to filter by
Inherited from
startDate
startDate:
null|string
Start date for temporal filtering (ISO 8601)
Inherited from
endDate
endDate:
null|string
End date for temporal filtering (ISO 8601)
Inherited from
boundsParam
boundsParam:
null|string
page
page:
number
limit
limit:
number
sort
sort:
string
HistogramParameters
Parameters for the histogram endpoint.
Extends
Properties
catalog
catalog:
null|string
Catalog slug or ID to filter by
Inherited from
datasets
datasets:
string[]
Array of dataset slugs or IDs to filter by
Inherited from
startDate
startDate:
null|string
Start date for temporal filtering (ISO 8601)
Inherited from
endDate
endDate:
null|string
End date for temporal filtering (ISO 8601)
Inherited from
boundsParam
boundsParam:
null|string
targetBuckets
targetBuckets:
number
minBuckets
minBuckets:
number
maxBuckets
maxBuckets:
number
MapClusterParameters
Parameters for the map clusters endpoint.
Extends
Properties
catalog
catalog:
null|string
Catalog slug or ID to filter by
Inherited from
datasets
datasets:
string[]
Array of dataset slugs or IDs to filter by
Inherited from
startDate
startDate:
null|string
Start date for temporal filtering (ISO 8601)
Inherited from
endDate
endDate:
null|string
End date for temporal filtering (ISO 8601)
Inherited from
boundsParam
boundsParam:
null|string
zoom
zoom:
number
Type Aliases
ClusterStatsParameters
ClusterStatsParameters =
BaseEventParameters
Parameters for the cluster stats endpoint.
Functions
extractBaseEventParameters()
extractBaseEventParameters(
searchParams):BaseEventParameters
Extract base event parameters from URL search params. These parameters are common to all event API routes.
Handles datasets in multiple formats:
- Multiple params:
?datasets=1&datasets=2&datasets=3 - Comma-separated:
?datasets=1,2,3 - Mixed:
?datasets=1,2&datasets=3
Parameters
searchParams
URLSearchParams
URL search parameters
Returns
Base event parameters
extractListParameters()
extractListParameters(
searchParams):ListParameters
Extract parameters for the events list endpoint.
Parameters
searchParams
URLSearchParams
URL search parameters
Returns
List parameters including pagination and sorting
extractHistogramParameters()
extractHistogramParameters(
searchParams):HistogramParameters
Extract parameters for the histogram endpoint.
Parameters
searchParams
URLSearchParams
URL search parameters
Returns
Histogram parameters including bucket configuration
extractMapClusterParameters()
extractMapClusterParameters(
searchParams):MapClusterParameters
Extract parameters for the map clusters endpoint.
Parameters
searchParams
URLSearchParams
URL search parameters
Returns
Map cluster parameters including zoom level
extractClusterStatsParameters()
extractClusterStatsParameters(
searchParams):BaseEventParameters
Extract parameters for the cluster stats endpoint.
Parameters
searchParams
URLSearchParams
URL search parameters
Returns
Cluster stats parameters (base parameters only)