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

feat: deepPartial #329

Merged
merged 2 commits into from
Mar 2, 2024
Merged

feat: deepPartial #329

merged 2 commits into from
Mar 2, 2024

Conversation

cgilbe27
Copy link
Contributor

@cgilbe27 cgilbe27 commented Mar 2, 2024

Following was not possible
image

Summary by CodeRabbit

  • Refactor
    • Enhanced type specificity and deep partial object structures for GraphQL queries and mutations, improving data handling flexibility and accuracy.
  • New Features
    • Added type utilities for optional types and deep partial objects, enhancing code development robustness.

Copy link
Contributor

coderabbitai bot commented Mar 2, 2024

Walkthrough

The recent updates across various GraphQL files primarily focus on enhancing type specificity and flexibility. By transitioning from Partial to DeepPartial in numerous instances, the changes allow for a more nuanced handling of nested object structures. This shift ensures that the system can now accommodate deeper levels of partial objects, enhancing the robustness and adaptability of the GraphQL schema and its associated operations.

Changes

Files Change Summary
src/gql/.../heart-monitor.ts, src/gql/.../marketing.ts, src/gql/.../communityPool.ts, src/gql/.../delegations.ts, src/gql/.../distributionCommissions.ts, src/gql/.../featureFlags.ts, src/gql/.../governance.ts, src/gql/.../ibc.ts, src/gql/.../inflation.ts, src/gql/.../markPriceCandles.ts, src/gql/.../oracle.ts, src/gql/.../perp.ts, src/gql/.../redelegations.ts, src/gql/.../spotLpPositions.ts, src/gql/.../spotPoolCreated.ts, src/gql/.../spotPoolExited.ts, src/gql/.../spotPoolJoined.ts, src/gql/.../spotPoolSwap.ts, src/gql/.../spotPools.ts, src/gql/.../stats.ts, src/gql/.../unbondings.ts, src/gql/.../users.ts, src/gql/.../validators.ts, src/gql/.../wasm.ts, src/gql/.../markPriceCandlesSubscription.ts, src/gql/.../oraclePricesSubscription.ts, src/gql/.../perpMarketSubscription.ts, src/gql/.../perpPositionsSubscription.ts Updated types from Partial to DeepPartial for enhanced specificity and flexibility in handling nested partial objects.
src/gql/utils/consts.ts Introduced new type utilities for DeepPartial and optional types, enhancing type handling capabilities without direct impact on existing functions.

Poem

In the land of code so vast and wide,
A change did stir, from deep inside.
🐇 With hops and leaps, through fields of types,
The rabbit danced, beneath the moonlit nights.

"To DeepPartial we go, a leap so bold,
Ensuring our objects, in depth, can hold."
With joy and pride, the rabbit cried,
"In our typed world, we now stride with pride!"

🌟🐰🎉

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

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>.
    • Generate unit-tests for this file.
  • 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 tests 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 generate interesting stats about this repository from git and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

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 as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • 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/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

@cgilbe27 cgilbe27 self-assigned this Mar 2, 2024
@cgilbe27 cgilbe27 requested a review from CalicoNino March 2, 2024 21:49
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.

Review Status

Actionable comments generated: 1

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between c3ed699 and 239860a.
Files selected for processing (30)
  • src/gql/heart-monitor/heart-monitor.ts (4 hunks)
  • src/gql/mutation/marketing.ts (2 hunks)
  • src/gql/query/communityPool.ts (2 hunks)
  • src/gql/query/delegations.ts (3 hunks)
  • src/gql/query/distributionCommissions.ts (3 hunks)
  • src/gql/query/featureFlags.ts (3 hunks)
  • src/gql/query/governance.ts (2 hunks)
  • src/gql/query/ibc.ts (2 hunks)
  • src/gql/query/inflation.ts (2 hunks)
  • src/gql/query/markPriceCandles.ts (3 hunks)
  • src/gql/query/marketing.ts (2 hunks)
  • src/gql/query/oracle.ts (2 hunks)
  • src/gql/query/perp.ts (2 hunks)
  • src/gql/query/redelegations.ts (3 hunks)
  • src/gql/query/spotLpPositions.ts (3 hunks)
  • src/gql/query/spotPoolCreated.ts (3 hunks)
  • src/gql/query/spotPoolExited.ts (3 hunks)
  • src/gql/query/spotPoolJoined.ts (3 hunks)
  • src/gql/query/spotPoolSwap.ts (3 hunks)
  • src/gql/query/spotPools.ts (3 hunks)
  • src/gql/query/stats.ts (2 hunks)
  • src/gql/query/unbondings.ts (3 hunks)
  • src/gql/query/users.ts (3 hunks)
  • src/gql/query/validators.ts (3 hunks)
  • src/gql/query/wasm.ts (2 hunks)
  • src/gql/subscription/markPriceCandlesSubscription.ts (2 hunks)
  • src/gql/subscription/oraclePricesSubscription.ts (3 hunks)
  • src/gql/subscription/perpMarketSubscription.ts (2 hunks)
  • src/gql/subscription/perpPositionsSubscription.ts (2 hunks)
  • src/gql/utils/consts.ts (1 hunks)
