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

Use fishy as a crate to read schema.lock and deploy / migrate it automatically #3

Open
Corban-Dallas opened this issue Sep 8, 2023 · 4 comments
Labels
enhancement New feature or request

Comments

@Corban-Dallas
Copy link

Corban-Dallas commented Sep 8, 2023

Hello!

I am trying to write a decentralized book library app to get familiar with p2panda. Thanks for this great protocol, I think you do amazing job.

It would be nice to have something like fishy as a create to be able to read schemas from lock file and to deploy them to node by GraphQL client or just endpoint.

For example, it would be convenient to provide predefined schema.lock within application bundle, to initialize local offline app's node with these schemas.

Something like:

use fishy;

fn initializeApplicationNode {
    // create and start node...
    // prepare GraphQL client if needed...
   
    // Create LockFile
    // from path
    let path = Path::from("schema.lock");
    let lock_file = LockFile::from(path).unwrap();
    // from String
    let file_content = String::from("...readed content...");
    let lock_file = LockFile::from(file_content).unwrap();

    // import schema
    let schema: Vec<Schema> = lock_file.to_schema().ok();

    // Deploy
    fishy::deploy_lock_file(lock_file, client).ok();
    fishy::deploy_schema(schema, client).ok();
}

or may be something different but doing same job.

@adzialocha
Copy link
Member

adzialocha commented Sep 8, 2023

Hi @Corban-Dallas! Wow, the book library app sounds cool. You can also reach out on our chat https://wald.liebechaos.org if you need some help or have any questions.

It would be nice to have something like fishy as a create to be able to read schemas from lock file and to deploy them to node by GraphQL client or just endpoint.

That's a great idea! We've been thinking about something similar but didn't realize that fishy would be a good place for it.

In the Meli Android app we're currently building we've implemented a similar flow. Whenever the app starts it automatically migrates to the latest version of the schemas based on the schema.lock file: https://github.com/p2panda/meli/blob/main/packages/app/lib/io/p2panda/schemas.dart#L31 - parts of this code are very much inspired by the fishy deploy logic.

Do you want to prepare a PR for this?

@Corban-Dallas
Copy link
Author

Corban-Dallas commented Sep 8, 2023

You can also reach out on our chat https://wald.liebechaos.org/ if you need some help or have any questions.

Was trying to, but during registration nothing happens when I press "Join your team". May be some problem from my side, I'm using Firefox.

In the Meli Android app we're currently building we've implemented a similar flow. Whenever the app starts it automatically migrates to the latest version of the schemas based on the schema.lock file: https://github.com/p2panda/meli/blob/main/packages/app/lib/io/p2panda/schemas.dart#L31 - parts of this code are very much inspired by the fishy deploy logic.

Thanks, I will take a look. My original idea was to hide QraphQL client from Dart-side and provide convenient interface of rust-library where all fetching with predefined queries would be happening, so this library can be easily used anywhere, for example in ios-swift app as well.

Do you want to prepare a PR for this?

I am not good enough for this for now =) I am Swift developer, only familiarize myself with Rust and Dart. For now It is just a training project on the stack, nothing serious.

@adzialocha
Copy link
Member

Was trying to, but during registration nothing happens when I press "Join your team". May be some problem from my side, I'm using Firefox.

That's probably related to a weird issue with RocketChat where passwords not following the password policy get rejected but without notification in the UI .. (in the console one can observe the error message). I don't know how to fix this issue in RocketChat, but I just turned off the strict password policy. Let me know if it works again!

Thanks, I will take a look. My original idea was to hide QraphQL client from Dart-side and provide convenient interface of rust-library where all fetching with predefined queries would be happening, so this library can be easily used anywhere, for example in ios-swift app as well.

Great!

I am not good enough for this for now =) I am Swift developer, only familiarize myself with Rust and Dart. For now It is just a training project on the stack, nothing serious.

Ah cool, then we'll tackle this in the future. Might get back for some input.

@adzialocha adzialocha changed the title fishy as a crate Use fishy as a crate to read schema.lock and deploy / migrate it automatically Sep 8, 2023
@adzialocha adzialocha added the enhancement New feature or request label Oct 17, 2023
@sandreae sandreae linked a pull request Nov 4, 2023 that will close this issue
@sandreae
Copy link
Member

sandreae commented Nov 4, 2023

Started exploring ideas here: #11

Happy for any feeback @adzialocha & @Corban-Dallas

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants