loopback-datasource-juggler icon indicating copy to clipboard operation
loopback-datasource-juggler copied to clipboard

Allow connectors to be implemented as ES6 classes

Open bajtos opened this issue 6 years ago • 3 comments

I would like the connectors to leverage ES6 class inheritance.

Acceptance criteria

  • [ ] Rework Connector and SqlConnector classes provided by loopback-connector to be implemented as ES6 classes. This is a semver-major change.
  • [ ] Rework the documentation for connector authors to use class inheritance.

Out of scope

Eventually we should update all of our connectors to use the new major version of loopback-connector and switch to ES6 class inheritance.There should be follow-up issues opened (one per the connector repository).

Related: https://github.com/strongloop/loopback-datasource-juggler/issues/1659

bajtos avatar Jul 11 '19 14:07 bajtos

From what I've seen in 3rd-party connectors, it's already possible to implement connectors using class inheritance.

const {Connector} = require('loopback-connector');

class MyAwesomeConnector extends Connector {
  constructor(settings) {
    super('myawesome', settings);
  }

  // ...
}

In that light I think rewriting Connector and SqlConnector to ES6 class style is not worth our effort at this time, also considering the breaking change. We have more important problems to address!

I am proposing to change the scope of this issue to doc updates only:

  • [ ] Rework the documentation for connector authors to use class inheritance.

@raymondfeng @dhmlau thoughts?

bajtos avatar Sep 19 '19 14:09 bajtos

On the other hand, we will be introducing a new semver-major version of loopback-connector as part of #1659, in which case it may be better to bundle both changes in the same release. 🤔

bajtos avatar Sep 19 '19 15:09 bajtos

@markdirish, per the google group discussion, thanks for your interest in contributing this issue. I'm going to assign this to you. Thanks!

UPDATED: Looks like your name does not show up in the assignee list, so cannot assign it to you.

dhmlau avatar Sep 23 '19 20:09 dhmlau