Additional comments: 26
src/gql/query/featureFlags.ts (3)
  • 8-8: The import of DeepPartial is correctly added to support the enhanced type specificity for nested object structures. This aligns with the PR's objective to transition from Partial to DeepPartial for improved type safety.
  • 17-17: The update of the fields parameter type to DeepPartial<GQLFeatureFlags> in the featureFlagsQueryString function is appropriate. It allows for more detailed type checking of nested structures, which is beneficial for the robustness of the application's type system.
  • 30-30: Similarly, the update of the fields parameter type to DeepPartial<GQLFeatureFlags> in the featureFlags function is consistent with the PR's objectives and enhances type safety for nested object structures.
src/gql/query/distributionCommissions.ts (3)
  • 10-10: The import of DeepPartial is correctly added to support the enhanced typing system for nested object structures. This aligns with the PR's objective to replace Partial with DeepPartial.
  • 20-20: The change from Partial<GQLDistributionCommission> to DeepPartial<GQLDistributionCommission> for the fields parameter in distributionCommissionsQueryString function is correctly implemented. This allows for more detailed and flexible type definitions, especially for nested object structures.
  • 40-40: Similarly, the update to DeepPartial<GQLDistributionCommission> for the fields parameter in the distributionCommissions async function is correctly applied. This modification enhances the typing system's robustness and specificity, aligning with the PR's objectives.
src/gql/query/wasm.ts (2)
  • 9-9: The import of DeepPartial is correctly added, supporting the transition to a more detailed and flexible typing system for nested object structures within the wasm.ts file.
  • 20-21: The update to use DeepPartial for GqlWasmFields and within it for userContracts is correctly implemented. This change enhances the type specificity and flexibility for handling nested object structures, aligning with the PR's objectives.
src/gql/query/oracle.ts (2)
  • 12-12: The import of DeepPartial is correctly added, supporting the transition to a more detailed and flexible typing system for nested object structures within the oracle.ts file.
  • 24-26: The update to use DeepPartial for OracleFields and within it for oraclePrices and oracles is correctly implemented. This change enhances the type specificity and flexibility for handling nested object structures, aligning with the PR's objectives.
src/gql/query/inflation.ts (2)
  • 12-12: The import of DeepPartial is correctly added, supporting the transition to a more detailed and flexible typing system for nested object structures within the inflation.ts file.
  • 24-26: The update to use DeepPartial for InflationFields and within it for distributions and inflations is correctly implemented. This change enhances the type specificity and flexibility for handling nested object structures, aligning with the PR's objectives.
src/gql/query/ibc.ts (2)
  • 11-11: The import of DeepPartial is correctly added, supporting the transition to a more detailed and flexible typing system for nested object structures within the ibc.ts file.
  • 23-25: The update to use DeepPartial for IbcFields and within it for ibcChannels and ibcTransfers is correctly implemented. This change enhances the type specificity and flexibility for handling nested object structures, aligning with the PR's objectives.
src/gql/query/governance.ts (2)
  • 13-13: The import of DeepPartial is correctly added, supporting the transition to a more detailed and flexible typing system for nested object structures within the governance.ts file.
  • 26-29: The update to use DeepPartial for GovernanceFields and within it for govDeposits, govProposals, and govVotes is correctly implemented. This change enhances the type specificity and flexibility for handling nested object structures, aligning with the PR's objectives.
