Commit Graph

632 Commits

Author SHA1 Message Date
Miroslav Bajtoš 692c67384a Merge pull request #2288 from strongloop/support-node-v6-in-2.x
Support node v6 in 2.x
2016-05-04 09:16:46 +02:00
Ryan Graham 4d6f2e7ab7
update/insert copyright notices 2016-05-03 17:10:46 -07:00
Miroslav Bajtoš da2fb0ae15 app: send port:0 instead of port:undefined
Node v6 no longer supports port:undefined, this commit is fixing
app.listen() to correctly send port:0 when no port is specified.
2016-05-03 19:00:01 +02:00
Supasate Choochaisri 2498c02f31 Add new feature to emit a `remoteMethodDisabled` event when disabling a remote method.
Signed-off-by: Supasate Choochaisri <supasate.c@gmail.com>
2016-04-29 16:29:50 -07:00
Tim Needham 1ea1cd612a Fix typo in Model.nestRemoting
Prevent apps from crashing when using `Model.nestRemoting` without
`{ hooks: false }` option.

Note that it is not possible to reproduce this bug using our current
Mocha test suite, because other tests modify the global state in such
way that the bug no longer occurs.

[back-port of #2245]
2016-04-20 09:35:10 +02:00
Miroslav Bajtoš 50e3578992 Improve error message on connector init error
[back-port of pull request #2105]
2016-03-02 13:19:20 +01:00
Sam Roberts a4c643e890 application: correct spelling of "cannont"
[back-port of pull request #2088]
2016-02-19 13:12:51 +01:00
Miroslav Bajtoš 015e9cb80e Correct JSDoc findOrCreate() callback in PersistedModel
Update PersistedModel.findOrCreate() JSDoc to reflect the
callback accepts an additional created boolean parameter.

This is a back-port of pull request #1983 from noderat/patch-1
2016-02-04 16:27:08 +01:00
Amir Jafarian 8deec2e89a Checkpoint speedup 2016-01-19 10:28:53 -05:00
crandmck 5974c6afdf Pull in API doc fix from PR into master #1910 2016-01-08 17:10:44 -08:00
Amir Jafarian 4aac2776a8 Fix bulkUpdate to not trigger rectifyAll
Fix `getIdFromWhereByModelId()` to correctly detect the situation
when "bulkUpdate" performs a write operation using a where filter
containing both id attribute but also all other model attributes.

This should significantly improve the performance of change replication,
because the cost of running rectifyAll is very high.
2015-12-22 10:44:28 +01:00
Miroslav Bajtoš 5e4bf1dd25 PersistedModel: log rectify/rectifyAll triggers
Add debug logging to identify what operations trigger rectify and
rectifyAll calls.
2015-12-17 14:13:47 +01:00
Rand McKinney 17abd8ac76 Update model.js
*Add doc comments for nestRemoting
*change cb to filterCallback in nestRemoting
2015-12-04 19:24:03 -05:00
Richard Pringle 03c8d044ad Fix typo in description of persistedModel.updateAttributes() 2015-11-11 16:54:21 -05:00
Miroslav Bajtoš 36cd5a7a78 lib/registry: fix findModel for model ctor
Fix `registry.findModel(arg)` to support the case when `arg` is already
a model constructor.
2015-11-09 16:01:43 +01:00
Rand McKinney 32085475ed Fix typo in doc comment 2015-10-21 13:47:36 -07:00
Simon Ho 26af1472e7 Check configs for shared method settings 2015-09-28 16:27:48 -07:00
Miroslav Bajtoš c87bf9a1da Merge pull request #1681 from strongloop/fix/replication-perf-on-save
Fix perf of rectification after updateAttributes
2015-09-18 17:05:14 +02:00
Miroslav Bajtoš 89326c7630 Fix perf of rectification after updateAttributes
Improve the id-detection algorithm in the "after save" hook
to correctly handle "updateAttributes" as a single-model change
and DO NOT trigger full "rectify all" scan.
2015-09-17 19:23:00 +02:00
Rand McKinney 8d02e42cf3 Update persisted-model.js
Remove trailing whitespace.
2015-09-09 16:08:20 -07:00
Rand McKinney 3821824c97 Update persisted-model.js
Fix links in API docs to docs for where filter
2015-09-09 15:46:53 -07:00
Richard Walker 65ca318392 Create stack-removing errorhandler middleware
Create a wrapper around express' errorhandler that removes the stack
trace from error responses when "options.includeStack" is false.
2015-09-03 08:38:24 +02:00
Miroslav Bajtoš bab1d5dae8 Merge pull request #1632 from gausie/patch-2
Allow EJS templates to use includes
2015-08-31 18:15:16 +02:00
Samuel Gaus ecc98fd29c Allow EJS templates to use includes
Simple change that allows templates to use includes.
2015-08-27 16:37:04 +01:00
Christoph c2eb8e754d fix typo "PeristedModel" 2015-08-14 01:49:27 +02:00
Pradnya Baviskar 64a1dbadc8 Promisify 'PersistedModel - replication' 2015-08-12 09:22:53 +02:00
Raymond Feng c44a19dc73 Allow methods filter for middleware config 2015-08-05 10:30:57 -07:00
Miroslav Bajtoš 98784e2b4b Don't load Bluebird for createPromiseCallback
The decision which Promise implementation to use should be made by
LoopBack user, not by the framework.

This commit moves Bluebird reference from lib/utils.js to
test/support.js.
2015-08-04 11:04:12 +02:00
Miroslav Bajtoš aa5c9e3628 Merge pull request #1493 from PradnyaBaviskar/issue418-userModel
Promisify User model
2015-08-04 10:32:44 +02:00
Raymond Feng 0f9dd93aba Fix jsdocs for methods with where argument 2015-07-28 08:29:43 -07:00
Pradnya Baviskar dc987a59a9 Promisify User model 2015-07-14 13:01:46 +05:30
Ritchie Martori 9422175510 Add link to createChangeStream docs 2015-07-13 09:40:22 -07:00
Ritchie Martori cdddb08a67 Merge pull request #1445 from strongloop/feature/subscribe
Add PersistedModel.subscribe()
2015-07-09 13:35:49 -07:00
Ritchie Martori 40c5707a36 Add PersistedModel.createChangeStream() 2015-07-09 13:34:01 -07:00
Ritchie Martori 503eb948b7 Remove trailing whitespace from jsdoc 2015-07-08 16:53:51 -07:00
Rand McKinney ae7c12552a Update model.js
Updated JSdoc for remoteMethod
2015-07-07 11:01:50 -07:00
Miroslav Bajtoš 3115e5055f Auto-configure models required by `app.enableAuth`
Modify `app.enableAuth` to automaticaly setup all required models
that are not attached to the app nor a datasource.

Users wishing to use this option must provide the name of the
data-source to use for these models.

Example usage:

    var app = loopback();
    app.dataSource('db', { connector: 'memory' });
    app.enableAuth({ dataSource: 'db' });

    app.use(loopback.rest());
    app.listen(3000);
2015-06-01 12:19:28 +02:00
Miroslav Bajtoš 0ccc1e2b73 Add loadBuiltinModels flag to loopback(options)
When creating an application with a local registry, the default
behaviour is to define only two core models Model & PersistedModel.

The new flag `loadBuiltinModels` modifies this behaviour and instructs
loopback to define all builtin models in the local registry too.
2015-06-01 12:19:28 +02:00
Raymond Feng 77bcc09107 Merge branch 'master' of https://github.com/esco/loopback into esco-master 2015-05-29 16:44:18 -07:00
Ritchie Martori 805e0e0c1c Merge pull request #1370 from strongloop/fix/check-access-ordering
Use the new remoting.authorization hook for check access
2015-05-12 16:06:47 -07:00
Ritchie Martori 9cde2a45be Use the new remoting.authorization hook for check access 2015-05-12 15:33:05 -07:00
Miroslav Bajtoš f93b69ed0a Define remote methods via model settings/config
Process `settings.methods` and `config.methods` as a key-value map
where the key is the method name and the value is an object describing
the method in the format expected by strong-remoting.

Example: a static method `Model.create`

    "methods": {
      "create": {
        "isStatic": true,
        "accepts": {
           "arg": "data", "type": "Car",
           "http": { "source": "body" }
        },
        "returns": { "arg": "data", "type": "Car", "root": true }
      }
    }

This patch is based on the code proposed by @mrfelton in #1163.
2015-05-07 07:42:08 +02:00
Rand McKinney ce26141d85 un-document _findLayerByHandler 2015-05-04 12:23:21 -07:00
Miroslav Bajtoš cad616ed22 Remove trailing whitespace added by 242bcec 2015-05-04 18:19:13 +02:00
Rand McKinney 242bcec539 Update model.js
Add `extend()` method to API docs.
2015-04-28 10:06:14 -07:00
Miroslav Bajtoš b6b76d538c Fix regression in Model.getApp()
This patch fixes the method Model.getApp() that started to report
the following error after b61fae5 was landed:

assert.js:88
  throw new assert.AssertionError({
        ^
AssertionError: undefined == true
    at loopback/loopback/lib/model.js:392:7
    at EventEmitter.<anonymous> (loopback/loopback/lib/model.js:222:9)
    at EventEmitter.g (events.js:257:16)
    at emitOne (events.js:77:13)
    at EventEmitter.emit (events.js:166:7)
    at EventEmitter.app.model (loopback/loopback/lib/application.js:157:9)
2015-04-28 12:49:57 +02:00
Raymond Feng f798882e9a Allow dataSource === false 2015-04-24 08:32:17 -07:00
Miroslav Bajtoš f130b7aa01 Rework global registry to be per-module-instance
Fix a regression introduced by b917075 where two loopback projects,
each one using a different instance of loopback module, were
sharing the global registry and thus not working correctly.

The issue was discovered by unit-tests in loopback-workspace.
2015-04-17 19:26:05 +02:00
Miroslav Bajtoš 4d0a824757 Add back loopback properties like modelBuilder
The commit b917075 accidentally removed a couple of properties,
this commit is bringing them back:

 - loopback.modelRegistry
 - loopback.defaultDataSources

A unit-test was added to prevent this kind of regressions in the future.
2015-04-17 18:05:25 +02:00
Raymond Feng 3dcde7994b Merge pull request #1306 from strongloop/feature/allow-filter-on-findById
Expose the `filter` argument for findById
2015-04-16 15:12:50 -07:00