-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: accept and convert in operator arrays #374
Conversation
WalkthroughThe pull request introduces enhancements to the SDK's query capabilities by adding support for Changes
Assessment against linked issues
Poem
Finishing Touches
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
packages/sdk/src/types.ts (1)
104-105
: Add JSDoc comments for new operators.The implementation looks good, but please add documentation for the new operators to maintain consistency with other operators and improve developer experience.
$lt?: TModel[P]; $lte?: TModel[P]; + /** Matches values that are in the specified array */ $in?: TModel[P][]; + /** Matches values that are not in the specified array */ $nin?: TModel[P][];packages/sdk/src/convertQuerytoClause.ts (1)
298-299
: PR objectives successfully achieved.The implementation successfully:
- Accepts arrays as valid input values for the
$in
operator- Converts array values to the
List
primitive type- Provides additional support for the
$nin
operatorConsider adding examples to the documentation to showcase the new array filtering capabilities.
Also applies to: 104-105
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
packages/sdk/src/convertQuerytoClause.ts
(1 hunks)packages/sdk/src/types.ts
(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: check
- GitHub Check: build
🔇 Additional comments (2)
packages/sdk/src/convertQuerytoClause.ts (2)
298-299
: Integration between types and implementation looks good!The array handling implementation in
convertQuerytoClause.ts
correctly supports the new$in
and$nin
operators defined intypes.ts
. The type safety is maintained throughout the conversion process.Also applies to: 104-105
298-299
: Add validation for array inputs.While the implementation works for basic arrays, consider adding validation for:
- Empty arrays
- Nested arrays
- Array size limits to prevent performance issues with very large arrays
} else if (Array.isArray(value)) { + if (value.length === 0) { + throw new Error('Empty arrays are not supported'); + } + if (value.length > 1000) { + throw new Error('Arrays exceeding 1000 elements are not supported'); + } + if (value.some(item => Array.isArray(item))) { + throw new Error('Nested arrays are not supported'); + } return { List: value.map((item) => convertToPrimitive(item)) }; }Let's verify the current usage patterns to determine appropriate size limits:
Closes #351, fixed #364
Introduced changes
$in
operatorList
primitiveChecklist
Summary by CodeRabbit
New Features
$in
and$nin
operatorsImprovements