Skip to content

Conversation

@ggazzo
Copy link
Member

@ggazzo ggazzo commented Oct 3, 2025

…itions

Summary by CodeRabbit

  • New Features

    • Added multipart binary response support for federation requests.
    • Exposed MultipartResult type in the core package for improved typing.
  • Chores

    • Switched post-build to bundle TypeScript declarations using Rollup.
    • Added a Rollup configuration to produce a single bundled .d.ts output.
    • Added rollup-plugin-dts as a dependency.
    • Expanded global TypeScript config tracking for task caching.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 3, 2025

Walkthrough

Switches the post-package step to run Rollup to produce a bundled TypeScript declarations file, adds a Rollup DTS config and the rollup-plugin-dts dependency, expands Turbo globalDependencies, re-exports MultipartResult from core, and updates FederationRequestService.requestBinaryData to return Promise<MultipartResult> by delegating to response.multipart().

Changes

Cohort / File(s) Summary
Build pipeline: DTS bundling
bundle.ts, rollup.config.js, package.json, turbo.json
Post-package step now runs bun run rollup -c (replacing tsc --emitDeclarationOnly) and adds a Rollup config to bundle .d.ts files. Adds rollup-plugin-dts to dependencies and expands turbo.json globalDependencies to include tsconfig.sdk.types.json and tsconfig.base.json.
Core public types
packages/core/src/index.ts
Re-exports MultipartResult alongside FetchResponse from ./utils/fetch.
Federation SDK binary request
packages/federation-sdk/src/services/federation-request.service.ts
Changes requestBinaryData signature to Promise<MultipartResult> and returns response.multipart() from the underlying signed request.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant Caller
  participant FederationRequestService
  participant makeSignedRequest
  participant Response

  Caller->>FederationRequestService: requestBinaryData(method, targetServer, endpoint, queryParams)
  FederationRequestService->>makeSignedRequest: makeSignedRequest(...)
  makeSignedRequest-->>FederationRequestService: Response
  FederationRequestService->>Response: multipart()
  Response-->>FederationRequestService: MultipartResult
  FederationRequestService-->>Caller: Promise<MultipartResult>
  note right of FederationRequestService: Signature updated to return MultipartResult
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

Poem

Hop hop, I bundle and roll,
Declarations stitched into one scroll.
A multipart song across the net,
Types in my paws, all neatly set.
Carrots compiled, the build is whole. 🥕✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title succinctly describes the main change—adding a Rollup configuration and updating dependencies to handle type definitions—which aligns with the modifications to bundling declaration files and package.json.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch chore/bundle

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.

@codecov-commenter
Copy link

codecov-commenter commented Oct 7, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 62.12%. Comparing base (6cc49f8) to head (a4cdc1f).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #249   +/-   ##
=======================================
  Coverage   62.12%   62.12%           
=======================================
  Files          67       67           
  Lines        6390     6390           
=======================================
  Hits         3970     3970           
  Misses       2420     2420           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ggazzo ggazzo marked this pull request as ready for review October 7, 2025 16:44
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: 1

🧹 Nitpick comments (10)
rollup.config.js (10)

3-3: Translate comments to English.

Comments should be in English for better maintainability and collaboration across the team.

Apply this diff:

-// Defina o ponto de entrada (entry point) do seu pacote
+// Define the entry point for the package

6-6: Translate comments to English.

Comments should be in English for better maintainability.

Apply this diff:

-// Função para determinar se um módulo deve ser tratado como externo
+// Function to determine if a module should be treated as external

8-23: Consider expanding the Node.js core module list.

The current list includes only a subset of Node.js core modules. Consider adding commonly used modules like fs, path, url, crypto, buffer, util, os, and child_process to ensure comprehensive external resolution.

