Commit Graph

829 Commits

Author SHA1 Message Date
Miroslav Bajtoš 1b11060991 Remove assertIsModel and isDataSource
Use `instanceof` operator instead:

  ModelCtor.prototype instanceof loopback.Model
  dataSource instanceof loopback.DataSource
2014-06-06 10:30:03 +02:00
Miroslav Bajtoš 51e977de9b lib/loopback: fix jsdoc comments
Use
     @property {Object} [properties]
instead of
     @property {Object=} properties
for optional properties.

Use `**example**` instead of `@example`, since strong-docs don't support
the latter.
2014-06-06 10:28:21 +02:00
Miroslav Bajtoš 5f1c3a86eb Merge pull request #304 from strongloop/feature/createModelFromConfig
[2.0] Add createModelFromConfig and configureModel()
2014-06-06 10:27:03 +02:00
Miroslav Bajtoš 71792b144c Merge pull request #302 from strongloop/rename-datamodel-to-persistedmodel
[2.0] Rename DataModel to PersistedModel
2014-06-05 20:36:08 +02:00
Miroslav Bajtoš f844459311 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 with loopback 1.x,
`app.model(name, config)` calls both `createModelFromConfig`
and `configureModel`.
2014-06-05 17:47:28 +02:00
Miroslav Bajtoš ea5b9d16fc Rename DataModel to PersistedModel 2014-06-05 09:56:00 +02:00
Miroslav Bajtoš 93a74f2821 Merge pull request #299 from strongloop/feature/implement-app-settings-in-browser
Feature/implement app settings in browser
2014-06-03 21:33:14 +02:00
Miroslav Bajtoš 26874fc715 Make app.get/app.set available in browser
Implement settings object and methods in browser-express.

Add test/app.test.js to unit-tests run by karma.
2014-06-03 21:32:27 +02:00
Miroslav Bajtoš 88a4bb462e Exclude express-middleware from browser bundle
Fix lib/loopback to include express-middleware only on the server.

Bump up strong-remoting dependency to use the version working in
browsers.
2014-06-03 21:32:27 +02:00
Raymond Feng 663e2d1903 Merge pull request #293 from strongloop/feature/express-4.x
Upgrade to Express 4.x
2014-06-02 08:26:35 -07:00
Miroslav Bajtoš 5b53da93db test: Remove forgotten call of `console.log()`
The `console.log()` call was added by 94ec5c2.
2014-06-02 08:34:08 +02:00
Raymond Feng c10305754f Clean up express middleware dependencies 2014-05-30 17:08:03 -07:00
Raymond Feng d6ae28cf87 Update strong-remoting dep 2014-05-29 21:35:57 -07:00
Raymond Feng bb0ddb26ec Rename express-wrapper to express-middleware 2014-05-29 10:18:58 -07:00
Raymond Feng 3c7cfcaca8 Clean up the tests 2014-05-29 10:18:14 -07:00
Raymond Feng 49380e490f Upgrade to Express 4.x 2014-05-29 08:44:05 -07:00
Miroslav Bajtoš 5aa8b369b4 Merge pull request #289 from strongloop/deprecate-boot-code
Deprecate app.boot, remove app.installMiddleware
2014-05-29 10:08:12 +02:00
Miroslav Bajtoš 566757ba1d Deprecate app.boot, remove app.installMiddleware
The bootloader has its own project `loopback-boot` now.
2014-05-29 08:38:39 +02:00
Miroslav Bajtoš ab0700a690 2.0.0-beta3 2014-05-28 18:45:29 +02:00
Miroslav Bajtoš 0bb69f888c package.json: fix malformed json
The formatting error was introduced by the previous merge commit.
2014-05-28 18:45:05 +02:00
Miroslav Bajtoš 18fd61a546 Merge branch 'master' into 2.0 2014-05-28 18:41:36 +02:00
Miroslav Bajtoš acf7af0c4e Merge pull request #287 from strongloop/feature/connector-registry
app: implement `connector()` and `connectors`
2014-05-28 17:01:24 +02:00
Miroslav Bajtoš 94ec5c294a app: implement `connector()` and `connectors`
Allow browserified applications to explicitly register connectors
to use in data-sources via `app.connector(name, exportsFromRequire)`.

