feat(#352 typesync.v2 | cli): buildout a CLI from the hypergraph package to read schema/mapping files #418
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Reference #352
There is a lot more to come out of this work, but this felt like a logical starting point.
The goal is to take the current
@graphprotocol/hypergraph-cli
and package it with the@graphprotocol/hypergraph
package that will be runnable if the user has the package installed as a dependency. And instead of using sqlite to create/manage multiple hypergraph schemas (apps), the cli tool will only deal with the hypergraph schema/mapping in the repo/directory the cli tool is ran in.It uses logical placements of the schema/mapping files in the directory (will likely need to expand on this, maybe a config will become handy to point to the schema/mapping files??). If these files can be found, it parses the schema and mapping files to build a
Schema
instance and emit this value on a streaming endpoint.The cli exposes a simple api that:
/api/v1/schema/events
that emits a SSE stream ofSchema
built fromSchema
Notes
schema.ts
can't be found, the streaming endpoint returns an emptySchema
object. Other way to handle it would be to throw an error from the cli if it can't be found to let the user know. Anyone have thoughts?