cozy / cozy-client-js

Javascript library to write Cozy applications
https://docs.cozy.io/en/cozy-client-js/README/
MIT License
11 stars 12 forks source link

enhancement: add composition feature on intents #264

Closed gregorylegarec closed 6 years ago

gregorylegarec commented 6 years ago

This PR adds intent composition feature. It allows, from an intent service, to request another intent. As this intent have to be handled by the intent client, due to X-Frame-Options limitations, it has been named Intent Composition.

An intent composition can be called this way:

const service = cozy.client.intents.createService()
// ...
const app = service.compose('INSTALL', 'io.cozy.apps', { slug: 'drive' })

What happens internally:

This process can be chained indefinitely.

Refactoring

I managed to refactor a little bit the code. What I had in mind was more modular and more clear than the actual result. I am not satisfied by the client part. But the code related to the composition is actually relatively simple and clear. I plan to improve the whole intent code base in the future.

gregorylegarec commented 6 years ago

(5) [COL] ETU je peux installer/configurer UN connecteur depuis de l'inter-apps [3]

CPatchane commented 6 years ago

Thanks @gregorylegarec 🏒