Skip to content

Conversation

@deepak0x
Copy link

@deepak0x deepak0x commented Jan 4, 2026

Preparation & Setup

Helper Types Migration

  • Migrate PaginatedRequest to re-export from @rocket.chat/rest-typings
  • Migrate PaginatedResult to re-export from @rocket.chat/rest-typings
  • Update helpers/index.ts with TODO for future endpoint migration
  • Keep custom ResultFor, Serialized, ErrorResult for SDK compatibility

Proposed changes

Issue(s)

How to test or reproduce

Screenshots

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • Improvement (non-breaking change which improves a current function)
  • New feature (non-breaking change which adds functionality)
  • Documentation update (if none of the other choices apply)

Checklist

  • I have read the CONTRIBUTING doc
  • I have signed the CLA
  • Lint and unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works (if applicable)
  • I have added necessary documentation (if applicable)
  • Any dependent changes have been merged and published in downstream modules

Further comments

Summary by CodeRabbit

  • Refactor

    • Consolidated internal type definitions with shared package dependencies for improved maintainability.
  • Chores

    • Added new shared package dependencies (versions 6.13.1).

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 4, 2026

Walkthrough

This PR removes local REST API type definitions for PaginatedRequest and PaginatedResult, replacing them with re-exports from an external typings package. Two new dependencies are added to package.json to support this migration.

Changes

Cohort / File(s) Summary
Type definition consolidation
app/definitions/rest/helpers/PaginatedRequest.ts, app/definitions/rest/helpers/PaginatedResult.ts
Replaced local type definitions with re-exports from @rocket.chat/rest-typings. PaginatedRequest and PaginatedResult types now source from external package; public API unchanged.
Migration notes
app/definitions/rest/helpers/index.ts
Added TODO comments outlining migration plan for remaining type definitions. No functional changes.
Dependencies
package.json
Added @rocket.chat/[email protected] and @rocket.chat/[email protected] to support external type re-exports.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 Types now hop from local nests,
To distant packages, passing all tests,
PaginatedRequest finds a new home,
Where rest-typings let them freely roam!

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main changes: installing rest-typings and migrating helper types (PaginatedRequest and PaginatedResult) to use external type definitions.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between f39f83e and f1005de.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (4)
  • app/definitions/rest/helpers/PaginatedRequest.ts
  • app/definitions/rest/helpers/PaginatedResult.ts
  • app/definitions/rest/helpers/index.ts
  • package.json
🚧 Files skipped from review as they are similar to previous changes (2)
  • app/definitions/rest/helpers/PaginatedResult.ts
  • package.json
🔇 Additional comments (2)
app/definitions/rest/helpers/index.ts (1)

2-4: LGTM! Clear migration roadmap.

The TODO comments effectively document the migration strategy and explain why the custom implementation is temporarily retained. This provides valuable context for future maintainers.

app/definitions/rest/helpers/PaginatedRequest.ts (1)

1-1: Re-export approach is valid and maintains backward compatibility.

The package version @rocket.chat/[email protected] is correctly installed and the re-export pattern is safe. PaginatedRequest is actively used across the codebase (omnichannel, im, groups, emojiCustom, channels) and PaginatedResult is extensively used in endpoint definitions. The re-export maintains the existing import paths, ensuring no breaking changes for dependent code. This is part of a documented migration strategy noted in the index.ts TODO comment.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@deepak0x deepak0x force-pushed the refactor/rest-typings-setup_and_helpers_migration branch from 39693ae to 1c1e6dc Compare January 4, 2026 07:53
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Nitpick comments (1)
scripts/verify-migration-phase.sh (1)

1-52: Consider adding test execution to match documentation.

MIGRATION_SUMMARY.md and MIGRATION_CHECKLIST.md both reference running yarn test as part of the verification process, but this script only checks TypeScript compilation and linting. Consider adding test execution or updating the documentation to reflect the actual verification steps.

🔎 Proposed addition of test execution
 echo "✅ Linting passed with 0 errors"
 
+# Run tests
+echo "🧪 Running tests..."
+if ! yarn test; then
+    echo "❌ Tests failed!"
+    exit 1
+fi
+echo "✅ Tests passed"
+
 echo ""
 echo "✅ Phase $PHASE verification complete!"
 echo "   - TypeScript: ✅"
 echo "   - Linting: ✅ (0 errors)"
