Merge pull request #34214 from backstage/freben/queryentities-total-items

catalog-backend: split queryEntities list + count, add totalItems mode
This commit is contained in:
Fredrik Adelöw
2026-05-26 14:47:46 +02:00
committed by GitHub
20 changed files with 341 additions and 69 deletions
@@ -0,0 +1,9 @@
---
'@backstage/plugin-catalog-backend': minor
---
`/entities/by-query` now accepts a `totalItems` parameter (`'include'` or `'exclude'`, default `'include'`) that controls whether the response's `totalItems` count is computed. Pass `'exclude'` to skip the count entirely when the caller doesn't need it — useful for cursor-paginated user interfaces that only display the count cosmetically. The accepted values list is forward-compatible: future modes (e.g. approximate counts) can be added without breaking existing callers.
The internal `QueryEntitiesInitialRequest.skipTotalItems` option has been replaced by `totalItems: 'include' | 'exclude'`. Note that `skipTotalItems` was never exposed as a REST API parameter, so this is only a TypeScript-level change affecting direct callers of `EntitiesCatalog.queryEntities`.
Sort field keys are now lowercased before comparing against `search.key`, fixing silent mismatches for camelCase field names. The `NULLS LAST` ordering clause has been removed since NULL sort values are already excluded by the `WHERE` clause.
@@ -0,0 +1,5 @@
---
'@backstage/catalog-client': minor
---
`CatalogApi.queryEntities` now accepts a `totalItems` option (`'include'` or `'exclude'`, default `'include'`) on initial requests. Pass `'exclude'` to skip the `totalItems` count when the caller doesn't need it.