Commit Graph

1616 Commits

Author SHA1 Message Date
Miroslav Bajtoš 3f0fc094d5 Merge pull request #308 from strongloop/feature/cleanup-after-pr-304
[2.0] cleanup after pr 304
2014-06-10 08:07:20 +02:00
Raymond Feng e7b1743185 Merge pull request #319 from strongloop/feature/fix-app-model
Register existing model to app.models during app.model()
2014-06-09 16:34:29 -07:00
Raymond Feng 815ad53aa4 Register existing model to app.models during app.model() 2014-06-09 16:31:33 -07:00
crandmck 6af69e322a JSDoc cleanup 2014-06-09 15:50:04 -07:00
crandmck cea2d30928 Merge branch 'master' of github.com:strongloop/loopback 2014-06-09 15:42:07 -07:00
crandmck 1694ee2d83 JSDoc cleanup 2014-06-09 15:36:08 -07:00
Raymond Feng 439aa883ec Bump version so that we can republish 2014-06-09 15:14:28 -07:00
Raymond Feng 9a31995c0f Merge tag 'v1.8.6'
1.8.6
2014-06-09 15:04:35 -07:00
Raymond Feng 093f3ed412 Merge branch 'release/1.8.6' into production 2014-06-09 15:04:19 -07:00
Raymond Feng 0595a76a93 Bump version 2014-06-09 15:02:40 -07:00
Raymond Feng 854402acba Merge pull request #314 from strongloop/feature/allow-custom-token-creation
Allow the creation of access token to be overriden
2014-06-09 15:01:15 -07:00
Raymond Feng a6ff4b0cad Use constructor to reference the model class 2014-06-09 15:00:15 -07:00
Raymond Feng 6b4ebdf609 Allow the creation of access token to be overriden 2014-06-09 14:53:55 -07:00
Miroslav Bajtoš a90e24c013 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-09 16:25:35 +02:00
Miroslav Bajtoš 09cc57c061 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-09 16:15:56 +02:00
Miroslav Bajtoš 56aab8dbdd Merge createModelFromConfig with createModel
Merge the two methods `loopback.createModel` and
`loopback.createModelFromConfig` into a single method `createModel`.
2014-06-09 11:18:52 +02:00
Miroslav Bajtoš 63843b41fc lib/registry fix jsdoc comments
Add missing names.
2014-06-09 07:46:32 +02:00
crandmck 1316676946 Fixup JSDocs; note: updateOrCreate function alias pulled out on separate line for docs 2014-06-06 17:17:37 -07:00
Miroslav Bajtoš 1de6325a80 test: add debug logs
Add debug logs to troubleshoot two unit tests failing
on the CI server only.
2014-06-06 14:51:43 +02:00
Miroslav Bajtoš eac231df99 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-06 11:53:23 +02:00
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
crandmck 35cf6753de Added middleware and API doc headings 2014-06-04 17:43:11 -07:00
crandmck d8c6f9d962 Update JSDoc 2014-06-04 17:42:18 -07:00
Rand McKinney c58ec57f39 Update docs.json
Removed access-context.js
2014-06-04 16:33:03 -07:00
Rand McKinney a953d10679 Removed old .md files from API docs
This content is now provided elsewhere.
2014-06-03 17:31:36 -07:00
Rand McKinney 6300887e2e Delete api-model.md
Most of this information is provided in JSDoc.  The remainder is in http://docs.strongloop.com/display/DOC/Model and will be moved to other articles ASAP.
2014-06-03 17:14:02 -07:00
Rand McKinney 6cfa5d0d7c Delete api-datasource.md
This is now covered in JSDoc.
2014-06-03 17:07:34 -07:00
Rand McKinney ab69ef5f6c Delete api-geopoint.md
This is now provided via JSDoc.
2014-06-03 16:57:59 -07:00
Ritchie Martori 0414d040ee 1.8.6 2014-06-03 15:40:16 -07:00
Ritchie Martori fe479804fe Merge pull request #298 from strongloop/fix/aliased-shared-methods
Fix/aliased shared methods
2014-06-03 15:39:29 -07:00
Rand McKinney 1d1de23203 Remove duplicate doc content
Duplicates http://docs.strongloop.com/display/DOC/Remote+methods+and+hooks.
Some of this belongs in JSDoc ultimately.
2014-06-03 15:34:28 -07:00
Rand McKinney 61fc2d7158 Add note about unavailable args to remote hooks. 2014-06-03 15:22:08 -07:00
Rand McKinney 78d1e3b966 Undo incorrect changes I made -- per Ritchie 2014-06-03 15:14:46 -07:00
Ritchie Martori ce6a85ee58 Update strong-remoting to 1.5 2014-06-03 14:54:27 -07:00
Rand McKinney 87c9672362 Remove "user" as arg to beforeRemote(..) 2014-06-03 13:47:29 -07: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
Ritchie Martori fea1cee1c4 !fixup only set ctx.accessType when sharedMethod is available 2014-06-02 14:41:08 -07:00
Ritchie Martori a2f931ed3f Refactor ACL to allow for `methodNames` / aliases 2014-06-02 14:41:08 -07: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 2fd3c834e6 Update README and the module diagram 2014-05-30 17:22:31 -07: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