loopbackio / loopback-next Goto Github PK
View Code? Open in Web Editor NEWLoopBack makes it easy to build modern API applications that require complex integrations.
Home Page: https://loopback.io
License: Other
LoopBack makes it easy to build modern API applications that require complex integrations.
Home Page: https://loopback.io
License: Other
@hacksparrow lets discuss the details for generating the loopback-next docs based on typescript.
This is mainly the build process.
I am proposing to set an aggressive timeline for the next version and remove any features that are not done on time. Preliminary proposal:
This is based on my experience with managing 3.0 release - even though we drastically reduced the scope of the release in May 2016 (using the rule described in my step 1 above) , the first release candidate was not released until October 2016 and the GA was announced in December. I.e. it took us more than 6 months to finish a release. Projecting this experience to loopback-next and my proposed dates, loopback-next will be released in 2017Q4.
Hey everyone,
We need to start coordinating the releases of this project for obvious / not so obvious reasons. Mainly we need to start getting on a cadence that we already are on for LB@3. Below is a proposal / checklist, agreed on with some folks who will help with marketing / promotion of LB.next.
Please note this is a proposal for a timeline that folks can work against. None of the dates are final yet. But as we schedule events around these dates... they will be somewhat set in stone.
Date: April 7th
strongloop/loopback
(@ritch)Date: May 1st
Date: June 1st
This issue is for new folks to chime in and say hello and that they'd like to be involved offline (off GitHub) discussions. I'm not expecting the working group on this project to be so large that we can't all get to know each other.
Just comment here that you'd like to be added to the LoopBack.next contributors list and I'll create a group in the StrongLoop org with all of you - so we can do things like @strongloop/loopback-next for scheduling external meetings and such.
When we invite you to join our org and you don't receive an email notification for GitHub, then you can accept the invite here: https://github.com/strongloop
Check out issues labelled as good first issue for tasks suitable for new contributors.
Updated on 05/31/2019
Hi all! First of all, thanks for your interests and support in LoopBack 4!
We have been thinking about how to grow our contributor community together with the user community. There are several ways to contribute:
We hope you are contributing to something that you need or will be using. We'd encourage you to take a backlog and see if any of our GitHub issues capture your requirement. If you're planning to implement a more complex feature, it would be helpful to submit a draft PR with minimal implementation to discuss your approach first. It would also be helpful to include your use case so that we can understand your requirements better. This is to make sure the intended implementation would align with our architecture and direction.
If you don't have a particular area you want to contribute, you can look up the help wanted
: https://github.com/strongloop/loopback-next/labels/help%20wanted
If you're new to contributing to LoopBack or open source projects in general, don't worry. You can look at issues with good first issue
. Those issues are meant for new contributors:
https://github.com/strongloop/loopback-next/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22
Determine the features / examples for how to test loopback-next applications.
The current initial PoC implementation supports only two parameter sources: path and query. We need to add support for the remaining sources defined in the Swagger spec:
https://github.com/strongloop/loopback-next/blob/master/packages/remoting/package.json#L14
this causes lerna exec npm install
to fail - since its not in the registry
In the past year or two, we have repeatedly came across the idea of using a single monorepo containing all core LoopBack modules (strong-remoting, juggler, loopback, possibly others like swagger, etc.). The last time this was mentioned by @ritch when discussing loopback-next kick-off.
In this thread, I'd like to discuss pros and cons of using monorepo approach for the development of loopback-next (and possibly beyond).
Controllers decoupled from the data models/ORM is a concept I have had in my mind for very long time and that I am personally interested in exploring.
We have already started some exploratory work in this direction, see
https://github.com/strongloop-internal/scrum-loopback/issues/614#issuecomment-187124065 and the rest of the discussion.
Once we have a basic concept of a connector implemented, it will open up many further areas to investigate, for example:
Right now, defining custom types to describe input/output values of custom remote methods is a bit cumbersome. The format of these definition is LDL, which is our own non-standard language. I would like to allow users to describe their input/output values using JSONSchema and/or the subset of JSON Schema used by Swagger.
There are only very basic validation of input arguments that are not Models - we check for type (string/number/object) and whether the argument is required or not. I would like to see improved validations, using either JSON Schema or npm modules like joi
ORM independence. Let's face it, writing and maintaining a good ORM is a lot of work, and in all honesty, I think we are pretty much failing at that. I would like to make it easy for LoopBack users to switch to a different ORM/data-access library when their needs outgrow the basic ORM capabilities we provide in LoopBack.
For the scope of loopback-next, I think there will be more than enough work to implement Controllers as a first-class entity, meaning:
MVP instructions on how to install and use Loopback-next.
Our new official policy is that questions are allowed on GitHub, at least until LoopBack4 reaches GA. Users are still encouraged to post their questions on StackOverflow though.
We should apply yellow "functional-area" labels like "CLI", "Examples", "Docs" to questions as part of our issue triage process. This will make it easier for people to find unanswered questions related to their area of interest/expertise.
(See also a follow-up issue to improve Contrib docs in general: #950)
<!--
HELP US HELP YOU BY
- Doing a quick search to avoid duplicate issues
- Providing as much information as possible (versions, use case scenarios for features, etc.)
- Open GitHub issue as the last resort
If you have a question then please consider using a more suitable venue:
- https://stackoverflow.com/questions/tagged/loopbackjs
- https://groups.google.com/forum/#!forum/loopbackjs
- https://gitter.im/strongloop/loopback
-->
The original description from Simon for posterity:
Flame war topic.
Pros:
Cons:
Make/utilize a LINQ-like query builder that helps us more generically define the meat of a query before it runs against the database so that we can avoid pre-loading the entirety of one or more tables in memory to perform filtering and aggregation.
users will not be able to access the package because a main script is not exposed
Can't "require('loopback-next')" via JavaScript.
"Is there a preferred way to do a health check endpoint in LoopBack? I’m seeing this which looks decent: https://www.npmjs.com/package/healthcheck-fastit" as per @erin.mckean on Slack
Something we should consider IMO.
In loopback/strong-remoting 3.x, we allow remote methods to accept parameters of complex types and have the runtime to convert string inputs (e.g. in a query string or formdata) to such complex type.
strong-remoting 3.x has pretty extensive test suite that we can reuse here - see strong-remoting:test/rest-coercion/
color[R]=100&color[G]=200&color[B]=150
and color={"R":100,"G":200,"B":150}
encodings (the latter is our own extension).Everything else (other styles than deepObject, array values, etc.) is out of scope of GA.
The spec: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.1.md#parameterObject
Send a "filter" query as JSON-encoded value:
GET /api/products?filter={"where":{"name":"Pen"},"limit":10}
Sets filter
argument to {where: {name: 'Pen'}, limit: 10}
.
Alternative encoding:
GET /api/products?filter[where][name]=Pen&filter[limit]=10
Encode an array of strings as a comma-separated list (OUT OF SCOPE OF 4.0 GA)
GET /api/domains?tlds=com,net,eu
Sets tlds
argument to ['com', 'net', 'eu']
.
See https://github.com/strongloop/loopback-next/pull/61/files#r102336527
We need to make it easy to know the input and output of the ctx's APIs. Here are some examples
// Hard to remember the string, easy to introduce typos
ctx.bind('someLongStringHere').to(SomeType);
// Does MyConcreteType implement MyInterface ???
// would be nice if the compiler checked this for me
ctx.bind('MyInterface').to(MyConcreteType);
// when I refactor code - I don't want to have to go find/replace all instances of 'someString'
ctx.bind('someString').to(SomeValue);
I think the main goal of loopback-next
should be TypeScript
and es6-7 as first class features. Below are the goals:
TypeScript
classes using es6 / 7 features best practicesTypeScript
native modules eg. import
and export
.async
and await
everywhereBelow is brief list of impact for discussion.
require()
TypeScript
- need to provide docs as both TypeScript
and JavaScript
TypeScript
???mixin
and class
in jugglerAnything else?
Setup TypeScript build chain and npm config so that npm pack
(and npm publish
) ships Node 4.x compatible JavaScript sources.
In order to continually verify the correctness of this setup, a simple end-to-end test written in pure javascript should be included.
I don't have an opinion, but since Ritchie mentioned this some time ago, I thought I'd throw it in the mix.
Shall we replace Express with Koa in LB4?
Excuse my naiveté, but would it be possible to add Koa, so that apps could use either Koa or Express style middleware? Or is that impossible or impractical?
What are implications for:
Compare mocha
, tap
and tape
to decide which framework to use.
Concerns to address:
The current initial PoC version is based on Express' path-to-regexp, which is know to scale poorly.
We should switch to a Trie-based implementation, consider using an existing module https://github.com/yoshuawuyts/wayfarer
Flame war topic.
We need to address the number of growing/open issues in a sustainable way. Ideas?
Abstract out start
function from Application
into own class.
strongloop/loopback#591 (comment)
I see this come up a lot, like how you have to "extend built in user model" + "automigrate the ACL, Role, etc" tables. We need a better experience than this (not to mention good docs up front if we're going to leave a bad experience like this for people just getting started).
Here is a minimal but somewhat complete example for a few features / tweaks that I'd like to see. It includes everything that I can think of as fundamental building blocks...
Application
Model
Collection
Controller
and method (with decorator sugar)app
(see: @app.controller
and other examples@app.collection
, @inject('currentUserId')
)TBD:
import {app} from 'app'
(ugly, global-ish)app.start()
/ Server
usage (missing)// app.ts
import {Application} from 'loopback';
export const app = new Application();
// todo.ts
import {app} from 'app';
@app.model
class Todo {
txt : string;
done : boolean = false;
}
// todo.controller.ts
import {Collection} from 'loopback';
import {app} from 'app';
import {Todo} from 'todo';
@app.controller
class TodoController {
@app.collection
todos : Collection<Todo>;
@app.get('/my/todos')
list(@app.inject('currentUserId') uid) : Collection<Todo> {
return this.todos.find({where: {owner: uid}});
}
}
// hooks.ts
import {app} from 'app';
@app.bind('currentUserId')
function getUserId(ctx : Context) : string {
const token = ctx.get('accessToken');
if (token) return token.userId;
}
@app.bind('accessToken')
getToken(ctx : Context) : AccessToken {
return new Token(ctx.get('req'));
}
@app.before('controller.*.list')
function beforeAll(ctx : Context) {
console.log('before', ctx.get('method.name')); // "before list"
}
@app.before('controller.**', {express: true})
require('morgan')(); // express middleware also supported
// name your hooks for more control
@app.after({name: 'timestamp', match: 'controller.**'})
function afterAll(ctx : Context) {
const result = ctx.get('result');
ctx.bind('result').to({
timestamp: Date.now(),
data: result
});
}
// ensure a hook runs after another hook
@app.after({ensure: ['timestamp'], match: 'controller.*'})
function end() {
console.log('last hook!')
}
Placeholder: https://www.npmjs.com/package/@loopback/loopback
We can potentially name LoopBack modules as:
@loopback/core
@loopback/remoting
@loopback/connector
@loopback/connector-oracle
@loopback/workspace
A way for us to reflect the changes in the source code to an online version. Doesn't need to be 100%, just something working.
See https://github.com/fastify/fastify/blob/master/docs/Validation-And-Serialize.md#serialize, https://www.npmjs.com/package/fast-json-stringify, consider also https://www.npmjs.com/package/fast-safe-stringify.
The fastify framework claims it's gaining 1-4x speed-up from using this module.
Since our routes (controller methods) provide swagger metadata describing the expected output format in a JSON-Schema-like format, we should be able to leverage this metadata to improve the performance.
There are many responsibilities in loopback-datasource-juggler today. We need to decompose them into separate modules for different concerns.
The following slides outline some of the main perspectives around juggler as potential candidates:
when I try to return an object I always get the following error on the console, and no response is returned,
loopback-next seems to work only for string data type in response
(node:20186) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: First argument must be a string or Buffer
(node:20186) DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
For consistent coding styles. http://editorconfig.org/
See https://github.com/strongloop/loopback-next/wiki/Overview
Taking notes on wants from community here (ie. what we hear):
I understand the desire to initially keep the discussion and development of LB.next internal, for reasons of speed and efficiency and to ensure that focus is on "our" needs vs. rest of the world.
Nevertheless, this is an open source project, so at some point we need to change to open development. Also, at some point we will start releasing it to the public.
Rather than simply presenting the next version as a fait accompli for people to take or leave (or just gripe about), I suggest we have a thoughtful community strategy. If there has been detailed discussion of this, I'm not aware of it.
Here are some suggestions:
Most importantly, we must avoid alienating the community by giving the appearance of ignoring its input or not being good "open-source citizens."
packages/loopback
Like tasks.json -- will lower barrier to entry for common loopback related tasks.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.