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

Promisification of Juggler DAO methods for service integration #1272

Closed
4 of 5 tasks
b-admike opened this issue Apr 23, 2018 · 4 comments · Fixed by loopbackio/loopback-connector-soap#91
Closed
4 of 5 tasks
Assignees
Milestone

Comments

@b-admike
Copy link
Contributor

b-admike commented Apr 23, 2018

Description

As part of weakly typed service integration for REST/SOAP and other services, LoopBack 3 connectors should have support for promises. This would let us use async/await. We'd like to change this.

Related to #1069

Acceptance Criteria

@bajtos
Copy link
Member

bajtos commented Apr 24, 2018

A bit of additional context. In theory, I see two possible approaches:

  1. Improve service connectors listed above to support promise/await invocation of the DAO methods they are defining, see Raymond's comment above.
  2. Modify DataSource implementation to automatically promisify (add Promise support to) all methods provided by connector's DAO. This can be tricky, because at DataSource level, we don't know which methods are async (and should be promisified) and which are sync (and should not be promisified).

Since a half of our connectors already support promises, adding promise support at connector level is pretty easy and promisification at DataSource level is tricky, I personally prefer the first approach - adding promise support in individual connectors.

I am proposing the following acceptance criteria:

  • Add promise support to loopback-connector-soap
  • Add promise support to loopback-connector-grpc
  • Write a blog post showing how to use Promises and/or async/await with our service connectors. IMO, the blog post should mention all four connectors, even those that already support promises today, and provide example code for both LB3 and LB4.

For completeness, there is a fifth service-like connector loopback-connector-remote and it already supports promises ✅

@dhmlau dhmlau added the DP3 label Apr 24, 2018
@dhmlau
Copy link
Member

dhmlau commented Apr 24, 2018

@b-admike , I've updated the acceptance criteria according to @bajtos' comment above.
PTAL. If it's good, then please move it for estimation. Thanks!

@shimks
Copy link
Contributor

shimks commented May 7, 2018

I've added support for promises in strong-soap but I'm wondering whether I should add in a test case for promise support in the downstream package loopback-connector-soap as well. Otherwise, I would consider this task done.

One problem with adding the test case for said package is that the tests are failing on loopback-connector-soap, and that the test case would have to build on top of the failing tests (operations built from wsdl file are failing, and the tests need to utilize the operations).

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 a pull request may close this issue.

5 participants