You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
refactor(api): migrate WebLink and File from Flow to TypeScript - #4989
Tick the box to add this pull request to the merge queue (same as @mergifyio queue). If it does not match the queue conditions yet, it enters the queue once it does.
Queue this pull request once it meets the queue conditions
No actionable comments were generated in the recent review.
Walkthrough
This pull request adds File and WebLink API classes. The file API supports download and thumbnail URLs, representation polling, description updates, and cached file retrieval. The web-link API supports cached retrieval. Related tests now use TypeScript imports and types.
Changes
File and WebLink API clients
Layer / File(s)
Summary
File URLs and representations src/api/File.ts, src/api/__tests__/File.test.ts
Adds authenticated download and thumbnail URL generation, representation completion checks, and polling. Thumbnail tests type results as string | null.
File descriptions and retrieval src/api/File.ts, src/api/__tests__/File.test.ts
Adds description updates and cached file retrieval, including extension retrieval. Updates test imports and uses noop callbacks in the destroyed-file case.
Web-link retrieval and type updates src/api/WebLink.ts, src/api/__tests__/WebLink.test.ts, src/utils/__tests__/flatten.test.ts
Adds web-link URL construction and cached retrieval. Updates test setup to use APIOptions types.
This change migrates the File and WebLink API clients to TypeScript and keeps Flow type definitions for existing consumers. No concrete regression was found, and the merge risk is minimal.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title names the main change: migrating the WebLink and File APIs from Flow to TypeScript. The changeset renames the implementations and tests to .ts, adds .js.flow files, and adds as APIOptions ca…
Description check
The description follows the repository's content: it names the converted files, lists the test renames and .js.flow backward-compatibility files, notes the flatten.test.ts type fallout, and records th…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title names the main change: migrating the WebLink and File APIs from Flow to TypeScript. The changeset renames the implementations and tests to .ts, adds .js.flow files, and adds as APIOptions casts in flatten.test.ts. The title is concise and matches the primary change.
Full details: Description check
Explanation
The description follows the repository's content: it names the converted files, lists the test renames and .js.flow backward-compatibility files, notes the flatten.test.ts type fallout, and records the one contract change to File.getThumbnailUrl. The template is a reviewer-workflow note about the ready-to-merge label and has no required fields to fill. The description covers the template's intent, so it passes.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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.
A rabbit checks the file URL, Then waits for views to finish too. A token joins the download stream, Cached fields return as seen. Web links hop back with typed fields.
Recent review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Organization UI
Review profile: CHILL
Plan: Advanced
Run ID: 60984e73-c645-4a8d-8068-e9edbd4d3396
Commits
Reviewing files that changed from the base of the PR and between fcd5d5b and 48c9756.
Files selected for processing: 7
src/api/File.js.flow
src/api/File.ts
src/api/WebLink.js.flow
src/api/WebLink.ts
src/api/__tests__/File.test.ts
src/api/__tests__/WebLink.test.ts
src/utils/__tests__/flatten.test.ts
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 1 remain after this review.
This branch has not been deployed
No deployments
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Convert
WebLinkandFileAPIs to TypeScriptThis PR converts
src/api/WebLinkandsrc/api/Filefrom JavaScript with Flow to TypeScript.Changes
WebLink.jstoWebLink.tsandFile.jstoFile.ts__tests__/WebLink.test.jsand__tests__/File.test.jsto.test.ts.js.flowfiles (original Flow source) for backward compatibilitysrc/utils/__tests__/flatten.test.tsfor type fallout (as APIOptionsonFileAPI/WebLinkAPIconstruction)Contract
File.getThumbnailUrlPromise<?string>→Promise<string | null>— every return path resolves to a string ornull, neverundefinedSummary by CodeRabbit