+echo "   - Tests: ✅"
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 3315fb4 and 39693ae.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (10)
  • .gitignore
  • MIGRATION_CHECKLIST.md
  • MIGRATION_PLAN.md
  • MIGRATION_SUMMARY.md
  • app/definitions/rest/COMPATIBILITY_LAYER.md
  • app/definitions/rest/helpers/PaginatedRequest.ts
  • app/definitions/rest/helpers/PaginatedResult.ts
  • app/definitions/rest/helpers/index.ts
  • package.json
  • scripts/verify-migration-phase.sh
🔇 Additional comments (8)
app/definitions/rest/COMPATIBILITY_LAYER.md (1)

1-52: Documentation looks good, but note the .gitignore conflict.

The compatibility layer documentation is well-structured and provides clear guidance with helpful examples. However, this file is listed in .gitignore (line 92), which conflicts with it being committed. Please refer to the review comment on .gitignore for resolution.

MIGRATION_PLAN.md (1)

1-315: Comprehensive migration plan, but conflicts with .gitignore.

The migration plan is well-structured with clear phases, time estimates, and quality gates. However, this file matches the *MIGRATION*.md pattern in .gitignore (line 88), which would prevent it from being tracked. Please refer to the review comment on .gitignore for resolution.

app/definitions/rest/helpers/PaginatedResult.ts (1)

1-2: No action needed—verification confirms the external type exists and all usages are type-safe.

The @rocket.chat/rest-typings package (v6.13.1) is properly declared in package.json, and the re-export is working correctly across all seven files that import PaginatedResult (directory.ts, settings.ts, teams.ts, videoConference.ts, omnichannel.ts, emojiCustom.ts, chat.ts). No type errors or import failures are present, confirming structure compatibility and type-safety.

package.json (1)

50-53: The specified versions (6.13.1) exist, are published, and have no known security vulnerabilities. They are compatible by design, released together as matched versions in Rocket.Chat 6.13.1. The exact version pinning indicates intentional selection for stable compatibility with a specific Rocket.Chat server release, which is appropriate for a mobile client targeting that version. No action needed.

app/definitions/rest/helpers/index.ts (1)

2-4: LGTM! Clear migration plan documented.

The TODO comments effectively communicate the migration strategy and rationale for maintaining the current implementation during the transition phase.

MIGRATION_SUMMARY.md (1)

1-58: Well-structured migration documentation.

The summary provides a clear overview of the migration process with helpful quick references, phase descriptions, quality gates, and important notes. The structure will guide developers effectively through the phased migration.

MIGRATION_CHECKLIST.md (1)

1-288: Excellent comprehensive migration checklist.

This checklist is well-structured and provides clear, actionable steps for each migration phase. The inclusion of verification commands (yarn lint, tsc --noEmit) after each category and standardized commit messages will help maintain quality and consistency throughout the migration process.

app/definitions/rest/helpers/PaginatedRequest.ts (1)

1-2: No action needed. The re-export to @rocket.chat/rest-typings is confirmed compatible.

The migration refactored the local PaginatedRequest definition to use the external package type, which correctly supports generic parameters T (request body) and an optional S (sort field) as evidenced by usage patterns throughout the codebase (PaginatedRequest<{ query: string }, 'name'>, PaginatedRequest<{ text: string }>). The external type includes the expected fields: count, offset, sort, and query. The codebase actively uses this re-export without type errors across multiple endpoint definitions.

@deepak0x deepak0x force-pushed the refactor/rest-typings-setup_and_helpers_migration branch 3 times, most recently from f39f83e to 861a4fa Compare January 4, 2026 08:04
Preparation & Setup
- Install @rocket.chat/[email protected]
- Install @rocket.chat/[email protected] (required dependency)
- Explore and document package structure

Helper Types Migration
- Migrate PaginatedRequest to re-export from @rocket.chat/rest-typings
- Migrate PaginatedResult to re-export from @rocket.chat/rest-typings
- Update helpers/index.ts with TODO for future endpoint migration
- Keep custom ResultFor, Serialized, ErrorResult for SDK compatibility
@deepak0x deepak0x force-pushed the refactor/rest-typings-setup_and_helpers_migration branch from 861a4fa to d9b821b Compare January 4, 2026 08:04
Copy link
Member

@diegolmello diegolmello left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution!
Left a few comments.

@@ -1,4 +1,7 @@
/* eslint-disable @typescript-eslint/no-unused-vars */
// TODO: Once we migrate all endpoints to use @rocket.chat/rest-typings,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you do it on this PR or start the work on this PR, so it serves as a POC?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure...will try my best...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants