Skip to Content
⚠️Active Development Notice: TimeTiles is under active development. Information may be placeholder content or not up-to-date.

web


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

BaseEventParameters.catalog

datasets

datasets: string[]

Array of dataset slugs or IDs to filter by

Inherited from

BaseEventParameters.datasets

startDate

startDate: null | string

Start date for temporal filtering (ISO 8601)

Inherited from

BaseEventParameters.startDate

endDate

endDate: null | string

End date for temporal filtering (ISO 8601)

Inherited from

BaseEventParameters.endDate

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

BaseEventParameters.catalog

datasets

datasets: string[]

Array of dataset slugs or IDs to filter by

Inherited from

BaseEventParameters.datasets

startDate

startDate: null | string

Start date for temporal filtering (ISO 8601)

Inherited from

BaseEventParameters.startDate

endDate

endDate: null | string

End date for temporal filtering (ISO 8601)

Inherited from

BaseEventParameters.endDate

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

BaseEventParameters.catalog

datasets

datasets: string[]

Array of dataset slugs or IDs to filter by

Inherited from

BaseEventParameters.datasets

startDate

startDate: null | string

Start date for temporal filtering (ISO 8601)

Inherited from

BaseEventParameters.startDate

endDate

endDate: null | string

End date for temporal filtering (ISO 8601)

Inherited from

BaseEventParameters.endDate

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

BaseEventParameters

Base event parameters


extractListParameters()

extractListParameters(searchParams): ListParameters

Extract parameters for the events list endpoint.

Parameters

searchParams

URLSearchParams

URL search parameters

Returns

ListParameters

List parameters including pagination and sorting


extractHistogramParameters()

extractHistogramParameters(searchParams): HistogramParameters

Extract parameters for the histogram endpoint.

Parameters

searchParams

URLSearchParams

URL search parameters

Returns

HistogramParameters

Histogram parameters including bucket configuration


extractMapClusterParameters()

extractMapClusterParameters(searchParams): MapClusterParameters

Extract parameters for the map clusters endpoint.

Parameters

searchParams

URLSearchParams

URL search parameters

Returns

MapClusterParameters

Map cluster parameters including zoom level


extractClusterStatsParameters()

extractClusterStatsParameters(searchParams): BaseEventParameters

Extract parameters for the cluster stats endpoint.

Parameters

searchParams

URLSearchParams

URL search parameters

Returns

BaseEventParameters

Cluster stats parameters (base parameters only)

Last updated on