Skip to content

fix: export pixDynamicPayload types and update PIXRecPayload structure #36

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 2 commits into from
May 30, 2025

Conversation

jonashger
Copy link
Collaborator

@jonashger jonashger commented May 30, 2025

Export PIX Dynamic Payload Types and Update PIXRecPayload Structure

Changes

  • Added export of pixDynamicPayload types in src/index.ts
  • Updated PIXRecPayload structure in src/types/pixDynamicPayload.ts:
    • Made valorRec field optional in the valor object

Description

This PR addresses the need to expose the Pix dynamic payload types to consumers of the library and improves the type structure for recurring PIX payments by making the valorRec field optional, allowing for more flexible payment configurations.

Technical Details

  • Added export * from './types/pixDynamicPayload'; to src/index.ts
  • Modified PIXRecPayload type to make valorRec optional: readonly valorRec?: string

Summary by CodeRabbit

  • New Features

    • Expanded the public API to include additional types related to dynamic payloads.
  • Bug Fixes

    • Made a property in the dynamic payload type optional, allowing for more flexible usage.
  • Chores

    • Updated test imports to remove unused items, with no impact on test behavior.

Copy link

coderabbitai bot commented May 30, 2025

Walkthrough

This update expands the package's public API by re-exporting all entities from pixDynamicPayload, modifies the PIXRecPayload type to make the valorRec property optional within the valor object, and adjusts a test file's import statements to remove an unused import.

Changes

File(s) Change Summary
src/index.ts Added export to re-export all entities from ./types/pixDynamicPayload.
src/types/pixDynamicPayload.ts Made the valorRec property in the valor object of PIXRecPayload type optional.
tests/extractor.test.ts Removed the import of isRecurrencePix from ../src/validate; no other code changes.

Possibly related PRs

Suggested labels

released

Poem

A hop and a skip, a type takes a leap,
valorRec is now optional—no need to weep!
The exports grow wide, the API’s new delight,
While tests trim the fat in the soft morning light.
🐇✨
Code changes abound, let’s celebrate tonight!


📜 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 9a2ecc3 and 057ea3f.

📒 Files selected for processing (3)
  • src/index.ts (1 hunks)
  • src/types/pixDynamicPayload.ts (1 hunks)
  • tests/extractor.test.ts (1 hunks)
🔇 Additional comments (3)
src/types/pixDynamicPayload.ts (1)

148-148: LGTM! Good improvement to type flexibility.

Making the valorRec field optional enhances the flexibility of recurring PIX payment configurations, allowing consumers to specify payment amounts more granularly. This change aligns well with the PR objectives and maintains backward compatibility.

tests/extractor.test.ts (1)

3-3:

✅ Verification successful

Verify no remaining usage of isRecurrencePix in the codebase.

The removal of the unused import is good cleanup. However, please ensure that isRecurrencePix is not used elsewhere in the test suite or codebase where it might now be missing.


🏁 Script executed:

#!/bin/bash
# Search for any remaining usage of isRecurrencePix in the codebase
rg "isRecurrencePix" --type ts --type js -A 2 -B 2

Length of output: 414


Verification Complete: Removal of isRecurrencePix Import Is Safe

Ran a repository-wide search for isRecurrencePix and found only its definition in src/validate.ts and its re-export in src/index.ts. There are no usages elsewhere—including in tests—so removing it from tests/extractor.test.ts will not break anything.

• No remaining references in the test suite or application code
• Import cleanup in tests/extractor.test.ts is approved

(Optional) You may wish to remove or deprecate the unused isRecurrencePix export in src/index.ts if it’s no longer needed.

src/index.ts (1)

15-15: LGTM! Properly exposes pixDynamicPayload types to consumers.

The addition of this export statement correctly implements the PR objective by making the pixDynamicPayload types accessible to library consumers. The pattern follows the existing export structure and won't introduce breaking changes.

✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

@thalesog thalesog merged commit 8316595 into thalesog:master May 30, 2025
5 of 6 checks passed
thalesog pushed a commit that referenced this pull request May 30, 2025
## [2.8.1](v2.8.0...v2.8.1) (2025-05-30)

### Bug Fixes

* export pixDynamicPayload types and update PIXRecPayload structure ([#36](#36)) ([8316595](8316595))
@thalesog
Copy link
Owner

🎉 This issue has been resolved in version 2.8.1 🎉

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.

2 participants