konnectors/libs

See how to clean cozy-konnector-libs

Opened this issue · 0 comments

The new BaseKonnector(start) pattern is problematic as the returned value is a promise and not the konnector. We should think on how to resolve this, and also think about existing konnectors and how to migrate.

In the konnector

import { run } from 'cozy-konnector-libs'

run(start)

In cozy-konnector-libs:

const run = function (fetch) {
    class Konnector extends BaseKonnector {
      fetch: fetch
    }

    const konn = new Konnector()
    await konn.run()
}

With the above pattern, we could have a jscodeshift that could change existing konnectors.