Skip to content

TS 5.2 -> 5.8 #3410

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

Merged
merged 11 commits into from
May 2, 2025
Merged

TS 5.2 -> 5.8 #3410

merged 11 commits into from
May 2, 2025

Conversation

CarsonF
Copy link
Member

@CarsonF CarsonF commented May 1, 2025

No description provided.

Base automatically changed from upgrades to develop May 2, 2025 13:20
CarsonF added 4 commits May 2, 2025 09:34
These are functionally equivalent (named tuples v free objects).
And this is currently easier for TS/ Gel QB to express
…f currying.

TS 5.5 requires this former decorator usage to be wrapped in parentheses.
This isn't ideal so adjusting the signature.
Copy link

coderabbitai bot commented May 2, 2025

📝 Walkthrough

Walkthrough

This update refactors several custom decorator implementations to use a shared createMetadataDecorator utility, simplifying metadata management and retrieval for decorators like DbSort and DbUnique. Associated retrieval functions are replaced with static get methods on the decorators themselves, and relevant imports and usages are updated throughout the codebase. The Disabled decorator's signature is streamlined, and its usage is adjusted accordingly. Additionally, several data structure representations within repository files are changed from tuples to select objects. Minor TypeScript type assertions and comment corrections are also included, as well as a dependency update for TypeScript in package.json.

Changes

File(s) Change Summary
package.json Updated TypeScript version in devDependencies and resolution override for @nestjs/cli/typescript from ~5.2.2 to ~5.8.3.
src/common/db-sort.decorator.ts Refactored DbSort to use createMetadataDecorator; removed manual symbol and retrieval function; deleted getDbSortTransformer export.
src/common/db-unique.decorator.ts Refactored DbUnique to use createMetadataDecorator; removed manual metadata handling and getDbPropertyUnique export; added static get method.
src/common/disabled.decorator.ts Simplified Disabled decorator factory signature and typing; now requires a reason and accepts any decorator arguments.
src/components/admin/admin.gel.repository.ts Changed root user selection query to use direct equality instead of type check with is.
src/components/authorization/policy/executor/all-permissions-view.ts Added as any type assertion to nested createLazyRecord call in calculate function.
src/components/budget/handlers/update-project-current-budget-status.handler.ts Removed non-null assertion (!) from tuple element access in change[0].
src/components/engagement/engagement.gel.repository.ts Changed parent and nested properties in baseHydrate from tuple to select object structure.
src/components/partnership/partnership.gel.repository.ts Changed parent and nested properties in hydrate from tuple to select; refactored readManyByProjectAndPartnerQuery to use tuple membership filtering in a single select.
src/components/project/dto/project.dto.ts Wrapped multi-line comment in parentheses for @Disabled decorator usage on engagementTotal field.
src/core/database/common.repository.ts,
src/core/database/dto.repository.ts
Replaced usage of getDbPropertyUnique with DbUnique.get for retrieving unique property labels.
src/core/database/query-augmentation/pattern-formatting.ts Minor comment correction and removal of TypeScript expect-error directive; no functional changes.
src/core/database/query/sorting.ts Replaced getDbSortTransformer usage with DbSort.get for transformer retrieval.
test/region.e2e-spec.ts Moved newDirector variable declaration into specific test case; adjusted director reference in zone update test.

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cbc6303 and 6fac407.

