Skip to content
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

🏷️ Export discriminated interfaces for SchemaRestPullRequestActivity #17

Merged
merged 1 commit into from
Oct 21, 2024

Conversation

NatoBoram
Copy link
Collaborator

@NatoBoram NatoBoram commented Oct 21, 2024

Clone and split SchemaRestPullRequestActivity

πŸ“ Description

SchemaRestPullRequestActivity is missing some information.

This adds an easy way to deal with it.

  • Add type guards and interfaces to deal with that
  • Enable rewriteRelativeImportExtensions

πŸ““ References

Summary by CodeRabbit

  • New Features

    • Enhanced module export capabilities with new paths for TypeScript definitions and JavaScript files related to cloud and server open API functionalities.
    • Added new types and interfaces related to pull request activities, improving schema definitions.
  • Bug Fixes

    • Updated import paths across various modules to use TypeScript files instead of JavaScript, ensuring better type safety and consistency.
  • Documentation

    • Updated tsconfig.json to improve TypeScript configuration, including new compiler options for handling module imports.
  • Chores

    • Transitioned several modules and tests from JavaScript to TypeScript, improving overall code quality and maintainability.

@NatoBoram NatoBoram requested a review from a team as a code owner October 21, 2024 18:43
@NatoBoram NatoBoram self-assigned this Oct 21, 2024
Copy link

coderabbitai bot commented Oct 21, 2024

πŸ“ Walkthrough

Walkthrough

The pull request introduces several changes primarily focused on transitioning the codebase from JavaScript to TypeScript. Key modifications include updating import paths in multiple test and source files to reflect .ts extensions instead of .js. Additionally, the package.json file has been updated to include new export entries for cloud and server APIs and to upgrade the TypeScript version. The tsconfig.json file has also been modified to enhance module resolution and type definition handling.

Changes

