Skip to content
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

[Rust][Compiler] Add Configuration/Document Query Persisting in the OSS Compiler #3627

Closed
2 tasks done
Tracked by #3180
alunyov opened this issue Nov 8, 2021 · 4 comments
Closed
2 tasks done
Tracked by #3180

Comments

@alunyov
Copy link
Contributor

alunyov commented Nov 8, 2021

@alunyov alunyov changed the title Add Configuration/Document Query Persisting in the OSS Compiler [Rust][Compiler] Add Configuration/Document Query Persisting in the OSS Compiler Nov 8, 2021
@maraisr
Copy link
Contributor

maraisr commented Nov 8, 2021

This in order to support @preloadable in OSS? Or more not to support the FormData upload mechanism, and be back to the JS version of json files?

@alunyov
Copy link
Contributor Author

alunyov commented Nov 9, 2021

In the rust version, we decided to expose the persisting mechanism we are using internally. Basically, we're sending (HTTP post) full query text to the API endpoint, that knows how/where to save the query text, and it can return a persisted query ID for it.

See: https://github.com/facebook/relay/blob/main/compiler/crates/persist-query/src/lib.rs#L53-L72

This task is just to add documentation for it and expose it via SingleProjectConfigFile, here: https://github.com/facebook/relay/blob/main/compiler/crates/relay-compiler/src/config.rs#L630

And yeah, with persisted query IDs @preloadable can generate $parameters files that can be used with entry-points. But maybe there is something else we need to add.

facebook-github-bot pushed a commit that referenced this issue Nov 9, 2021
Summary: For more details see: #3627

Reviewed By: kassens

Differential Revision: D32261009

fbshipit-source-id: c4cc581b2be8b5372b346e7a796df24578e5463a
@wongmjane
Copy link
Contributor

wongmjane commented Nov 15, 2021

It’s great to know the Rust version of the Relay compiler has RemotePersister for persisting queries remotely:

https://github.com/facebook/relay/blob/87696f9cbf61739cb7474be447cf1d88e6eec0c8/compiler/crates/relay-compiler/src/remote_persister.rs

Will there still be a way to locally persist the queries (e.g. writing into a JSON file locally like the JS version)? Thanks!

Update: @vincentriemer is working on it #3666 🚀

@alunyov
Copy link
Contributor Author

alunyov commented Nov 15, 2021

Thanks @wongmjane!

Currently, we don't have this, but it should not be difficult change to add support for this.
This new JSON local persister just needs to implement the OperationPersister trait.

We always welcome contributions and are happy to review and merge them :-)

@alunyov alunyov closed this as completed Nov 30, 2021
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

No branches or pull requests

3 participants