diff --git a/packages/sdk/src/convertQuerytoClause.ts b/packages/sdk/src/convertQuerytoClause.ts index 85cd5332..d1390155 100644 --- a/packages/sdk/src/convertQuerytoClause.ts +++ b/packages/sdk/src/convertQuerytoClause.ts @@ -313,6 +313,10 @@ function convertOperator(operator: string): torii.ComparisonOperator { return "Lt"; case "$lte": return "Lte"; + case "$in": + return "In"; + case "$nin": + return "NotIn"; default: throw new Error(`Unsupported operator: ${operator}`); } diff --git a/packages/sdk/src/queryBuilder.ts b/packages/sdk/src/queryBuilder.ts index e7a43e49..fe3d3eb8 100644 --- a/packages/sdk/src/queryBuilder.ts +++ b/packages/sdk/src/queryBuilder.ts @@ -140,6 +140,20 @@ class QueryEntity { return this.addConstraint(field, value, Operator.lte); } + public in( + field: FirstLevelKeys, + value: any + ): QueryEntity { + return this.addConstraint(field, value, Operator.in); + } + + public notIn( + field: FirstLevelKeys, + value: any + ): QueryEntity { + return this.addConstraint(field, value, Operator.nin); + } + private addConstraint( field: FirstLevelKeys, value: any, @@ -177,4 +191,6 @@ enum Operator { gte = "$gte", lt = "$lt", lte = "$lte", + in = "$in", + nin = "$nin", }