Skip to content

feat(network-subgraphs): Add idAsString field #1024

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jun 17, 2025
Merged

Conversation

teogeb
Copy link
Contributor

@teogeb teogeb commented Jun 16, 2025

Added new field to Stream entity: Stream#idAsString. It has same value as in the id field. The field allows us to do substring queries for the field id (by using idAsString_contains where clause).

This feature is needed e.g. in streamr-dev/network#3132.

@teogeb teogeb requested a review from Copilot June 16, 2025 16:45
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Add a new idAsString field to the Stream entity to support substring GraphQL queries on stream IDs.

  • Set idAsString when streams are created or backfilled in both handleStreamCreation and handleStreamUpdate.
  • Update the GraphQL schema to include idAsString: String! @index with a descriptive comment.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
packages/network-subgraphs/src/streamRegistry.ts Assign idAsString in creation and update handlers; handle backfill case.
packages/network-subgraphs/schema.graphql Add idAsString field with index annotation and description.
Comments suppressed due to low confidence (2)

packages/network-subgraphs/src/streamRegistry.ts:50

  • In the fallback branch of handleStreamUpdate, add stream.updatedAt = event.block.timestamp to ensure the new entity has both createdAt and updatedAt set consistently.
stream.createdAt = event.block.timestamp

packages/network-subgraphs/schema.graphql:39

  • Consider adding integration or unit tests to verify that idAsString_contains queries return the expected subset of streams.
idAsString: String! @index

@teogeb teogeb requested review from jtakalai and harbu June 16, 2025 17:32
@teogeb teogeb merged commit 5c7cec2 into main Jun 17, 2025
3 checks passed
@teogeb teogeb deleted the add-stream-idAsString-2 branch June 17, 2025 12:28
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.

2 participants