Skip to main content

EntityFilterQuery

Home > @backstage/catalog-client > EntityFilterQuery

A key-value based filter expression for entities.

Signature:

export type EntityFilterQuery = Record<string, string | symbol | (string | symbol)[]>[] | Record<string, string | symbol | (string | symbol)[]>;

Remarks

Each key of a record is a dot-separated path into the entity structure, e.g. metadata.name.

The values are literal values to match against. As a value you can also pass in the symbol CATALOG_FILTER_EXISTS (exported from this package), which means that you assert on the existence of that key, no matter what its value is.

All matching of keys and values is case insensitive.

If multiple filter sets are given as an array, then there is effectively an OR between each filter set.

Within one filter set, there is effectively an AND between the various keys.

Within one key, if there are more than one value, then there is effectively an OR between them.

Example: For an input of

[
{ kind: ['API', 'Component'] },
{ 'metadata.name': 'a', 'metadata.namespace': 'b' }
]

This effectively means

(kind = EITHER 'API' OR 'Component')
OR
(metadata.name = 'a' AND metadata.namespace = 'b' )