📒 Files selected for processing (10)
  • src/common/db-sort.decorator.ts (2 hunks)
  • src/common/db-unique.decorator.ts (1 hunks)
  • src/components/admin/admin.gel.repository.ts (1 hunks)
  • src/components/authorization/policy/executor/all-permissions-view.ts (1 hunks)
  • src/components/budget/handlers/update-project-current-budget-status.handler.ts (1 hunks)
  • src/components/partnership/partnership.gel.repository.ts (2 hunks)
  • src/core/database/common.repository.ts (2 hunks)
  • src/core/database/dto.repository.ts (2 hunks)
  • src/core/database/query/sorting.ts (2 hunks)
  • test/region.e2e-spec.ts (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (10)
  • src/core/database/query/sorting.ts
  • src/components/budget/handlers/update-project-current-budget-status.handler.ts
  • src/components/admin/admin.gel.repository.ts
  • src/core/database/dto.repository.ts
  • src/components/authorization/policy/executor/all-permissions-view.ts
  • src/components/partnership/partnership.gel.repository.ts
  • src/core/database/common.repository.ts
  • test/region.e2e-spec.ts
  • src/common/db-unique.decorator.ts
  • src/common/db-sort.decorator.ts
⏰ Context from checks skipped due to timeout of 90000ms (12)
  • GitHub Check: E2E Tests (neo4j 6/6)
  • GitHub Check: E2E Tests (neo4j 5/6)
  • GitHub Check: E2E Tests (neo4j 4/6)
  • GitHub Check: E2E Tests (neo4j 3/6)
  • GitHub Check: E2E Tests (neo4j 2/6)
  • GitHub Check: Generate (head)
  • GitHub Check: E2E Tests (neo4j 1/6)
  • GitHub Check: Generate (base)
  • GitHub Check: lint
  • GitHub Check: Clean
  • GitHub Check: Unit
  • GitHub Check: Analyze (javascript)
✨ Finishing Touches
  • 📝 Generate Docstrings

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
🪧 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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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 generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this 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: 0

🧹 Nitpick comments (1)
src/components/partnership/partnership.gel.repository.ts (1)

40-51: Simplified query with tuple membership filtering

The implementation has been improved to use a single e.select query with tuple membership filtering instead of multiple selects in a loop.

Consider expanding on the TODO comment to explain why this implementation is logically equivalent to the previous one, or add a test case to verify the behavior remains the same.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0d71a8b and cbc6303.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (15)
  • package.json (2 hunks)
  • src/common/db-sort.decorator.ts (2 hunks)
  • src/common/db-unique.decorator.ts (1 hunks)
  • src/common/disabled.decorator.ts (1 hunks)
  • src/components/admin/admin.gel.repository.ts (1 hunks)
  • src/components/authorization/policy/executor/all-permissions-view.ts (1 hunks)
  • src/components/budget/handlers/update-project-current-budget-status.handler.ts (1 hunks)
  • src/components/engagement/engagement.gel.repository.ts (1 hunks)
  • src/components/partnership/partnership.gel.repository.ts (2 hunks)
  • src/components/project/dto/project.dto.ts (1 hunks)
  • src/core/database/common.repository.ts (2 hunks)
  • src/core/database/dto.repository.ts (2 hunks)
  • src/core/database/query-augmentation/pattern-formatting.ts (1 hunks)
  • src/core/database/query/sorting.ts (2 hunks)
  • test/region.e2e-spec.ts (2 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (3)
test/region.e2e-spec.ts (1)
src/components/user/user.resolver.ts (1)
  • createPerson (221-232)
src/core/database/query/sorting.ts (2)
src/common/db-sort.decorator.ts (1)
  • DbSort (11-14)
src/common/index.ts (1)
  • DbSort (13-13)
src/components/project/dto/project.dto.ts (1)
src/common/disabled.decorator.ts (1)
  • Disabled (8-12)
⏰ Context from checks skipped due to timeout of 90000ms (12)
  • GitHub Check: E2E Tests (neo4j 6/6)
  • GitHub Check: E2E Tests (neo4j 5/6)
  • GitHub Check: E2E Tests (neo4j 4/6)
  • GitHub Check: Analyze (javascript)
  • GitHub Check: E2E Tests (neo4j 3/6)
  • GitHub Check: E2E Tests (neo4j 2/6)
  • GitHub Check: Generate (head)
  • GitHub Check: E2E Tests (neo4j 1/6)
  • GitHub Check: Generate (base)
  • GitHub Check: Clean
  • GitHub Check: Unit
  • GitHub Check: lint
🔇 Additional comments (24)
package.json (1)

151-151: TypeScript version upgrade.

The TypeScript version has been upgraded from 5.2 to 5.8.3, with a corresponding update to the NestJS CLI TypeScript resolution. This aligns with the PR objective and supports the code changes in other files.

Also applies to: 161-161

src/components/budget/handlers/update-project-current-budget-status.handler.ts (1)

44-44: Removed unnecessary non-null assertion.

The ! operator has been removed as it's no longer needed - TypeScript's control flow analysis can determine that change is not null at this point because of the explicit check at line 31.

src/components/authorization/policy/executor/all-permissions-view.ts (1)

56-56: Type assertion added to handle complex dynamic typing.

The as any type assertion was added to help TypeScript handle the complex dynamic typing in this section. This aligns with the existing comment at line 50 about "dynamic usage here is struggling" and makes the code compatible with TypeScript 5.8's stricter type checking.

src/core/database/query-augmentation/pattern-formatting.ts (1)

23-23: Grammar correction in comment.

The comment was updated to correct a minor grammatical issue, changing "there's" to "there is".

src/common/disabled.decorator.ts (1)

8-12: Streamlined decorator signature looks good!

The simplified signature no longer uses generic type parameters and explicit decorator type constraints, which makes the code cleaner while maintaining the core no-op functionality.

src/components/project/dto/project.dto.ts (1)

200-205: Updated decorator usage correctly

The @Disabled decorator usage now properly matches the updated signature from disabled.decorator.ts, which requires a string reason parameter to be passed with parentheses.

src/components/partnership/partnership.gel.repository.ts (1)

18-19: Standardized to e.select instead of tuples

Changing from tuples to select objects is consistent with the broader structural updates across repositories.

Also applies to: 23-24

src/components/engagement/engagement.gel.repository.ts (1)

28-29: Consistent structure updates using e.select

The change from tuples to select objects for the parent field and its nested properties aligns with the same pattern applied in the partnership repository, maintaining consistency.

Also applies to: 31-32

src/components/admin/admin.gel.repository.ts (1)

32-33: Improved query filtering syntax

The change from .is() method to e.op() for equality filtering makes the query construction more explicit and consistent with modern EdgeDB patterns.

src/core/database/dto.repository.ts (2)

6-6: Updated import to use the decorator object directly

This change aligns with the PR's decorator refactoring pattern, replacing standalone functions with decorator objects that expose static methods.


69-69: Refactored metadata access pattern

The change from getDbPropertyUnique() to DbUnique.get() is consistent with the refactoring of decorators to use a shared metadata decorator implementation.

src/core/database/common.repository.ts (2)

6-6: Updated import to use the decorator object directly

This change aligns with the PR's decorator refactoring pattern, replacing standalone functions with decorator objects that expose static methods.


178-178: Refactored metadata access pattern

The change from getDbPropertyUnique() to DbUnique.get() is consistent with the refactoring of decorators to use a shared metadata decorator implementation.

src/core/database/query/sorting.ts (2)

6-6: Updated import to use the decorator object directly

This change aligns with the PR's decorator refactoring pattern, replacing standalone functions with decorator objects that expose static methods.


128-128: Refactored metadata access pattern

The change from getDbSortTransformer() to DbSort.get() is consistent with the refactoring of decorators to use a shared metadata decorator implementation.

test/region.e2e-spec.ts (2)

163-165: Fixed reference to correct director object

Good correction to use director.id instead of what was likely newDirector.id previously. This ensures the test is using the director variable declared at the top level of the test suite, improving test consistency.


204-207: Improved variable scoping by moving declaration

Great improvement to move the newDirector creation inside this specific test case rather than declaring it at the top level of the test suite. This follows best practices for test isolation by keeping variables scoped to the tests that actually use them.

src/common/db-sort.decorator.ts (2)

1-1: Clean import of decorator utility

Good addition of the createMetadataDecorator import to support the refactored implementation.


11-14: Successfully refactored to use standardized decorator pattern

The refactoring of DbSort to use createMetadataDecorator is a great improvement that:

  1. Simplifies the implementation by removing manual metadata handling
  2. Provides a consistent pattern with other decorators
  3. Eliminates the need for a separate metadata retrieval function

The configuration correctly specifies that this works on properties and the setter correctly handles the SortTransformer function.

src/common/db-unique.decorator.ts (5)

1-1: Clean import of decorator utility

Good addition of the createMetadataDecorator import to support the refactored implementation.


6-7: Improved documentation clarity

The updated documentation more clearly explains the purpose of the decorator.


10-14: Well-structured refactoring of the decorator implementation

Good implementation that preserves the original functionality while leveraging the new utility. The decorator still:

  1. Accepts an optional label parameter
  2. Generates a default label based on class and property name if not provided
  3. Applies both the unique constraint and the label decorator

16-19: Clean implementation of inner decorator using utility

Well-structured implementation of the inner decorator using createMetadataDecorator. The configuration properly specifies it works on properties and the setter correctly handles the label value.


21-21: Good API compatibility with static getter

Smart approach to maintain API compatibility by exposing the inner decorator's get method as DbUnique.get. This ensures that code using the previous standalone getDbPropertyUnique function can be easily updated to use DbUnique.get instead.

@CarsonF CarsonF merged commit b47812d into develop May 2, 2025
18 checks passed
@CarsonF CarsonF deleted the ts-5.8 branch May 2, 2025 16:14
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