Skip to content
This repository was archived by the owner on Apr 11, 2023. It is now read-only.

Commit ddf9fd3

Browse files
committed
ADD: OData nested filter unit tests, FIX: arrow function in nested query params; FIX: nested map modelbinder config
1 parent 8d78362 commit ddf9fd3

File tree

4 files changed

+674
-12
lines changed

4 files changed

+674
-12
lines changed

src/Types/Expressions/EntityExpressions/CodeExpression.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ $C('$data.Expressions.CodeExpression', $data.Expressions.ExpressionNode, null, {
44
constructor: function (source, parameters) {
55
if (Container.resolveType(Container.getTypeName(source)) == $data.String &&
66
source.replace(/^[\s\xA0]+/, "").match("^function") != "function" &&
7-
source.replace(/^[\s\xA0]+/, "").match("=>") != "=>")
7+
!/^[^\.]*(=>)/.test(source.replace(/^[\s\xA0]+/, "")))
88
{
99
source = "function (it) { return " + source + "; }";
1010
}

src/Types/Queryable.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -776,7 +776,7 @@ $data.Class.define('$data.Queryable', null, null,
776776
/// </signature>
777777

778778
this._checkOperation('include');
779-
if(typeof selector === 'string' && (selector.length < 3 || selector.substr(0, 3) !== 'it.')){
779+
if(typeof selector === 'string' && (selector.length < 3 || selector.substr(0, 3) !== 'it.') && !/^[^\.]*(=>)/.test(selector)){
780780
selector = 'it.' + selector;
781781
}
782782
var expression = Container.createCodeExpression(selector, thisArg);

src/Types/StorageProviders/modelBinderConfigCompiler.js

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,18 +43,20 @@ $C('$data.modelBinder.FindProjectionVisitor', $data.Expressions.EntityExpression
4343

4444
for (var i = 0; i < args.length; i++) {
4545
var arg = args[i];
46-
if (arg && arg.value instanceof $data.Queryable) {
46+
47+
if (arg instanceof $data.Expressions.ConstantExpression && arg.value instanceof $data.Queryable) {
4748
var preparator = Container.createQueryExpressionCreator(arg.value.entityContext);
48-
var prep_expression = preparator.Visit(arg.value.expression);
49-
50-
var visitor = new $data.modelBinder.FindProjectionVisitor(this._inculdes);
51-
var visitorContext = { };
52-
var compiled = visitor.Visit(prep_expression, visitorContext);
49+
arg = preparator.Visit(arg.value.expression);
5350

54-
if(context && visitorContext.projectionExpression){
55-
context.hasIncludeProjectionExpression = true;
56-
context.includeProjectionExpression = visitorContext.projectionExpression;
57-
}
51+
}
52+
53+
var visitor = new $data.modelBinder.FindProjectionVisitor(this._inculdes);
54+
var visitorContext = { };
55+
var compiled = visitor.Visit(arg, visitorContext);
56+
57+
if(context && visitorContext.projectionExpression){
58+
context.hasIncludeProjectionExpression = true;
59+
context.includeProjectionExpression = visitorContext.projectionExpression;
5860
}
5961
}
6062
}

0 commit comments

Comments
 (0)