Miroslav Bajtoš
038c6a454e
middleware/token: store the token in current ctx
2014-11-11 11:04:41 +01:00
Miroslav Bajtoš
8f5aea3e3b
Fix `loopback.getCurrentContext`
...
- ensure the method is always defined
- return `null` when the context is not active
(we are not inside a request-handling chain)
2014-11-11 11:04:41 +01:00
Miroslav Bajtoš
4e1433b519
Middleware phases - initial implementation
...
Modify the app and router implementation, so that the middleware is
executed in order defined by phases.
Predefined phases:
'initial', 'session', 'auth', 'parse', 'routes', 'files', 'final'
Methods defined via `app.use`, `app.route` and friends are executed
as the first thing in 'routes' phase.
API usage:
app.middleware('initial', compression());
app.middleware('initial:before', serveFavicon());
app.middleware('files:after', loopback.urlNotFound());
app.middleware('final:after', errorHandler());
Middleware flavours:
// regular handler
function handler(req, res, next) {
// do stuff
next();
}
// error handler
function errorHandler(err, req, res, next) {
// handle error and/or call next
next(err);
}
2014-11-10 19:50:58 +01:00
Raymond Feng
747da886c9
Merge pull request #745 from strongloop/feature/allow-acls-settings-config
...
Allows ACLs/settings in model config
2014-11-07 11:15:08 -08:00
Raymond Feng
586ea35071
Allows ACLs/settings in model config
2014-11-07 11:14:40 -08:00
crandmck
3cdbd274d2
Add API doc for context middleware - see #337
2014-11-06 14:07:34 -08:00
Rand McKinney
21b28446bf
Update persisted-model.js
...
Note the PersistedMode.create() can take an array of instances, per #710 .
2014-11-06 10:56:37 -08:00
Miroslav Bajtoš
4fdcbd16af
rest middleware: clean up context config
...
Modify `loopback.rest()` to read the configuration for
`loopback.context` from `app.get('remoting')`, which is the approach
used for all other configuration options related to the REST transport.
2014-11-05 09:13:45 +01:00
Raymond Feng
885f4e047d
Enable the context middleware from loopback.rest
2014-11-05 09:13:45 +01:00
Raymond Feng
246f38c05d
Add context propagation middleware
...
- Implement the middleware `loopback.context`
- Inject context into juggler and strong-remoting
- Make http context optional and default to false
- Optionally mount context middleware from `loopback.rest`
2014-11-05 09:13:44 +01:00
Rand McKinney
0e35c1877c
Changes to JSdoc comments
...
Moved faviconFile to class properties.
2014-11-04 10:59:38 -08:00
Miroslav Bajtoš
48d4ed28d3
Coding style cleanup (Gruntfile, lib)
...
- Gruntfile: add `jshint` and `jscs` as deps of `grunt test`
- Gruntfile: temporarily disable checks of `test` scripts
- .jscsrc: relax jsdoc validation
- .jshintrc: relax the rule for property access via dot notation
- lib: fix remaining style issues
2014-11-04 08:25:35 +01:00
Rob Halff
33096dafa7
Enable jscs for `lib`, fix style violations
2014-11-04 08:25:33 +01:00
Rand McKinney
3d201028e1
Remove doc for debug function
2014-11-03 16:26:33 -08:00
Rand McKinney
c388696d3f
Update registry.js
...
Add missing quotes to examples in JSdoc.
2014-11-03 16:02:48 -08:00
Miroslav Bajtoš
f8c5fc8f6a
Merge pull request #726 from strongloop/feature/apidocs-for-loopback.static
...
Add API docs for `loopback.static`.
2014-11-03 18:33:41 +01:00
Miroslav Bajtoš
edd464aca5
Expose path to the built-in favicon file
...
The path is available via `loopback.faviconFile`.
2014-11-03 10:00:24 +01:00
Miroslav Bajtoš
1c083f1030
Add API docs for `loopback.static`.
2014-11-03 09:20:54 +01:00
Miroslav Bajtoš
292c7ad497
Revert "rest handler options"
2014-10-31 10:06:57 +01:00
Guilherme Cirne
ba6bf3f41b
REST handler options.
2014-10-30 16:58:30 -02:00
Raymond Feng
e0ed755ed3
Make sure GET /:id/exists returns 200 {exists: true|false}
...
https://github.com/strongloop/loopback/issues/679
2014-10-22 14:39:39 -07:00
Rob Halff
b54c70c348
Use === to compare with 0
2014-10-22 18:47:53 +02:00
Rob Halff
84b4fea666
use singlequotes
2014-10-22 18:47:53 +02:00
Rob Halff
4ebf10ae0d
add missing semicolons
2014-10-22 18:47:52 +02:00
Fabien Franzen
568c8662b4
Support per-model and per-handler remoting options
...
Allow the developer to pass custom `remoting` options via Model
settings, e.g.
PersistedModel.extend(
'MyModel',
{ name: String },
{
remoting: { normalizeHttpPath: true }
});
Also add `options` arg to `app.handler`, this object is passed directly
to strong-remoting handler.
2014-10-22 09:54:15 +02:00
Miroslav Bajtoš
80020eb273
lib/application: improve URL building algo
...
When running on Unix and no hostname is specified, use `0.0.0.0`
as the hostname instead of `localhost`.
When running on Windows and the hostname is either not specified or
it is `0.0.0.0` or `::`, use `localhost` in the URL. The reason is
that Windows cannot open URLs using `0.0.0.0` as a hostname.
2014-10-20 13:47:24 +02:00
Rand McKinney
f511bd38c9
Fix findById callback signature
2014-10-15 13:45:15 -07:00
Rand McKinney
e4118c367d
JSdoc fixes
...
Ad:
- update is alias for updateAll.
- Make callback optional for save method
2014-10-15 13:40:14 -07:00
Miroslav Bajtoš
20026a9d04
Fix places using undefined variables
...
Also enable jshint option "undefined" in order to catch these kind
of errors in the future.
2014-10-15 16:44:00 +02:00
crandmck
2f4a54d93c
Clean up jsdoc comments
...
Add class properties, expose some methods that should have
been documented, etc.
2014-10-15 09:42:24 +02:00
Miroslav Bajtoš
0906a6f5b3
models: move Change LDL def into a json file
2014-10-14 09:04:43 +02:00
Miroslav Bajtoš
6cbc231fba
models: move Checkpoint LDL def into a json file
2014-10-14 09:04:43 +02:00
Miroslav Bajtoš
461ae92c1c
models: move Role LDL def into a json file
2014-10-14 09:04:43 +02:00
Miroslav Bajtoš
e9c86163aa
models: move RoleMapping def into its own files
2014-10-14 09:04:43 +02:00
Miroslav Bajtoš
7c01d59d80
models: move ACL LDL def into a json file
2014-10-14 09:04:43 +02:00
Miroslav Bajtoš
ef890d5f26
models: move Scope def into its own files
2014-10-14 08:58:17 +02:00
Miroslav Bajtoš
5f20652241
models: move AccessToken LDL def into a json file
2014-10-14 08:58:17 +02:00
Miroslav Bajtoš
1e6beabbd2
models: move Application LDL def into a json file
...
Move some of the comments describing properties into jsdoc.
2014-10-14 08:58:17 +02:00
Miroslav Bajtoš
551d109a20
models: move Email LDL def into `email.json`
2014-10-14 08:58:17 +02:00
Miroslav Bajtoš
920d3be6a3
models: move User LDL def into `user.json`
2014-10-14 08:58:17 +02:00
Miroslav Bajtoš
df9fe90d35
Auto-load and register built-in `Checkpoint` model
2014-10-14 08:58:16 +02:00
Miroslav Bajtoš
1fe0110849
Dismantle `lib/models`.
...
- Move core models `Model` and `PersistedModel` to `lib/`.
- Move `AccessContext` class to `lib/`, since it is not a model.
- Move all other built-in models to `common/models`.
This is a preparation for extracting model definitions to JSON files.
By splitting the change into multiple commits, git is able to keep track
of file moves (renames).
2014-10-13 12:09:27 +02:00
Miroslav Bajtoš
3a0f793c9b
Register built-in models in a standalone file
...
Move the code registering built-in models to a new file
`lib/builtin-models.js`.
2014-10-13 12:09:19 +02:00
Miroslav Bajtoš
846a0b0074
models/change: fix `id` property definition
...
Remove the flag `generated:true`, as it does not work together with
a custom `setter.id` function.
2014-10-10 19:10:42 +02:00
Rand McKinney
223fa7a442
Added class properties jsdoc.
2014-10-08 17:26:45 -07:00
Rand McKinney
7aca64a660
Fixed up JS Doc
2014-10-08 15:07:03 -07:00
Rand McKinney
6de9645f45
Added class properties jsdoc.
2014-10-06 10:15:26 -07:00
Rand McKinney
8af1b96a47
Document ACL class properties
2014-10-01 17:21:22 -07:00
Rand McKinney
abdaa4a1b9
Add properties JSdoc.
2014-10-01 16:25:03 -07:00
Krishna Raman
b5516757ae
Move looback remote connector to npm module
2014-10-01 14:48:34 -07:00
Ritchie Martori
0e8c019534
Merge pull request #601 from strongloop/doc/user-props
...
Document user class properties
2014-10-01 13:38:55 -07:00
Ritchie Martori
8c452b9ded
Document user class properties
2014-10-01 10:33:36 -07:00
Ritchie Martori
712478a50c
Add Model.disableRemoteMethod()
2014-09-29 13:05:31 -07:00
Miroslav Bajtoš
aac230679f
Merge pull request #555 from strongloop/feature/include-remote-method-aliases
...
PersistedModel: add remote method aliases
2014-09-12 11:42:20 +02:00
Raymond Feng
28754519d4
Merge pull request #522 from clarkorz/feature/link-with-data
...
Support data field as body for link operation
2014-09-11 16:59:27 -07:00
Raymond Feng
1e41064a87
Merge pull request #529 from Coobaha/fix/user_include
...
user#login include server crash fix
2014-09-11 16:57:58 -07:00
Miroslav Bajtoš
06b65ccf7e
PersistedModel: add remote method aliases
...
Ensure all loopback 1.x method names are available in loopback 2.x too.
2014-09-10 17:35:02 +01:00
zxvv
4fdee0aa6d
Fix last commit, which misplaced an ACL.
...
Move the ACL inside "acls".
Signed-off-by: Carey Richard Murphey <rich@murphey.org>
2014-09-07 11:26:10 -05:00
zxvv
5255120a22
Add an ACL to User, to allow everyone to execute User.passwordReset().
...
This is intended to permit users who have forgotten their
password, and are thus unauthenticated, to request a reset.
Credit goes to John Murphy who proposed the ACL in Google Groups here:
https://groups.google.com/forum/#!searchin/loopbackjs/passwordReset$20ACL/loopbackjs/UPyhg7KS-9k/_M_9-YpUKmIJ
Signed-off-by: Carey Richard Murphey <rich@murphey.org>
2014-09-06 19:05:32 -05:00
Ritchie Martori
6a604de157
Merge pull request #510 from strongloop/fix/remoting-type-conversion
...
Fix coercion for remoting on vanilla models
2014-09-03 11:55:04 -07:00
Ritchie Martori
58e36514d6
Fix coercion for remoting on vanilla models
2014-09-03 11:33:20 -07:00
Raymond Feng
43dbfa288e
Merge pull request #469 from britztopher/mailconnector-transports-issue460
...
Mailconnector transports issue460
2014-09-03 08:50:03 -07:00
Alexander Ryzhikov
58538f02b7
user#login include server crash fix
...
Signed-off-by: Alexander Ryzhikov <coobaha@gmail.com>
2014-09-03 09:58:49 +04:00
Raymond Feng
9fb60174f9
Merge pull request #519 from fabien/fix/error-response
...
Fix embedsMany/findById to return proper 404 response
2014-09-02 22:42:40 -07:00
Rand McKinney
1af1ec2c43
Update model.js
...
Correct event docs per https://groups.google.com/forum/#!topic/loopbackjs/61qd--Xkowo :
- `deleted` event takes instance arg, not id.
- Add docs for `set` event
2014-09-02 11:11:36 -07:00
Clark Wang
4387957a45
Restrict: only hasManyThrough relation can have additional properties
...
Signed-off-by: Clark Wang <clark.wangs@gmail.com>
2014-09-01 13:55:53 +08:00
Clark Wang
0e6bba4ded
Restrict that only hasManyThrough can have additional properties
...
Signed-off-by: Clark Wang <clark.wangs@gmail.com>
2014-09-01 13:52:14 +08:00
Clark Wang
beea028d5f
Support data field as body for link operation
...
Signed-off-by: Clark Wang <clark.wangs@gmail.com>
2014-09-01 08:52:24 +08:00
Fabien Franzen
33f3ba4549
Fix embedsMany/findById to return proper 404 response
2014-08-30 16:54:14 +02:00
Raymond Feng
9b97014b52
Merge pull request #504 from fabien/feature/embeds-one-remoting
...
Enable remoting for embedsOne relation
2014-08-29 09:30:49 -07:00
Raymond Feng
e856f81d09
Merge pull request #503 from fabien/feature/scope-where
...
Allow 'where' argument for scoped count API
2014-08-29 09:30:38 -07:00
Miroslav Bajtoš
26b67ba757
registry: warn when dataSource is not specified
...
Modify `registry.configureModel()` to log a warning when `dataSource`
optiont is not specified at all.
Users should provide `dataSource: null` when the model is intentionally
not attached to any data-source.
2014-08-26 18:04:06 +02:00
Ritchie Martori
7dde6466e5
Only validate dataSource when defined ( Fixes #482 )
2014-08-26 17:49:15 +02:00
Jaka Hudoklin
19155242c1
Enable remoting for embedsOne relation
...
Signed-off-by: Jaka Hudoklin <jakahudoklin@gmail.com>
2014-08-26 15:25:45 +02:00
Fabien Franzen
fc0c96bdc2
Allow 'where' argument for scoped count API
...
Note that the return value will be non-rooted, which is actually what
the
non-scoped /count method returns as well - fixes inconsistency.
2014-08-26 14:41:36 +02:00
Fabien Franzen
6ccc5a62bf
Account for undefined before/afterListeners
2014-08-22 22:18:24 +02:00
Raymond Feng
c3a33df0ce
Make sure AccessToken extends from PersistedModel
2014-08-18 21:44:38 -07:00
Raymond Feng
e35bc9ed5f
Merge pull request #463 from offlinehacker/master
...
add count to relations and scopes
2014-08-15 13:18:51 -07:00
britztopher
ba48d042b8
added test and fixed changing passed in object within ctor
2014-08-14 15:44:36 -04:00
britztopher
d4bd2bca28
adding the ability to use single or multiple email transports in datasources.json file
2014-08-14 12:07:44 -04:00
britztopher
56fe548a46
added the ability to use an array of transports or just a single trnasport
2014-08-13 15:57:28 -04:00
Jaka Hudoklin
066e87300d
add count to relations and scopes
...
Signed-off-by: Jaka Hudoklin <jakahudoklin@gmail.com>
2014-08-12 15:03:15 +02:00
Miroslav Bajtoš
d93b6127c4
Remove `req.resume` from `app.enableAuth`
...
Remove `req.pause` and `req.resume` from `app.enableAuth`
- they are no longer needed, the request starts paused and there is
no other middleware that would resume it before us.
- when we resume the request after authentication, we force all
other async operations (like sharedCtor) to call pause & resume too,
otherwise data are lost
2014-08-12 13:57:45 +02:00
Ritchie Martori
1ed4e2b9d7
Fix accessToken property docs
2014-08-11 10:55:23 -07:00
Raymond Feng
1c61cedee7
Make sure scoped methods are remoted
...
See https://github.com/strongloop/loopback/issues/454 . It's regression in 2.x.
2014-08-08 15:55:47 -07:00
Raymond Feng
9fb0977433
Pass in remotingContext for ACL
...
See https://github.com/strongloop/loopback/issues/451
2014-08-07 22:19:27 -07:00
Raymond Feng
0e8a69015a
Fix reference to app
...
See https://github.com/strongloop/loopback/issues/452
2014-08-07 21:45:18 -07:00
Raymond Feng
b07aac7377
Merge pull request #449 from fabien/fix/polymorphic-belongs-to
...
Don't assume relation.modelTo in case of polymorphic belongsTo
2014-08-07 13:54:15 -07:00
Raymond Feng
a9e77e0e23
Merge pull request #435 from fabien/feature/deep-remoting
...
Implement Model.nestRemoting
2014-08-07 10:38:09 -07:00
Raymond Feng
ce88ce7733
Fix doc for the EXECUTE
2014-08-07 10:33:36 -07:00
Raymond Feng
0affc65c67
Merge pull request #427 from fabien/feature/relation-paths
...
Allow custom relation path (http) - enable hasOne remoting access
2014-08-07 10:32:13 -07:00
Fabien Franzen
1af95272fe
Don't assume relation.modelTo in case of polymorphic belongsTo
2014-08-07 15:39:07 +02:00
Steve Grosbois
7b94f7a139
Fix "callbacl" by "callback" in doc
2014-08-05 15:17:11 +02:00
Fabien Franzen
539702ab3d
Inherit hooks when nesting
...
Note that for now, the hook ctx.instance will be the root/entry object.
Added `mounted` event - should be useful in other ways too.
2014-08-05 12:14:39 +02:00
Fabien Franzen
18c647a9bb
Changed options.path to options.http.path
2014-08-05 09:10:43 +02:00
Fabien Franzen
cc0d376cc3
filterMethod can also be a direct callback
2014-08-04 19:08:43 +02:00
Fabien Franzen
097daf1deb
filterMethod option (fn) to filter nested remote methods
2014-08-04 19:02:30 +02:00
Fabien Franzen
9be8d11431
Implement Model.nestRemoting
...
Explicitly enable another level of nesting/accessing relations; limited
to a depth of 2 levels.
2014-08-04 18:27:50 +02:00
Raymond Feng
b66a36fd3c
Merge pull request #423 from strongloop/feature/add-remoting-for-exists
...
Feature/add remoting for exists
2014-08-04 08:44:16 -07:00
Fabien Franzen
66fe60e6ca
Allow custom relation path (http) - enable hasOne remoting access
2014-08-01 11:25:28 +02:00