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

Herbarium - Use it to create mutations, queries and types #38

Closed
dalssoft opened this issue Dec 19, 2021 · 5 comments · Fixed by #54
Closed

Herbarium - Use it to create mutations, queries and types #38

dalssoft opened this issue Dec 19, 2021 · 5 comments · Fixed by #54
Assignees
Labels
enhancement New feature or request ready-to-work Item is ready to work on it released Already in production severity-minor Item is not urgent

Comments

@dalssoft
Copy link
Member

With the new release of Herbarium, herbs2gql can generate mutations, queries and types using it.

Instead of custom files (ex: mutations.js, queries.js, types.js) on the project, using Herbarium will be much simpler since it is a standardized way to access Herbs objects.

Instead of:
queries

const { usecase2query, defaultResolver } = require('@herbsjs/herbs2gql')
const { herbarium } = require('@herbsjs/herbarium')

const usecases = herbarium.usecases
    .findBy({ operation: [herbarium.crud.read, herbarium.crud.readAll] })
    .map(e => e.usecase)

const queries = usecases.map(usecase => usecase2query(usecase(), defaultResolver(usecase)))

/* Custom Queries */
// queries.push(require('./custom/getItems'))

module.exports = queries

it could be something like:

herbs2gql(herbarium)   // where `herbarium` constains all Herbs objects and its metadatas.
@dalssoft dalssoft added the enhancement New feature or request label Dec 19, 2021
@jhomarolo jhomarolo added ready-to-work Item is ready to work on it severity-minor Item is not urgent labels Dec 24, 2021
@PedroMarquesFr2
Copy link

PedroMarquesFr2 commented Jun 10, 2022

I'm working on it. @PedroMarquesFr

@italojs
Copy link
Member

italojs commented Jun 13, 2022

@jhomarolo could you update it with wip label, please?

@PedroMarquesFr
Copy link
Contributor

PedroMarquesFr commented Jun 14, 2022

I have just sent the pr herbsjs/herbs2gql#54, still working on the coverage, but can you check it and give some feedback? Is it on the right path?

@jhomarolo @italojs @dalssoft

@PedroMarquesFr
Copy link
Contributor

documentation created @italojs herbsjs/herbsjs.github.io#132

@herbsjs-robot
Copy link

🎉 This issue has been resolved in version 2.2.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@herbsjs-robot herbsjs-robot added the released Already in production label Jun 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request ready-to-work Item is ready to work on it released Already in production severity-minor Item is not urgent
Projects
Development

Successfully merging a pull request may close this issue.

6 participants