Commit Graph

82 Commits

Author SHA1 Message Date
Diana Lau f788aae464 chore: update copyright year 2020-01-21 14:19:18 -05:00
Sujesh T b93187b0f9 feat: change hasone relation error message
The current hasone error message is not appropriate one.
So adds a better message.
2019-12-02 23:28:02 +05:30
Nora aa76a19e33 chore: fix eslint violations
Fix comma-dangle violations.
2019-11-17 14:04:57 -05:00
Miroslav Bajtoš 397d141036
fixup! eslint --fix .
Signed-off-by: Miroslav Bajtoš <mbajtoss@gmail.com>
2019-10-07 11:54:59 +02:00
Raymond Feng f1c613ac07 Set juggler options for remote calls 2018-11-15 08:28:46 -08:00
Diana Lau 6b0a880efa remove unnecessary format call 2018-08-20 16:55:56 -04:00
Diana Lau 89ff760b6d Make desc when export-api-def translatable 2018-08-20 13:04:21 -04:00
virkt25 5ee731eafd chore: update deps + fix linting + .npmrc 2018-08-08 13:31:30 -04:00
Kevin Delisle 386615a1df model: fix infinite loop on nestRemoting
Prevent endless recursion on nestRemoting calls for
two-way model links.
2018-02-08 11:26:02 -05:00
Justin Ross 60750b4508
Update Copyright Years
Update copyright years to include 2018
2018-01-16 13:55:02 +01:00
Miroslav Bajtoš 7c030c6900
Merge pull request #3728 from strongloop/update-eslint-config
Update eslint and eslint-config to latest
2017-12-14 13:07:14 +01:00
bmatson 317e00d92c
Update nestRemoting to pass optionsFromContext
Fix the code invoking relation getter to correctly pass through
the "options" argument.
2017-12-12 17:24:35 +01:00
Miroslav Bajtoš 73cc950b1b
Update eslint and eslint-config to latest 2017-12-12 09:33:15 +01:00
Samuel Reed 0bac0a933f
fix(id): replace with != null
Ref: #2356, #2374, #3130, #3693
2017-12-05 09:54:28 -06:00
Raymond Feng 6570b94843 Fix createOnlyInstance for related methods
For scoped or related create method, the createOnlyInstance flag should
be calculated on the target model. For example, User.createAccessTokens
should set the flag only if AccessToken has updateonly properties.
2017-10-27 18:51:56 -07:00
Jürg Lehni 826ee2aca8 Handle missing getUpdateOnlyProperties fn
If the current scope does not define a getUpdateOnlyProperties
function, the updateOnlyProps value will now be set to false.
2017-10-09 09:19:47 +02:00
Raymond Feng c0a0f09f3a Allow declarative nestRemoting for relations
Now relation.options.nestRemoting can be set to true so that
nestRemoting will be set up automatically without explicitly
calling MyModel.nestRemoting
2017-09-27 09:22:06 -07:00
Rashmi Hunt 3651c09782 Support createOnlyInstance in model (#3548)
* setting up createOnlyInstance

* add comment

* fix eslint issue

* new tests

* Address code review comments
2017-08-22 17:10:55 -07:00
Farid Nouri Neshat 065eedab7b
Fix Model#settings.acls doc type signature 2017-06-23 16:25:54 +02:00
Candy 04983831ca Fix API doc for Model class property type 2017-06-14 14:38:55 -04:00
Piero Maltese 4735efa41f
Support remoting adapters with no ctx.req object
Fix `Model.createOptionsFromRemotingContext()` to correctly handle
the case where `ctx.req` is not defined, e.g. when using
websocket-based adapters.
2017-05-22 13:21:44 +02:00
Flavien DAVID 981bd309fc
Add new event "remoteMethodAdded"
Emit a new method "remoteMethodAdded" whenever a new method is added,
typically when `Model.remoteMethod` or `Model.nestRemoting` is called.

The method is emitted both by the Model affected and the application
object.
2017-03-31 15:32:19 +02:00
Miroslav Bajtoš 3e2ac9217f Warn about injectOptionsFromRemoteContext
The option injectOptionsFromRemoteContext was added to LoopBack 2.x only
and is not available in LoopBack 3.x (and newer).

When a model with this option is encountered, we are printing a warning
message now, to let the user know about this change between 2.x and 3.x.
2017-01-09 14:45:23 +01:00
Miroslav Bajtoš 0a6740cc30 Fix construction of sharedCtor remoting metadata
Prevent the situation when we are configuring remoting metadata after
strong-remoting has already picked up data from our parent (base) model.
2017-01-05 10:24:04 +01:00
Miroslav Bajtoš 60ea3e96bc Contextify DAO and relation methods
Modify remoting metadata of data-access methods in PersistedModel
and relation method in Model and add an "options" argument to "accepts"
list.
2016-12-22 10:26:09 +01:00
Miroslav Bajtoš 4de3aa77e3 Implement new http arg mapping optionsFromRequest
Define a new Model method "createOptionsFromRemotingContext" that allows
models to define what "options" should be passed to methods invoked
via strong-remoting (e.g. REST).

Define a new http mapping `http: 'optionsFromRequest'` that invokes
`Model.createOptionsFromRemotingContext` to build the value from
remoting context.

This should provide enough infrastructure for components and
applications to implement their own ways of building the "options"
object.
2016-12-22 10:26:01 +01:00
Miroslav Bajtoš acdfb432d0 Upgrade eslint config and grunt-eslint to latest
- disable ES6 because PhantomJS does not support it yet
 - fix linter errors reported after the upgrade.
2016-12-06 16:05:13 +01:00
David Cheung a673a3884c Merge pull request #2947 from strongloop/related-models-allow-array
add allowArray to relations' create remoteMethod
2016-11-23 14:51:08 -05:00
Candy 5815ca8211 Fix js doc for deleteAll event 2016-11-23 12:02:49 -05:00
David Cheung fa7cb923cd add allowArray to relations' create remoteMethod
this is needed because we added allowArray flag to persisted model's
remoteMethod, but when relations try to rebuild such methods, it does
not carry over such flags
2016-11-23 12:00:18 -05:00
Loay 06cb481c3f Update eslint to loopback config v5
Notable side-effects:
 - loopback no longer exports "caller" and "arguments" properties
 - kv-memory connector is now properly added to the connector registry
 - the file "test/support.js" was finally removed
2016-11-22 14:08:02 +01:00
Candy 8f08398c30 Update doc links 2016-11-04 16:47:12 -04:00
Tim van der Staaij c58bff6c3d Fix support for remote hooks returning a Promise
Fix beforeRemote/afterRemote to correctly return promises returned
by the user-provided hook callback.
2016-10-05 10:32:44 +02:00
Candy 640f3a8ca7 Update globalization structure 2016-09-22 11:58:00 +02:00
Richard Pringle 0ab33a82d4 Call new disable remote method from model class. 2016-09-21 14:09:24 -04:00
Miroslav Bajtoš 6e1defcb18 Use strong-remoting's new TypeRegistry 2016-09-09 10:01:29 +02:00
Miroslav Bajtoš f76edd5d61 Fix remoting metadata for "data" arguments
Fix the definition of "data" argument to

    { type: 'object', model: modelName, ... }

That way strong-remoting passed the request body directly to the model
method (does not create a new model instance), but the swagger will
still provide correct schema for these arguments.

This fixes a bug where upsert in relation methods was adding default
property values to request payload.
2016-09-07 14:27:58 +02:00
Amirali Jafarian a6f8ec672d Merge pull request #2539 from mountain1234585/upsertWithWhere
Add upsertWithWhere
2016-09-06 15:54:21 -04:00
Miroslav Bajtoš d13d2a7ab0 Remove one-var exceptions no longer needed 2016-09-06 15:47:35 +02:00
Sonali Samantaray aef6dca30c Expose upsertWithWhere method 2016-09-02 18:10:47 +05:30
Miroslav Bajtoš eec326dc80 Revert globalization of Swagger descriptions 2016-08-15 11:06:05 +02:00
Candy 3239942ff1 Update globalization 2016-08-04 17:35:21 -04:00
Candy b52a7217a9 Add globalization 2016-08-04 15:08:16 -04:00
Ryan Graham 6964914bab
update copyright statements 2016-05-03 15:50:21 -07:00
Supasate Choochaisri 0ca24389b2 Add new feature to emit a `remoteMethodDisabled` event when disabling a remote method.
Signed-off-by: Supasate Choochaisri <supasate.c@gmail.com>
2016-04-28 09:03:54 +07:00
Tim Needham 159aaf5afa 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.
2016-04-19 16:51:52 +02:00
Miroslav Bajtoš f9702b0ace Use eslint with loopback config
Drop jshint and jscs in favour of eslint.

Fix style violations.

While we are at this, reduce the max line length from 150 to 100.
2016-04-06 10:45:30 +02:00
Candy b5b900e0ff Remove constraint making isStatic required 2016-03-30 11:16:32 -04: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
Ritchie Martori 503eb948b7 Remove trailing whitespace from jsdoc 2015-07-08 16:53:51 -07:00