Skip to content

Nik/include space ids - #571

Merged
nikgraf merged 6 commits into
mainfrom
nik/include-space-ids
Dec 7, 2025
Merged

Nik/include space ids#571
nikgraf merged 6 commits into
mainfrom
nik/include-space-ids

Conversation

@nikgraf

@nikgraf nikgraf commented Dec 7, 2025

Copy link
Copy Markdown
Collaborator

closes #567

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds support for including space IDs in entity query results, allowing applications to determine which public spaces an entity belongs to. This addresses issue #567 by introducing an optional includeSpaceIds parameter that, when set to true, enriches entities with a normalized spaceIds: string[] array.

Key changes:

  • Added includeSpaceIds parameter to findOnePublic, findManyPublic, and searchManyPublic functions
  • Implemented space ID normalization that filters out null entries
  • Extended React hooks (useEntity, useEntities) to support the new parameter with proper type inference

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
packages/hypergraph/src/entity/internal/normalize-space-ids.ts New utility function to filter null values from space ID arrays
packages/hypergraph/src/entity/types.ts Added WithSpaceIds conditional type for type-safe space ID inclusion
packages/hypergraph/src/entity/find-one-public.ts Added includeSpaceIds parameter support with GraphQL query modification and result parsing
packages/hypergraph/src/entity/find-many-public.ts Extended to support includeSpaceIds with proper type inference for batch queries
packages/hypergraph/src/entity/search-many-public.ts Added space IDs support to search functionality
packages/hypergraph-react/src/internal/use-entity-public.tsx Updated React hook to accept and propagate includeSpaceIds parameter
packages/hypergraph-react/src/internal/use-entities-public.tsx Extended batch entity hook with space IDs support
packages/hypergraph-react/src/internal/types.ts Updated type definitions to include IncludeSpaceIds generic parameter
packages/hypergraph-react/src/hooks/use-entity.tsx Added type-safe includeSpaceIds parameter to public API
packages/hypergraph-react/src/hooks/use-entities.tsx Extended public hook with space IDs support and proper type inference
packages/hypergraph/test/entity/space-ids-types.test.ts New type inference tests verifying correct behavior with and without includeSpaceIds
packages/hypergraph/test/entity/find-many-public.test.ts Updated existing tests to include spaceIds field and added normalization test
packages/hypergraph-react/test/space-ids-types.test.ts Type tests for React hooks ensuring proper space IDs type inference
docs/docs/query-public-data.md Documentation explaining how to use includeSpaceIds with code examples
apps/events/src/routes/podcasts.lazy.tsx Example usage demonstrating the new feature

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread docs/docs/query-public-data.md Outdated
Comment thread apps/events/src/routes/podcasts.lazy.tsx
Comment thread packages/hypergraph/src/entity/find-one-public.ts Outdated
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@nikgraf
nikgraf merged commit e4a7f22 into main Dec 7, 2025
6 checks passed
@nikgraf
nikgraf deleted the nik/include-space-ids branch December 7, 2025 12:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow to query space IDs for an entities

2 participants