src/gql/query/marketing.ts (3)
  • 3-3: The import of DeepPartial is correctly added, supporting the transition to a more detailed and flexible typing system for nested object structures within the marketing.ts file.
  • 22-25: The update in QueryMarketingArgs to use non-partial types for twitterUser, tweets, likes, and tasks fields is noted. This change is not directly related to the use of DeepPartial but is part of enhancing the type system's specificity and flexibility.
  • 32-36: The update to use DeepPartial for MarketingFields and within it for twitterUser, tweets, likes, and tasks is correctly implemented. This change enhances the type specificity and flexibility for handling nested object structures, aligning with the PR's objectives.
src/gql/query/perp.ts (2)
  • 20-20: The import of DeepPartial is correctly added, supporting the transition to a more detailed and flexible typing system for nested object structures within the perp.ts file.
  • 36-42: The update to use DeepPartial for GQLPerpFields and its properties is correctly implemented. This change enhances the type specificity and flexibility for handling nested object structures, aligning with the PR's objectives.
src/gql/query/stats.ts (2)
  • 27-27: The import of DeepPartial is correctly added, supporting the transition to a more detailed and flexible typing system for nested object structures within the stats.ts file.
  • 44-51: The update to use DeepPartial for GQLStatsFields and its properties is correctly implemented. This change enhances the type specificity and flexibility for handling nested object structures, aligning with the PR's objectives.
src/gql/utils/consts.ts (1)
  • 20-40: The DeepPartial<T> type is a powerful utility for creating deep partial objects, allowing for more flexible and detailed type definitions, especially for nested structures. This change aligns well with the PR's objective of enhancing type safety and flexibility.

Ensure that the implementation of DeepPartial<T> is thoroughly tested, particularly for deeply nested structures, to confirm its behavior aligns with expectations.

src/gql/heart-monitor/heart-monitor.ts (2)
  • 120-208: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [123-266]

The update to use DeepPartial for fields in methods of the IHeartMonitor interface is a significant improvement in type specificity, especially for nested object structures. This change enhances the flexibility and robustness of the type system within the application.

Ensure that all consuming code that interacts with these methods is updated accordingly to handle the DeepPartial type correctly.

  • 305-432: Similar to the IHeartMonitor interface, the HeartMonitor class methods have been updated to use DeepPartial for fields. This consistency between the interface and the class implementation is crucial for maintaining type safety and flexibility across the application.

It's important to verify that the actual implementations of these methods correctly handle the DeepPartial type, especially when dealing with nested structures. Consider adding or updating unit tests to cover these scenarios.

src/gql/utils/consts.ts Show resolved Hide resolved
Copy link

github-actions bot commented Mar 2, 2024

Lines Statements Branches Functions
Coverage: 89%
91.2% (1265/1387) 86.28% (541/627) 78.28% (310/396)

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.

Review Status

Actionable comments generated: 1

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 239860a and 2ca4795.
Files selected for processing (1)
  • .github/workflows/test-ts-sdk.yaml (1 hunks)

.github/workflows/test-ts-sdk.yaml Show resolved Hide resolved
@cgilbe27 cgilbe27 merged commit 89f2504 into develop Mar 2, 2024
3 checks passed
@cgilbe27 cgilbe27 deleted the feat/deep-partial branch March 2, 2024 22:31
cgilbe27 added a commit that referenced this pull request Mar 5, 2024
* feat: deepPartial (#329)

* feat: deepPartial

* fix: rem gate

* fix: fix barrel

* docs(gql): add JSDoc comment for DeepPartial

---------

Co-authored-by: Calico Nino <54007257+CalicoNino@users.noreply.github.com>
Co-authored-by: Unique Divine <realuniquedivine@gmail.com>
nibibot pushed a commit that referenced this pull request Mar 5, 2024
## [3.2.0](v3.1.1...v3.2.0) (2024-03-05)

### Features

* deepPartial ([#329](#329)) ([#330](#330)) ([f2bb64d](f2bb64d))

 [skip ci]
nibibot pushed a commit that referenced this pull request Mar 6, 2024
## [3.3.0](v3.2.0...v3.3.0) (2024-03-06)

### Features

* deepPartial ([#329](#329)) ([89f2504](89f2504))
* marketing mutation + query ([#331](#331)) ([61c7fe8](61c7fe8))

### Bug Fixes

* fix barrel ([599041f](599041f))
* merge ([4e1144d](4e1144d))

### Documentation

* **gql:** add JSDoc comment for DeepPartial ([26176e3](26176e3))

 [skip ci]
@nibibot
Copy link

nibibot commented Mar 6, 2024

🎉 This PR is included in version 3.3.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants