Home > @uniformdev/canvas > projectionToQuery

projectionToQuery() function

Serializes a ProjectionSpec into a flat record of select.* querystring keys. The output is intended to be spread into the same param bag that SDK clients pass to createUrl alongside rewriteFiltersForApi. CSV values use comma as the separator (matching the form-style serialization used by the API for array query params).

Output is deterministic for a given spec: top-level operator keys appear in fixed order, and the slots.<name>[depth] entries are sorted by slot name. Downstream cache keys and DataLoader loaderKeys depend on this.

Empty arrays vs undefined matters: { only: undefined } omits the key entirely; { only: [] } serializes as select.<bucket>[only]= (the canonical "strip everything" spelling — [only]= means "include nothing"). Callers that want to suppress an operator should set it to undefined.

Signature:

Parameters

Parameter

Type

Description

spec

ProjectionSpec | undefined

Returns:

Record<string, string>