Apply this diff to expand the list:

 	if (
 		id.startsWith('node:') ||
 		[
 			'http',
 			'https',
 			'dns',
 			'events',
 			'net',
 			'stream',
 			'tls',
 			'worker_threads',
+			'fs',
+			'path',
+			'url',
+			'crypto',
+			'buffer',
+			'util',
+			'os',
+			'child_process',
 		].includes(id)
 	) {

40-43: Translate comments to English.

Comments should be in English for consistency.

Apply this diff:

-	// Pacotes internos do monorepo - devem ser incluídos no bundle
+	// Internal monorepo packages - should be included in the bundle

45-48: Translate comments to English.

Comments should be in English for consistency.

Apply this diff:

-	// Imports relativos - devem ser incluídos no bundle
+	// Relative imports - should be included in the bundle

54-55: Translate comments to English.

Comments should be in English for consistency.

Apply this diff:

-	// Por padrão, trata como externo
+	// By default, treat as external

59-61: Translate comments to English.

Comments should be in English for consistency.

Apply this diff:

-	// Configuração para o arquivo JS (você pode continuar usando esbuild, se preferir)
-	// ...
+	// Configuration for JS file (you can continue using esbuild if preferred)
+	// ...

62-62: Translate comments to English.

Comments should be in English for consistency.

Apply this diff:

-	// Configuração para o arquivo DTS (definição de tipos)
+	// Configuration for DTS file (type definitions)

67-67: Translate comments to English.

Comments should be in English for consistency.

Apply this diff:

-			format: 'es', // Formato de saída para os tipos
+			format: 'es', // Output format for types

79-80: Translate comments to English.

Comments should be in English for consistency.

Apply this diff:

-		// Use a função isExternal para determinar quais módulos são externos
+		// Use the isExternal function to determine which modules are external
📜 Review details

Configuration used: CodeRabbit 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 6cc49f8 and 8a78efa.

⛔ Files ignored due to path filters (1)
  • bun.lock is excluded by !**/*.lock
📒 Files selected for processing (6)
  • bundle.ts (1 hunks)
  • package.json (1 hunks)
  • packages/core/src/index.ts (1 hunks)
  • packages/federation-sdk/src/services/federation-request.service.ts (2 hunks)
  • rollup.config.js (1 hunks)
  • turbo.json (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
packages/federation-sdk/src/services/federation-request.service.ts (2)
packages/core/src/index.ts (1)
  • MultipartResult (86-86)
packages/core/src/utils/fetch.ts (1)
  • MultipartResult (6-10)
🔇 Additional comments (6)
packages/core/src/index.ts (1)

86-86: LGTM!

The addition of MultipartResult to the public API exports aligns with its usage in the federation SDK and properly exposes the type for consumers.

packages/federation-sdk/src/services/federation-request.service.ts (2)

1-5: LGTM!

The import of MultipartResult type aligns with the expanded public API from @rocket.chat/federation-core.


189-205: FetchResponse.multipart() is implemented correctly
Verified that FetchResponse<T> in packages/core/src/utils/fetch.ts defines multipart(): Promise<MultipartResult>.

turbo.json (1)

13-17: Verified referenced tsconfig files exist
tsconfig.sdk.types.json and tsconfig.base.json were found at the repository root.

bundle.ts (1)

99-99: rollup.config.js verified
rollup.config.js is present at the repository root.

package.json (1)

23-23: rollup-plugin-dts version validated
The range ^6.2.3 resolves to an existing npm version and no security advisories were found.

Comment on lines +25 to +38
// Dependências de terceiros
if (
[
'zod',
'mongodb',
'tsyringe',
'pino',
'pino-std-serializers',
'sonic-boom',
'tweetnacl',
].includes(id)
) {
return true;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Add reflect-metadata to the external dependencies list.

The package.json includes reflect-metadata as a dependency, but it's missing from the external list. This could lead to bundling issues.

Apply this diff:

 	if (
 		[
 			'zod',
 			'mongodb',
 			'tsyringe',
 			'pino',
 			'pino-std-serializers',
 			'sonic-boom',
 			'tweetnacl',
+			'reflect-metadata',
 		].includes(id)
 	) {
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
// Dependências de terceiros
if (
[
'zod',
'mongodb',
'tsyringe',
'pino',
'pino-std-serializers',
'sonic-boom',
'tweetnacl',
].includes(id)
) {
return true;
}
// Dependências de terceiros
if (
[
'zod',
'mongodb',
'tsyringe',
'pino',
'pino-std-serializers',
'sonic-boom',
'tweetnacl',
'reflect-metadata',
].includes(id)
) {
return true;
}
🤖 Prompt for AI Agents
In rollup.config.js around lines 25 to 38, the external dependencies array is
missing "reflect-metadata" which is declared in package.json and should not be
bundled; add 'reflect-metadata' to the array of module ids checked by includes
(alongside 'zod','mongodb', etc.) so Rollup treats it as external and avoids
bundling it into the output.

@ggazzo ggazzo merged commit fcf8d2f into main Oct 7, 2025
2 of 3 checks passed
@ggazzo ggazzo deleted the chore/bundle branch October 7, 2025 17:03
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: 0

🧹 Nitpick comments (1)
package.json (1)

20-24: Please move rollup-plugin-dts to devDependencies.

The DTS Rollup plugin is only needed during the build step, not at runtime. Keeping it in dependencies bloats production installs and cascades the package to downstream consumers. Relocate it under devDependencies alongside the rest of the build tooling.

📜 Review details

Configuration used: CodeRabbit 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 8a78efa and a4cdc1f.

⛔ Files ignored due to path filters (1)
  • bun.lock is excluded by !**/*.lock
📒 Files selected for processing (6)
  • bundle.ts (1 hunks)
  • package.json (1 hunks)
  • packages/core/src/index.ts (1 hunks)
  • packages/federation-sdk/src/services/federation-request.service.ts (2 hunks)
  • rollup.config.js (1 hunks)
  • turbo.json (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (4)
  • turbo.json
  • bundle.ts
  • packages/federation-sdk/src/services/federation-request.service.ts
  • rollup.config.js
🔇 Additional comments (1)
packages/core/src/index.ts (1)

86-86: Approve public type export change

MultipartResult is defined in utils/fetch.ts and exposing it is an additive, non-breaking update required by federation-sdk.

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.

3 participants