Commit Graph

850 Commits

Author SHA1 Message Date
Miroslav Bajtoš 9767b88e03 Merge pull request #363 from strongloop/feature/add-test-for-model-remote-methods
test: add check of Model remote methods
2014-07-03 08:50:07 +02:00
Miroslav Bajtoš f0cc5f7534 test: add check of Model remote methods
The test ensures that Model has all methods listed in docs:

http://docs.strongloop.com/display/LB/Exposing+models+over+a+REST+API

See also #359.
2014-07-03 08:19:41 +02:00
Raymond Feng d8c3376417 Merge pull request #361 from strongloop/feature/fix-issue-333
Fix the typo and add Bearer token support
2014-07-02 11:18:02 -07:00
Raymond Feng 217c9fa348 Fix the typo and add Bearer token support
See https://github.com/strongloop/loopback/issues/333
2014-07-02 09:02:13 -07:00
Raymond Feng 88a668cfe5 Update README 2014-07-01 10:14:39 -07:00
Raymond Feng 94892288b8 Merge pull request #358 from tsertkov/docs/token
Fix misleading token middleware documentation
2014-07-01 08:18:28 -07:00
Aleksandr Tsertkov 476dd8214d Fix misleading token middleware documentation
Signed-off-by: Aleksandr Tsertkov <tsertkov@gmail.com>
2014-07-01 16:59:49 +02:00
Miroslav Bajtoš 6a8a918166 Merge pull request #357 from strongloop/feature/set-url-on-app-listening
app: update `url` on `listening` event
2014-07-01 16:17:26 +02:00
Miroslav Bajtoš dfa8d7f49f app: update `url` on `listening` event
Most applications report the URL when started (at least the apps we
are scaffolding using loopback-workspace). Constructing the URL in the
loopback core allows us to simplify the templates and reduce the amount
of repeated code.
2014-07-01 14:27:02 +02:00
Miroslav Bajtoš 1d0ece01e7 Merge tag 'v1.9.1'
v1.9.1
2014-06-27 10:26:23 +02:00
Miroslav Bajtoš 7e670c85c9 Merge branch 'release/1.9.1' into production 2014-06-27 10:26:15 +02:00
Miroslav Bajtoš 57060ec4c1 v1.9.1 2014-06-27 10:25:47 +02:00
Miroslav Bajtoš 45d026e7de Merge pull request #335 from karlmikko/bug/invalid-token-unhandled
Ignore unhanded error - simulate token missing
2014-06-27 09:56:17 +02:00
Miroslav Bajtoš a976481adb Merge pull request #351 from globocom/fix/registry-memory
Fix ReferenceError: loopback is not defined in registry.memory().
2014-06-26 15:43:16 +02:00
Guilherme Cirne 3fba6c50f0 Fix "ReferenceError: loopback is not defined" in registry.memory().
Signed-off-by: Guilherme Cirne <gcirne@gmail.com>
2014-06-26 10:40:28 -03:00
Karl Mikkelsen 46af483bdd Invalid Access Token return 401
Clean up logic to be easier to read.
Signed-off-by: Karl Mikkelsen <karl@karlmikko.com>
2014-06-26 08:50:41 +10:00
Raymond Feng e148bb0e30 Merge tag 'v1.9.0'
1.9.0
2014-06-25 09:35:53 -07:00
Raymond Feng 78869baa10 Merge branch 'release/1.9.0' into production 2014-06-25 09:35:46 -07:00
Raymond Feng c20ecaf265 Bump version and update deps 2014-06-25 09:09:14 -07:00
Raymond Feng 70c1cb5ce0 Update debug setting 2014-06-25 09:09:04 -07:00
Miroslav Bajtoš 1dc3fba786 Merge pull request #348 from strongloop/feature/deprecate-app-boot
Mark `app.boot` as deprecated.
2014-06-25 17:27:07 +02:00
Miroslav Bajtoš 70615696cd Mark `app.boot` as deprecated. 2014-06-25 13:44:07 +02:00
Rand McKinney bca9722196 Update link to doc 2014-06-24 16:14:01 -07:00
Raymond Feng ebe65656e5 Merge pull request #342 from strongloop/feature/refactor-relation
Upgrade to loopback-datasource-juggler 1.6
2014-06-20 23:05:34 -07:00
Raymond Feng 0d0a8658e5 Update juggler dep 2014-06-20 21:25:27 -07:00
Raymond Feng 9b5d7417a2 Remove relationNameFor 2014-06-20 21:25:27 -07:00
Raymond Feng 3672c59410 Merge pull request #341 from STRML/fixAccessTokenMutatedOptions
Fix a slowdown caused by mutation of an incoming accessToken option.
2014-06-20 17:36:57 -07:00
Samuel Reed afd8de0c31 Fix a slowdown caused by mutation of an incoming accessToken option. 2014-06-20 16:39:28 -05:00
Raymond Feng d5ed57e60d Merge pull request #254 from strongloop/feature/role-id
Set the role id to be generated
2014-06-17 10:37:06 -07:00
Miroslav Bajtoš f20236c715 package: the next version will be a minor version 2014-06-16 21:01:31 +02:00
Miroslav Bajtoš 7dc2521c07 Merge pull request #330 from strongloop/feature/fix-forgotten-loopback-reference-in-app
lib/application: Remove forgotten `loopback` ref
2014-06-16 10:17:39 +02:00
Miroslav Bajtoš 843e09342c lib/application: Remove forgotten `loopback` ref
Use `registry.Model` instead of `loopback.Model`.
2014-06-16 09:52:11 +02:00
Miroslav Bajtoš 8826b6396a Merge pull request #306 from karlmikko/master
Ability to return 401 and 403 response codes #301
2014-06-14 09:44:22 +02:00
Karl Mikkelsen a90a5c7e58 Allow customization of ACL http status
emulate existing error on 404
new tests for model and app settings
Signed-off-by: Karl Mikkelsen <karl@karlmikko.com>
2014-06-14 11:31:15 +10:00
Miroslav Bajtoš 5c3cdd498c Merge pull request #329 from strongloop/feature/expose-loopback-via-app
Expose loopback as `app.loopback`
2014-06-13 21:48:02 +02:00
Miroslav Bajtoš c4db83ad43 Expose loopback as `app.loopback`
The primary intention is to allow loopback plugins to determine
the version of the loopback framework from the `app` object.
2014-06-13 10:34:51 +02:00
Miroslav Bajtoš 828aec9481 Merge pull request #321 from strongloop/feature/backport-model-from-config
Backport from 2.0: create model from config, configure model
2014-06-12 18:54:45 +02:00
Miroslav Bajtoš 02d1c5e3c2 registry: export DataSource class
Expose the juggler's DataSource constructor as `loopback.DataSource`.

