Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 20 additions & 10 deletions lib/remote-objects.js
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,8 @@ function searchListenerTree(handlers, type, tree, i) {
for (branch in tree) {
if (branch !== '_listeners' && tree.hasOwnProperty(branch)) {
listeners = listeners.concat(
searchListenerTree(handlers, type, tree[branch], i + 1));
searchListenerTree(handlers, type, tree[branch], i + 1)
);
}
}
return listeners;
Expand All @@ -583,33 +584,39 @@ function searchListenerTree(handlers, type, tree, i) {
if (endReached && tree._listeners) {
// The next element has a _listeners, add it to the handlers.
listeners = listeners.concat(
searchListenerTree(handlers, type, tree, typeLength));
searchListenerTree(handlers, type, tree, typeLength)
);
}

for (branch in tree) {
if (branch !== '_listeners' && tree.hasOwnProperty(branch)) {
if (branch === '*' || branch === '**') {
if (tree[branch]._listeners && !endReached) {
listeners = listeners.concat(
searchListenerTree(handlers, type, tree[branch], typeLength));
searchListenerTree(handlers, type, tree[branch], typeLength)
);
}
listeners = listeners.concat(
searchListenerTree(handlers, type, tree[branch], i));
searchListenerTree(handlers, type, tree[branch], i)
);
} else if (branch === nextType) {
listeners = listeners.concat(
searchListenerTree(handlers, type, tree[branch], i + 2));
searchListenerTree(handlers, type, tree[branch], i + 2)
);
} else {
// No match on this one, shift into the tree but not in the type array.
listeners = listeners.concat(
searchListenerTree(handlers, type, tree[branch], i));
searchListenerTree(handlers, type, tree[branch], i)
);
}
}
}
return listeners;
}

listeners = listeners.concat(
searchListenerTree(handlers, type, tree[currentType], i + 1));
searchListenerTree(handlers, type, tree[currentType], i + 1)
);
}

xTree = tree['*'];
Expand Down Expand Up @@ -805,7 +812,8 @@ RemoteObjects.prototype.defineType = function(name, converter) {
'%s is no longer supported. Use one of the new APIs instead: %s or %s',
'remoteObjects.defineType(name, fn)',
'remoteObjects.defineObjectType(name, factoryFn)',
'remoteObjects.defineType(name, converter)'));
'remoteObjects.defineType(name, converter)'
));
}
this._typeRegistry.defineType(name, converter);
};
Expand Down Expand Up @@ -849,11 +857,13 @@ RemoteObjects.convert =
RemoteObjects.prototype.convert = function(name, fn) {
throw new Error(g.f(
'RemoteObjects.convert(name, fn) is no longer supported. ' +
'Use remoteObjects.defineType(name, converter) instead.'));
'Use remoteObjects.defineType(name, converter) instead.'
));
};

RemoteObjects.defineType = function(name, fn) {
throw new Error(g.f(
'RemoteObjects.defineType(name, fn) is no longer supported. ' +
'Use remoteObjects.defineType(name, converter) instead.'));
'Use remoteObjects.defineType(name, converter) instead.'
));
};
3 changes: 2 additions & 1 deletion lib/rest-adapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,8 @@ RestAdapter.errorHandler = function(options) {
g.warn(
'{{strong-remoting}} no longer supports ' +
'"{{errorHandler.disableStackTrace}}" option. ' +
'Use the new option "{{errorHandler.debug}}" instead.');
'Use the new option "{{errorHandler.debug}}" instead.'
);
}

var strongErrorHandlerInstance = strongErrorHandler(options);
Expand Down
6 changes: 4 additions & 2 deletions lib/shared-method.js
Original file line number Diff line number Diff line change
Expand Up @@ -544,15 +544,17 @@ SharedMethod.toResult = function(returns, raw, ctx) {
message = g.f(
'Invalid return value for argument \'%s\' of type ' +
'\'%s\': %s. Received type was %s.',
argName, targetType, val, typeof val);
argName, targetType, val, typeof val
);
throw internalServerError(message);
}

if (!isSafeInteger(val)) {
message = g.f(
'Unsafe integer value returned for argument \'%s\' of type ' +
'\'%s\': %s.',
argName, targetType, val);
argName, targetType, val
);
throw internalServerError(message);
}
return val;
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@
"chai": "^4.1.2",
"coveralls": "^3.0.1",
"dirty-chai": "^2.0.1",
"eslint": "^4.13.1",
"eslint-config-loopback": "^10.0.0",
"eslint": "^5.4.0",
"eslint-config-loopback": "^11.0.0",
"eslint-plugin-mocha": "^5.0.0",
"event-stream": "^3.3.1",
"eventsource": "^1.0.5",
Expand Down
3 changes: 1 addition & 2 deletions test/authorize-hook.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ describe('authorization hook', function() {
// vvvvvvvv - local before hook
expect(callStack).to.eql(['before', 'authorization', 'before']);
done();
}
);
});
});
});

Expand Down
6 changes: 2 additions & 4 deletions test/rest.browser.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -276,8 +276,7 @@ describe('strong-remoting-rest', function() {
assert.equal(b, false);
done();
});
}
);
});

it('should reject empty string when string required',
function(done) {
Expand All @@ -300,8 +299,7 @@ describe('strong-remoting-rest', function() {
expect(err).to.be.an.instanceof(Error);
done();
});
}
);
});

it('should reject falsy required arguments of incorrect type', function(done) {
var method = givenSharedStaticMethod(
Expand Down
Loading