web / lib/utils/event-params
lib/utils/event-params
Shared utilities for event parameter parsing and building.
Provides integer parsing utilities used across the codebase and client-side URL parameter builders for event API calls.
Interfaces
SimpleBounds
Simple bounds interface for better React Query compatibility. Used when we need a plain object instead of MapLibre’s LngLatBounds class.
Properties
north
north:
number
south
south:
number
east
east:
number
west
west:
number
ViewScope
View scope for constraining queries to a subset of catalogs/datasets
Properties
catalogIds?
optionalcatalogIds:number[]
datasetIds?
optionaldatasetIds:number[]
Type Aliases
BoundsType
BoundsType =
LngLatBounds|SimpleBounds|null
Bounds can be MapLibre LngLatBounds, SimpleBounds, or null
Functions
parseStrictInteger()
parseStrictInteger(
value):number|null
Parameters
value
string | number | null | undefined
Returns
number | null
requireStrictInteger()
requireStrictInteger(
value,label):number
Parse a value as a strict integer, throwing with context if invalid.
Parameters
value
string | number
label
string
Returns
number
normalizeJobId()
normalizeJobId(
jobId):number
Normalize a job ID to a strict integer, throwing if invalid.
Parameters
jobId
string | number
Returns
number
optionalStrictInteger()
optionalStrictInteger(
value,label):number|null|undefined
Parse an optional value as a strict integer, passing through null/undefined.
Parameters
value
string | number | null | undefined
label
string
Returns
number | null | undefined
normalizeStrictIntegerList()
normalizeStrictIntegerList(
values):number[]
Parameters
values
(string | number)[]
Returns
number[]
buildBaseEventParams()
buildBaseEventParams(
filters,additionalParams?,scope?):URLSearchParams
Build URL search params from filter state without bounds.
Use this for API calls that don’t require geographic bounds, such as global statistics or bounds calculation endpoints.
Parameters
filters
Current filter state
additionalParams?
Record<string, string> = {}
Extra parameters to include
scope?
Optional view scope to constrain data
Returns
URLSearchParams
URLSearchParams ready for API call
buildEventParams()
buildEventParams(
filters,bounds,additionalParams?,scope?):URLSearchParams
Build URL search params from filter state with optional bounds.
Handles both MapLibre LngLatBounds objects and plain SimpleBounds objects. Use this for API calls that support geographic filtering.
Parameters
filters
Current filter state
bounds
Geographic bounds (LngLatBounds, SimpleBounds, or null)
additionalParams?
Record<string, string> = {}
Extra parameters to include
scope?
Returns
URLSearchParams
URLSearchParams ready for API call