Repository navigation
fixing use-strict issue with connectors after merge #2632 - #2977
Conversation
|
Can one of the admins verify this patch? To accept patch and trigger a build add comment ".ok\W+to\W+test." |
|
Can one of the admins verify this patch? |
3 similar comments
|
Can one of the admins verify this patch? |
|
Can one of the admins verify this patch? |
|
Can one of the admins verify this patch? |
2639ff0 to
b1eb96f
Compare
| } | ||
| } | ||
| if (!config.connector.name) | ||
| if (typeof config.connector !== 'string' && !config.connector.name) |
There was a problem hiding this comment.
I was also thinking of using:
if (!config.connector)
^ Did you try that?
There was a problem hiding this comment.
hey @loay ,
if (!config.connector) won't work alone, as config.connector is indeed initialized to, say, mongodb, or mysql, etc. if datasources.json is correctly set up.
But still I can tinker by adding turning the test this way:
if (config.connector && typeof config.connector.name === 'object')
of course comparing object type is not 100% safe (arrays, dates, null which is already checked here), but i think it's robust enough given the surrounding code
loay
left a comment
There was a problem hiding this comment.
fixing use-strict issue with connectors after merge: First line should be 50 characters or less (saw 57)
Can you please reduce this to 50 char?
Then rebase please. Thanks.
b1eb96f to
2c1ebdc
Compare
|
Can one of the admins verify this patch? To accept patch and trigger a build add comment ".ok\W+to\W+test." |
|
Can one of the admins verify this patch? |
3 similar comments
|
Can one of the admins verify this patch? |
|
Can one of the admins verify this patch? |
|
Can one of the admins verify this patch? |
|
@loay testing But still I can tinker by adding turning the test this way: of course comparing object type is not 100% safe (arrays, dates, null which is already checked here), but i think it's robust enough given the surrounding code i also rebased |
|
Hey @ebarault, thanks for rebasing.
|
|
@slnode test please |
b8119a6 to
33a5ad6
Compare
|
@loay : just rebased. please go on |
|
@ebarault Thanks. |
|
@slnode test please |
33a5ad6 to
d239476
Compare
|
Thank you for the pull request, @ebarault. I have reworded the commit message to make it more descriptive and |
|
@slnode test please |
51e8024 to
5611f60
Compare
In strict mode, creating properties on strings is not allowed.
As a result, creating a new datasource fails with the following
error:
TypeError: Cannot create data source "db":
Cannot create property 'name' on string 'mongodb'
In this commit, we fix the code to assign the connector name only
if the connector is an object (not a string).
Add "returnOnlyRoleNames" option to Role.getRoles
Currently the return type of Role.getRoles() method is inconsistent:
role names are returned for smart roles and role ids are returned for
static roles (configured through user-role mapping).
This commit adds a new option to Role.getRoles() allowing the caller
to request role names to be returned for all types of roles.
8b23a34 to
94c786f
Compare
|
@slnode test please |
|
Thanks @ebarault for your contribution. Merged |
Description
adding
'use strict'in lib/application.js on recent code style review broke the support for db connectors here : https://github.com/strongloop/loopback/blob/master/lib/application.js#L427This PR solves this issue by looking at config.connector type before trying to assign config.connector.name property
All tests pass. No need for new tests
Related issues
#2632 (comment)
#2978
Checklist
guide