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

feat(cozy-doctypes): Allow Document to use a CozyClient #455

Merged
merged 1 commit into from May 24, 2019

Conversation

cedricmessiant
Copy link
Contributor

@cedricmessiant cedricmessiant commented May 23, 2019

This is a first step to allow users to choose between cozy-client and cozy-client-js when they register a client for their models.

This is still at draft state since I would like to do the following before merge:

  • rename newCozyClient ➡️ cozyClient and cozyClient ➡️ cozyClientJS in testUtils.js
  • add tests for methods that use "the stackClient trick" (getAll, fetchChanges, fetchAll, updateAll). To do this, I need to be able to mock the stack client that CozyClient uses, it may not be easy.
  • we could also be more explicit in the methods names (e.g _ccjs_getIndex instead of _getIndex ?)

Copy link
Contributor

@ptbrowne ptbrowne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had removed the unregister explicitly to show that Document was not usable in parallel on multiple cozy. If it's needed for tests, we can make it private or rename it dangerousUnregisterClient ?

packages/cozy-doctypes/src/Document.js Show resolved Hide resolved
packages/cozy-doctypes/src/Document.js Outdated Show resolved Hide resolved
packages/cozy-doctypes/src/Document.js Outdated Show resolved Hide resolved
packages/cozy-doctypes/src/Document.js Outdated Show resolved Hide resolved
@ptbrowne ptbrowne self-requested a review May 24, 2019 08:43
@edas
Copy link
Contributor

edas commented May 24, 2019

On utilise le même modèle mais on considère que les méthodes ne doivent être accessibles que via un client et pas l'autre. C'est une vraie volonté de les abandonner et de forcer cet abandon ou c'est juste par manque de temps pour les implémenter avec cozy-client ?

@cedricmessiant
Copy link
Contributor Author

@edas c'est une première étape qui permet de permettre l'utilisation avec cozy-client sans pour autant passer trop de temps aujourd'hui à tout implémenter. L'idée c'est d'implémenter au fur et à mesure les méthodes lorsqu'on en a besoin et d'abandonner le support cozy-client-js à moyen/long terme

@cedricmessiant cedricmessiant force-pushed the use_CozyClient branch 2 times, most recently from 3600261 to 8d347e9 Compare May 24, 2019 11:15
Update packages/cozy-doctypes/src/Document.js

Co-Authored-By: Patrick Browne <pt.browne@gmail.com>
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

Successfully merging this pull request may close these issues.

None yet

5 participants