The DataSource constructor is most useful to check
for `instanceof DataSource`, but it also makes the loopback API more
consistent, since the API is already exposing all pre-built Models.
2014-06-12 10:41:45 +02:00
Miroslav Bajtoš f05291ca93 registry: fix non-unique default dataSources
Fix the problem where `registry.defaultDataSources` has two instances:

 - `require('loopback').defaultDataSources` used by
   `loopback.autoAttach()`

 - `require('./registry').defaultDataSources` used by
   `app.dataSource`.

I am intentionally leaving out unit-tests as the whole `autoAttach`
feature is going to be deleted before 2.0 is released.
2014-06-12 10:41:45 +02:00
Miroslav Bajtoš 362cceb70a Merge createModelFromConfig with createModel
Merge the two methods `loopback.createModel` and
`loopback.createModelFromConfig` into a single method `createModel`.
2014-06-12 10:41:45 +02:00
Miroslav Bajtoš 7cd6e09790 lib/registry fix jsdoc comments
Add missing names.
2014-06-12 10:41:44 +02:00
Miroslav Bajtoš f0ff40d3f7 test: add debug logs
Add debug logs to troubleshoot two unit tests failing
on the CI server only.
2014-06-12 10:41:44 +02:00
Miroslav Bajtoš 7d674779e1 refactor: extract runtime and registry
Move isBrowser and isServer from lib/loopback to a new file lib/runtime.

Move all Model and DataSource related methods like `createModel` and
`createDataSource` to lib/registry.

Remove the circular dependency between lib/application and lib/loopback,
by loading lib/registry and/or lib/runtime instead of lib/loopback
where appropriate

This commit is only moving the code around, the functionality should
not be changed at all.
2014-06-12 10:41:44 +02:00
Miroslav Bajtoš 19425b8fd9 Remove assertIsModel and isDataSource
Use `instanceof` operator instead:

  ModelCtor.prototype instanceof loopback.Model
  dataSource instanceof loopback.DataSource
2014-06-12 10:41:44 +02:00
Miroslav Bajtoš fc0fad4a9f Add createModelFromConfig and configureModel()
Add new API allowing developers to split the model definition and
configuration into two steps:

 1. Build models from JSON config, export them for re-use:

  ```js
  var Customer = loopback.createModelFromConfig({
    name: 'Customer',
    base: 'User',
    properties: {
      address: 'string'
    }
  });
  ```

 2. Attach existing models to a dataSource and a loopback app,
    modify certain model aspects like relations:

  ```js
  loopback.configureModel(Customer, {
    dataSource: db,
    relations: { /* ... */ }
  });
  ```

Rework `app.model` to use `loopback.configureModel` under the hood.
Here is the new usage:

```js
var Customer = require('./models').Customer;

app.model(Customer, {
  dataSource: 'db',
  relations: { /* ... */ }
});
```

In order to preserve backwards compatibility,
`app.model(name, config)` calls both `createModelFromConfig`
and `configureModel`.
2014-06-12 10:41:44 +02:00
Miroslav Bajtoš b5f0057ea4 Merge pull request #322 from strongloop/feature/backport-app-settings-in-browser
Make app.get/app.set available in browser
2014-06-12 10:40:49 +02:00
Miroslav Bajtoš 4259a3862a Make app.get/app.set available in browser
Implement settings object and methods in browser-express.
2014-06-12 10:40:36 +02:00
Miroslav Bajtoš ee1dfc8e4f Merge pull request #317 from strongloop/feature/improve-access-checks
Improve access checks tests
2014-06-12 10:39:09 +02:00
Miroslav Bajtoš e7884dce50 package: upgrade Mocha to 1.20 2014-06-12 10:33:56 +02:00
Miroslav Bajtoš 3deadcd180 test: fix ACL integration tests
Change the tests creating new users so that they send valid user data,
in order to prevent 422 "validation failed" responses.

Upgrade loopback-testing to 0.2.0.
2014-06-12 10:33:40 +02:00