File Path Change Summary
package.json - Updated TypeScript version to 5.7.0-beta
- Added exports for ./cloud/openapi and ./server/openapi
src/base64.test.ts - Changed import from ./base64.js to ./base64.ts
src/cloud/client.test.ts - Changed import from ./client.js to ./client.ts
src/cloud/client.ts - Changed import from ./openapi/index.js to ./openapi/index.ts
src/cloud/index.ts - Changed exports from .js to .ts for ./client and ./openapi/index
- Updated export type to use namespace for OpenApi
src/cloud/openapi/index.ts - Changed export from ./openapi-typescript.js to ./openapi-typescript.ts
src/index.test.ts - Changed import from ./index.js to ./index.ts
src/index.ts - Changed exports from .js to .ts for base64, cloud, and server (renamed to BitbucketCloud and BitbucketServer)
src/server/client.test.ts - Changed import from ./client.js to ./client.ts
src/server/client.ts - Changed import from ./openapi/index.js to ./openapi/index.ts
src/server/index.ts - Changed exports from .js to .ts for client and added export for interfaces/index.ts
src/server/interfaces/index.ts - Added export for all entities from schema_rest_pull_request_activity.ts
src/server/interfaces/schema_rest_pull_request_activity.ts - Introduced new types and interfaces related to pull request activities, including type guard functions.
src/server/openapi/index.ts - Changed export from ./openapi-typescript.js to ./openapi-typescript.ts
src/server/webhooks/events/event.ts - Changed imports from .js to .ts for various event types
src/server/webhooks/events/index.ts - Changed exports from .js to .ts for events and suggestions
src/server/webhooks/events/pr/*.ts - Changed imports from .js to .ts across multiple files for various PR events
src/server/webhooks/events/repo/*.ts - Changed imports from .js to .ts across multiple files for various repository events
src/server/webhooks/headers.ts - Changed import from ./events/event.js to ./events/event.ts
src/server/webhooks/index.ts - Changed exports from .js to .ts for events and headers
tests/cloud/client.ts - Changed imports from .js to .ts for client and environment variables
tests/cloud/repositories.test.ts - Changed import from ./client.js to ./client.ts
tests/server/client.ts - Changed imports from .js to .ts for client and environment variables
tests/server/projects.test.ts - Changed imports from .js to .ts for environment variables and client
tests/server/repositories.test.ts - Changed imports from .js to .ts for environment variables and client
tsconfig.json - Added "rewriteRelativeImportExtensions": true
- Set "module" and "moduleResolution" to "NodeNext"
- Updated "typeRoots"

Possibly related PRs

  • πŸ—οΈ Add entry point for cloud and serverΒ #10: πŸ—οΈ Add entry point for cloud and server - This PR adds new export entries for ./cloud and ./server in package.json, which aligns with the main PR's changes to enhance module export capabilities.
  • ⬆️ pnpm updateΒ #9: ⬆️ pnpm update - This PR updates the package.json file, which is directly related to the main PR's modifications in the same file, including updates to TypeScript and other dependencies.
  • ⬆️ pnpm updateΒ #16: ⬆️ pnpm update - Similar to PR ⬆️ pnpm updateΒ #9, this PR also updates the package.json file, indicating ongoing changes to dependencies that may relate to the main PR's context of updating TypeScript and module exports.

Suggested labels

enhancement, javascript


πŸͺ§ Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@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

🧹 Outside diff range and nitpick comments (2)
src/cloud/index.ts (1)

1-2: Ensure comprehensive testing after TypeScript migration.

The changes in this file are part of the larger TypeScript migration effort. While the modifications are correct, it's crucial to conduct thorough testing across the entire codebase to ensure that these changes haven't introduced any unintended side effects, particularly in how types are imported and used in other modules.

src/server/webhooks/events/pr/event.test.ts (1)

2-3: LGTM! The import path changes look good.

The modification of import paths from .js to .ts is consistent with the transition to TypeScript and follows best practices. These changes improve type safety and maintain consistency across the codebase.

As a suggestion for future improvements, consider expanding the test suite to cover more edge cases and potential scenarios for the isPrEventKey and isPrEvent functions. This could include testing with invalid input types or unexpected event keys to ensure robust error handling.

πŸ“œ Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

πŸ“₯ Commits

Files that changed from the base of the PR and between 4480cc6 and bad42f0.

β›” Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
πŸ“’ Files selected for processing (54)
  • package.json (2 hunks)
  • src/base64.test.ts (1 hunks)
  • src/cloud/client.test.ts (1 hunks)
  • src/cloud/client.ts (1 hunks)
  • src/cloud/index.ts (1 hunks)
  • src/cloud/openapi/index.ts (1 hunks)
  • src/index.test.ts (1 hunks)
  • src/index.ts (1 hunks)
  • src/server/client.test.ts (1 hunks)
  • src/server/client.ts (1 hunks)
  • src/server/index.ts (1 hunks)
  • src/server/interfaces/index.ts (1 hunks)
  • src/server/interfaces/schema_rest_pull_request_activity.ts (1 hunks)
  • src/server/openapi/index.ts (1 hunks)
  • src/server/webhooks/events/event.ts (1 hunks)
  • src/server/webhooks/events/index.ts (1 hunks)
  • src/server/webhooks/events/pr/comment_added.ts (1 hunks)
  • src/server/webhooks/events/pr/comment_deleted.ts (1 hunks)
  • src/server/webhooks/events/pr/comment_edited.ts (1 hunks)
  • src/server/webhooks/events/pr/declined.ts (1 hunks)
  • src/server/webhooks/events/pr/deleted.ts (1 hunks)
  • src/server/webhooks/events/pr/event.test.ts (1 hunks)
  • src/server/webhooks/events/pr/event.ts (1 hunks)
  • src/server/webhooks/events/pr/from_ref_updated.ts (1 hunks)
  • src/server/webhooks/events/pr/index.ts (1 hunks)
  • src/server/webhooks/events/pr/merged.ts (1 hunks)
  • src/server/webhooks/events/pr/modified.ts (1 hunks)
  • src/server/webhooks/events/pr/opened.ts (1 hunks)
  • src/server/webhooks/events/pr/reviewer_approved.ts (1 hunks)
  • src/server/webhooks/events/pr/reviewer_changes_requested.ts (1 hunks)
  • src/server/webhooks/events/pr/reviewer_unapproved.ts (1 hunks)
  • src/server/webhooks/events/pr/reviewer_updated.ts (1 hunks)
  • src/server/webhooks/events/project/event.test.ts (1 hunks)
  • src/server/webhooks/events/project/event.ts (1 hunks)
  • src/server/webhooks/events/project/index.ts (1 hunks)
  • src/server/webhooks/events/repo/comment_added.ts (1 hunks)
  • src/server/webhooks/events/repo/comment_deleted.ts (1 hunks)
  • src/server/webhooks/events/repo/comment_edited.ts (1 hunks)
  • src/server/webhooks/events/repo/event.test.ts (1 hunks)
  • src/server/webhooks/events/repo/event.ts (1 hunks)
  • src/server/webhooks/events/repo/forked.ts (1 hunks)
  • src/server/webhooks/events/repo/index.ts (1 hunks)
  • src/server/webhooks/events/repo/modified.ts (1 hunks)
  • src/server/webhooks/events/repo/refs_changed.ts (1 hunks)
  • src/server/webhooks/events/repo/secret_detected.ts (1 hunks)
  • src/server/webhooks/events/repo/synchronized.ts (1 hunks)
  • src/server/webhooks/headers.ts (1 hunks)
  • src/server/webhooks/index.ts (1 hunks)
  • tests/cloud/client.ts (1 hunks)
  • tests/cloud/repositories.test.ts (1 hunks)
  • tests/server/client.ts (1 hunks)
  • tests/server/projects.test.ts (1 hunks)
  • tests/server/repositories.test.ts (1 hunks)
  • tsconfig.json (1 hunks)
βœ… Files skipped from review due to trivial changes (44)
  • src/base64.test.ts
  • src/cloud/client.test.ts
  • src/cloud/client.ts
  • src/cloud/openapi/index.ts
  • src/index.test.ts
  • src/server/client.test.ts
  • src/server/client.ts
  • src/server/interfaces/index.ts
  • src/server/openapi/index.ts
  • src/server/webhooks/events/event.ts
  • src/server/webhooks/events/index.ts
  • src/server/webhooks/events/pr/comment_added.ts
  • src/server/webhooks/events/pr/comment_edited.ts
  • src/server/webhooks/events/pr/declined.ts
  • src/server/webhooks/events/pr/deleted.ts
  • src/server/webhooks/events/pr/event.ts
  • src/server/webhooks/events/pr/from_ref_updated.ts
  • src/server/webhooks/events/pr/index.ts
  • src/server/webhooks/events/pr/merged.ts
  • src/server/webhooks/events/pr/modified.ts
  • src/server/webhooks/events/pr/opened.ts
  • src/server/webhooks/events/pr/reviewer_approved.ts
  • src/server/webhooks/events/pr/reviewer_changes_requested.ts
  • src/server/webhooks/events/pr/reviewer_unapproved.ts
  • src/server/webhooks/events/pr/reviewer_updated.ts
  • src/server/webhooks/events/project/event.test.ts
  • src/server/webhooks/events/project/event.ts
  • src/server/webhooks/events/project/index.ts
  • src/server/webhooks/events/repo/comment_added.ts
  • src/server/webhooks/events/repo/comment_deleted.ts
  • src/server/webhooks/events/repo/comment_edited.ts
  • src/server/webhooks/events/repo/event.test.ts
  • src/server/webhooks/events/repo/event.ts
  • src/server/webhooks/events/repo/forked.ts
  • src/server/webhooks/events/repo/index.ts
  • src/server/webhooks/events/repo/modified.ts
  • src/server/webhooks/events/repo/refs_changed.ts
  • src/server/webhooks/events/repo/secret_detected.ts
  • src/server/webhooks/events/repo/synchronized.ts
  • src/server/webhooks/index.ts
  • tests/cloud/client.ts
  • tests/cloud/repositories.test.ts
  • tests/server/client.ts
  • tests/server/projects.test.ts
🧰 Additional context used
πŸ”‡ Additional comments (21)
src/cloud/index.ts (2)

1-1: LGTM! Proper TypeScript file extension used.

The change from .js to .ts for the client import is correct and aligns with the project's transition to TypeScript.


2-2: Verify impact of OpenApi namespace import.

The change to use a namespace import for OpenApi and the update to the .ts file extension are appropriate. However, it's crucial to ensure that this modification doesn't adversely affect existing type imports throughout the codebase.

Please run the following script to verify the impact of this change:

βœ… Verification successful

Impact of OpenApi namespace import verified.
The namespace import for OpenApi and the .ts file extension updates do not adversely affect existing type imports.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for potential breaking changes in OpenApi type imports

# Test: Search for OpenApi type imports that might be affected
rg -i 'import.*OpenApi.*from.*openapi/index'

# Test: Look for any remaining .js extensions in import statements
rg 'from.*\.js["\']'

Length of output: 140


Script:

#!/bin/bash
# Description: Check for potential breaking changes in OpenApi type imports

# Test: Search for OpenApi type imports that might be affected
rg -i 'import.*OpenApi.*from.*openapi/index.ts'

# Test: Look for any remaining .js extensions in import statements
rg 'from.*\.js["\']'

Length of output: 143


Script:

#!/bin/bash
# Description: Check for potential breaking changes in OpenApi type imports

# Test: Search for OpenApi type imports that might be affected
rg -i 'import.*OpenApi.*from\ "./openapi/index\.ts"'

# Test: Look for any remaining .js extensions in import statements
rg 'from\ ".*\.js"'

Length of output: 293


Script:

#!/bin/bash
# Description: Check for potential breaking changes in OpenApi type imports

# Test: Search for OpenApi type imports that might be affected
rg -i 'import.*OpenApi.*from "./openapi/index\.ts"'

# Test: Look for any remaining .js extensions in import statements
rg 'from ".*\.js"'

Length of output: 184

src/index.ts (4)

1-1: LGTM: Updated export statement for base64 module

The export statement has been correctly updated to use the TypeScript file extension (.ts). This change is consistent with the transition from JavaScript to TypeScript.


1-3: Overall assessment: Excellent updates to export statements

The changes in this file successfully transition the exports to TypeScript and improve naming conventions by using more specific Bitbucket-related names. These updates align well with the PR objectives and enhance the overall clarity of the module structure.


3-3: LGTM: Updated and renamed server module export

The export statement has been correctly updated to use the TypeScript file extension (.ts) and renamed from 'server' to 'BitbucketServer'. This change improves clarity and aligns with the Bitbucket branding.

Please verify that all import statements in other files have been updated to use 'BitbucketServer' instead of 'server'. You can use the following script to check for any remaining 'server' imports:

#!/bin/bash
# Description: Search for any remaining 'server' imports that might need updating

rg -i "import.*server.*from.*['\"]\.\.?/index" --type ts

2-2: LGTM: Updated and renamed cloud module export

The export statement has been correctly updated to use the TypeScript file extension (.ts) and renamed from 'cloud' to 'BitbucketCloud'. This change improves clarity and aligns with the Bitbucket branding.

Please verify that all import statements in other files have been updated to use 'BitbucketCloud' instead of 'cloud'. You can use the following script to check for any remaining 'cloud' imports:

src/server/index.ts (4)

2-2: LGTM! Verify the new interfaces export

The addition of the interfaces export enhances the module's capabilities.

Run the following script to verify the new interfaces export:

#!/bin/bash
# Description: Verify the new interfaces export

# Test: Check if the file exists
if fd -p "src/server/interfaces/index.ts"; then
    echo "File ./interfaces/index.ts exists."
else
    echo "Error: File ./interfaces/index.ts does not exist."
fi

# Test: Check the contents of the file
if fd -p "src/server/interfaces/index.ts" --exec cat; then
    echo "Contents of ./interfaces/index.ts:"
else
    echo "Error: Could not read ./interfaces/index.ts"
fi

# Test: Check for any usage of these interfaces
if rg -q "interfaces/index" src/; then
    echo "Found usage of interfaces/index in the src/ directory:"
    rg "interfaces/index" src/
else
    echo "No usage of interfaces/index found in the src/ directory."
fi

4-4: Verify if webhooks export should be updated to TypeScript

The export for webhooks still uses the ".js" extension, which is inconsistent with the other exports in this file.

Run the following script to verify the webhooks export:

#!/bin/bash
# Description: Verify webhooks export

# Test: Check if a TypeScript version of the file exists
if fd -p "src/server/webhooks/index.ts"; then
    echo "A TypeScript version (./webhooks/index.ts) exists. Consider updating the import."
elif fd -p "src/server/webhooks/index.js"; then
    echo "Only a JavaScript version (./webhooks/index.js) exists. Consider migrating this file to TypeScript."
else
    echo "Error: Neither ./webhooks/index.ts nor ./webhooks/index.js exist."
fi

# Test: Check for any usage of webhooks
if rg -q "from ['\"].*webhooks/index['\"]" src/; then
    echo "Found usage of webhooks in the src/ directory:"
    rg "from ['\"].*webhooks/index['\"]" src/
else
    echo "No usage of webhooks found in the src/ directory."
fi

If a TypeScript version of the webhooks file exists or if it's appropriate to migrate this file to TypeScript, consider updating this export statement to use the ".ts" extension for consistency.


3-3: LGTM! Verify OpenApi export usage

The change to a namespace-like syntax for OpenApi types is appropriate. This modification allows for better organization and potential conflict resolution of the exported types.

Run the following script to verify the OpenApi export usage:

#!/bin/bash
# Description: Verify OpenApi export usage

# Test: Check if the file exists
if fd -p "src/server/openapi/index.ts"; then
    echo "File ./openapi/index.ts exists."
else
    echo "Error: File ./openapi/index.ts does not exist."
fi

# Test: Check for any usage of OpenApi types
if rg -q "OpenApi\." src/; then
    echo "Found usage of OpenApi namespace in the src/ directory:"
    rg "OpenApi\." src/
else
    echo "No usage of OpenApi namespace found in the src/ directory."
fi

# Test: Check for any remaining type imports from openapi/index
if rg -q "from ['\"].*openapi/index['\"]" src/; then
    echo "Warning: Found direct type imports from openapi/index in the src/ directory:"
    rg "from ['\"].*openapi/index['\"]" src/
else
    echo "No direct type imports from openapi/index found in the src/ directory."
fi

1-1: LGTM! Verify the existence of "./client.ts"

The update from ".js" to ".ts" extension is correct for the TypeScript transition.

Run the following script to verify the existence of the "./client.ts" file:

βœ… Verification successful

Further Verification Required: Verify the existence of "./client.ts"

Please run the following script to ensure that "./client.ts" exists and that there are no remaining references to "./client.js":


Verified: Export statement correctly updated.

No references to "./client.js" found in the src/ directory.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the existence of "./client.ts" file

# Test: Check if the file exists
if fd -p "src/server/client.ts"; then
    echo "File ./client.ts exists."
else
    echo "Error: File ./client.ts does not exist."
fi

# Test: Check for any remaining references to "./client.js"
if rg -q "client\.js" src/; then
    echo "Warning: Found references to client.js in the src/ directory."
    rg "client\.js" src/
else
    echo "No references to client.js found in the src/ directory."
fi

Length of output: 489


Script:

#!/bin/bash
# Description: Verify the existence of "./client.ts" file and check for references to "./client.js"

# Test: Check if the file exists
if fd -p "src/server/client.ts"; then
    echo "File ./client.ts exists."
else
    echo "Error: File ./client.ts does not exist."
fi

# Test: Check for any remaining references to "./client.js"
if rg -q "client\.js" src/; then
    echo "Warning: Found references to client.js in the src/ directory."
    rg "client\.js" src/
else
    echo "No references to client.js found in the src/ directory."
fi

Length of output: 255

tsconfig.json (1)

18-18: Approval: Good addition to support ESM compatibility

The new compiler option "rewriteRelativeImportExtensions": true is a valuable addition to your TypeScript configuration. This option allows TypeScript to automatically rewrite relative import paths to include file extensions, which aligns well with your use of the "NodeNext" module system.

Benefits of this change include:

  1. Improved compatibility with the Node.js ESM loader.
  2. Simplified development process by allowing omission of file extensions in imports.
  3. Enhanced consistency between development and production environments.

Keep in mind that this might require minor adjustments to existing import statements if they explicitly included extensions. Overall, this change supports better ESM compatibility and is a positive step for your project's TypeScript configuration.

To ensure this change doesn't cause unexpected issues, you may want to run the following verification:

βœ… Verification successful

Verification Successful: No issues detected with relative imports

All relative import statements in the codebase include explicit file extensions, ensuring compatibility with the newly added "rewriteRelativeImportExtensions": true compiler option. This change effectively supports ESM compatibility without necessitating any further modifications.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any relative imports that might be affected by the new compiler option

# Test: Search for relative imports in TypeScript files
echo "Checking for relative imports that might be affected:"
rg -t ts '(from|import) [\'"]\.\.?/' src

Length of output: 210


Script:

#!/bin/bash
# Description: Check for any relative imports that might be affected by the new compiler option

# Test: Search for relative imports in TypeScript files
echo "Checking for relative imports that might be affected:"
rg -t ts "(from|import) ['\"]\.\.?/" src

Length of output: 9987

tests/server/repositories.test.ts (3)

Line range hint 1-63: Summary: Import statements updated for TypeScript transition.

The changes in this file are limited to updating import statements from ".js" to ".ts" extensions. These modifications align with the project's transition from JavaScript to TypeScript. The test suite structure and logic remain unchanged, which is appropriate as the functionality being tested hasn't been altered.


6-6: LGTM! Verify the existence of "./client.ts".

The update of the import statement from ".js" to ".ts" is consistent with the transition to TypeScript.

Run the following script to verify the existence of the "./client.ts" file:

#!/bin/bash
# Description: Verify the existence of "./client.ts" relative to the current file.

# Test: Check if "./client.ts" exists relative to the current file
fd -p 'tests/server/client.ts' --type f

5-5: LGTM! Verify the existence of "../env.ts".

The update of the import statement from ".js" to ".ts" is consistent with the transition to TypeScript.

Run the following script to verify the existence of the "../env.ts" file:

βœ… Verification successful

Import Statement Verified Successfully

The "../env.ts" file exists in the repository. The update to the import statement is correct.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the existence of "../env.ts" relative to the current file.

# Test: Check if "../env.ts" exists relative to the current file
fd -p 'tests/server/../env.ts' --type f

Length of output: 62


Script:

#!/bin/bash
# Description: Verify the existence of "../env.ts" relative to the repository root.

# Test: Check if "env.ts" exists in the repository
fd 'env.ts' --type f

Length of output: 33

src/server/webhooks/events/pr/comment_deleted.ts (1)

1-4: LGTM! Consistent transition to TypeScript.

The change from .js to .ts in the import statement is appropriate and aligns with the transition to TypeScript. This modification enhances type safety and consistency in the codebase.

Let's verify if this change is consistent across the codebase:

βœ… Verification successful

.js Imports from openapi-typescript Successfully Replaced with .ts

All import statements from openapi-typescript have been updated to use .ts extensions across the codebase, ensuring consistency and type safety.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any remaining .js imports from openapi-typescript

# Test: Search for .js imports from openapi-typescript. Expect: No results.
rg -g '*.ts' 'from.*openapi-typescript\.js'

# Test: Confirm all imports are now using .ts extension. Expect: Multiple results, all using .ts.
rg -g '*.ts' 'from.*openapi-typescript\.ts'

Length of output: 2222

src/server/webhooks/headers.ts (1)

2-2: Approved: Import statement updated to TypeScript extension

The change from .js to .ts in the import statement is correct and aligns with the project's transition to TypeScript. This modification enhances type safety and consistency across the codebase.

To ensure all imports have been updated consistently, please run the following script:

package.json (4)

Line range hint 67-91: Summary: Changes align with PR objectives, but consider TypeScript version choice.

The additions to the exports section for ./cloud/openapi and ./server/openapi align well with the PR objectives of exporting discriminated interfaces for SchemaRestPullRequestActivity. These changes enhance the module's capabilities by providing access to both cloud and server openapi functionality.

However, the update to TypeScript version 5.7.0-beta might introduce potential risks. Consider using a stable version instead to ensure reliability in production environments.

Overall, the changes improve the project's structure and export capabilities, supporting the goals of the pull request.

#!/bin/bash
# Description: Verify the overall project structure and build process

# Test: Check the project structure
echo "Verifying the project structure:"
fd -t d -d 2 . src

# Test: Ensure the build script is updated to handle new exports
echo "Checking the build script for new exports:"
grep -A 10 "build" package.json

# Test: Verify TypeScript configuration
echo "Checking TypeScript configuration:"
cat tsconfig.json

81-84: LGTM! Verify the correctness of the new export paths.

The addition of the ./cloud/openapi export enhances the module's capabilities by providing access to cloud openapi functionality. The paths follow the project's convention for the dist folder structure.

Please ensure that the specified paths (./dist/cloud/openapi/index.d.ts and ./dist/cloud/openapi/index.js) are correct and that the corresponding files will be generated during the build process.

#!/bin/bash
# Description: Verify the existence of cloud openapi files

# Test: Check if the TypeScript source file exists
echo "Checking for the existence of the cloud openapi TypeScript source file:"
fd -t f "index.ts" src/cloud/openapi

# Test: Verify the build script generates the correct files
echo "Verifying the build script generates the correct files:"
grep -A 5 "build" package.json

89-91: LGTM! Verify the correctness of the new export paths.

The addition of the ./server/openapi export enhances the module's capabilities by providing access to server openapi functionality. The paths follow the project's convention for the dist folder structure and are consistent with the previously added cloud/openapi export.

Please ensure that the specified paths (./dist/server/openapi/index.d.ts and ./dist/server/openapi/index.js) are correct and that the corresponding files will be generated during the build process.

#!/bin/bash
# Description: Verify the existence of server openapi files

# Test: Check if the TypeScript source file exists
echo "Checking for the existence of the server openapi TypeScript source file:"
fd -t f "index.ts" src/server/openapi

# Test: Verify the build script generates the correct files
echo "Verifying the build script generates the correct files:"
grep -A 5 "build" package.json

67-67: Consider using a stable TypeScript version instead of beta.

Updating to a beta version (5.7.0-beta) might introduce instability or breaking changes. Beta versions are generally not recommended for production use. Additionally, removing the caret (^) means it won't automatically update to newer patch versions.

Consider using the latest stable version of TypeScript instead, such as ^5.6.3 or the most recent stable release.

src/server/interfaces/schema_rest_pull_request_activity.ts (1)

1-29: Approved

The declarations and interfaces are well-defined and accurately represent the pull request activities.

@NatoBoram NatoBoram merged commit e7b790c into main Oct 21, 2024
2 checks passed
@NatoBoram NatoBoram deleted the feature/bitbucket-pr-activity branch October 21, 2024 18:52
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.

1 participant