Include built-in connectors like `Memory` and `Remote` in the registry.

Modify `dataSourcesFromConfig()` to resolve the connector via
`app.connectors` first and only then fall back to auto-require
the connector module.
2014-05-28 15:11:43 +02:00
Miroslav Bajtoš d0c87d3420 Merge pull request #285 from STRML/fixRestApiRootTypo
Fix a typo in `app.boot` caused by the change from restBasePath to restApiRoot.
2014-05-28 14:56:46 +02:00
Samuel Reed e625028486 Fix a typo in `app.boot`.
This typo was caused by the change from restBasePath to restApiRoot.

Signed-off-by: Samuel Reed <sam@tixelated.com>
2014-05-28 17:25:41 +08:00
Miroslav Bajtoš 7508337d56 Merge pull request #283 from strongloop/feature/single-datasource-registry-per-app-instance
Make app.datasources unique per app instance
2014-05-28 09:45:04 +02:00
Ritchie Martori 10bbfdcf25 2.0.0-beta2 2014-05-27 16:09:45 -07:00
Ritchie Martori 7005c4bdd0 2.0.0-beta1 2014-05-27 15:15:50 -07:00
Raymond Feng 411021269c Merge tag 'v1.8.5'
1.8.5
2014-05-27 11:00:03 -07:00
Raymond Feng 12f9695d13 Merge branch 'release/1.8.5' into production 2014-05-27 10:59:55 -07:00
Raymond Feng 5af3b2e9ae Bump version 2014-05-27 10:58:58 -07:00
Raymond Feng 815dbc94e6 Add postgresql to the keywords 2014-05-27 10:58:26 -07:00
altsang c952d4055a updated package.json with SOAP and framework keywords 2014-05-27 10:55:04 -07:00
Raymond Feng 80e5bf0ce6 updated package.json with keywords and updated description 2014-05-27 10:54:39 -07:00
Raymond Feng 1f40eef8d9 Merge tag 'v1.8.4'
1.8.4
2014-05-27 10:25:13 -07:00
Raymond Feng be0ca7e1ce Merge branch 'release/1.8.4' into production 2014-05-27 10:25:07 -07:00
Raymond Feng 68c79ba2df Add more keywords 2014-05-27 10:24:26 -07:00
Raymond Feng b971734791 Bump version 2014-05-27 10:22:27 -07:00
Miroslav Bajtoš 7cfe450161 Make app.datasources unique per app instance
This removes a source of confusion in unit-tests.
2014-05-27 14:33:42 +02:00
Miroslav Bajtoš 1154e3def8 Merge pull request #277 from strongloop/feature/flatten-models-json
app: flatten model config
2014-05-27 08:14:59 +02:00
Miroslav Bajtoš 227c2d05cd app: flatten model config
Support flat structure of model config objects, where model options
are set as top-level properties.

Before:

    Customer: {
      dataSource: 'db',
      options: {
        base: 'User'
      }
    }

Now:

    Customer: {
      dataSource: 'db',
      base: 'User'
    }
2014-05-27 08:10:20 +02:00
Raymond Feng 25250a03d1 Merge pull request #268 from strongloop/feature/update-deps
Feature/update deps
2014-05-26 21:53:45 -07:00
Raymond Feng ed0b568542 Fix the test for mocha 1.19.0
See 6c705cd4d4
2014-05-26 21:52:48 -07:00
Raymond Feng 0b315964d3 Update dependencies 2014-05-26 21:52:48 -07:00
Rand McKinney 1ebeca66f2 Added more keywords 2014-05-23 17:48:37 -07:00
Raymond Feng 1b79eff582 Update README and the module diagram 2014-05-23 13:34:50 -07:00
Rand McKinney bc8678a1ff added "REST API" keyword 2014-05-23 09:57:25 -07:00
Rand McKinney d26905506c added 'web' and 'framework' keywords 2014-05-23 09:56:27 -07:00
Rand McKinney f3001ef95e Make image URL absolute for npmjs.org. 2014-05-22 11:58:27 -07:00
Miroslav Bajtoš b00271e6e2 Merge pull request #271 from strongloop/fix/dep-syntax
Use common syntax for juggler dep
2014-05-22 08:30:56 +02:00