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(documents): add schemas for financial information and proof of o… #2844

Merged
merged 2 commits into from
Nov 27, 2024

Conversation

alonp99
Copy link
Collaborator

@alonp99 alonp99 commented Nov 17, 2024

…wnership

  • Introduce bank statement schema with optional fields
  • Add company structure schema with relevant properties

(These schemas are so well-defined, they could teach classes on clarity)

Summary by CodeRabbit

  • New Features
    • Introduced two new document types:
      • bank_statement for financial information.
      • company_structure for proof of ownership.
  • Improvements
    • Enhanced clarity on commit message length limits, including humorous content.
  • Version Updates
    • Incremented versions for multiple packages and dependencies across the project, including @ballerine/common, @ballerine/workflow-core, and others, ensuring compatibility and access to the latest features and fixes.

Copy link

changeset-bot bot commented Nov 17, 2024

⚠️ No Changeset found

Latest commit: d4f1d58

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Contributor

coderabbitai bot commented Nov 17, 2024

Caution

Review failed

The pull request is closed.

Walkthrough

This pull request introduces two new document types to the getUniversalDocuments function in the ZZ.ts file, specifically bank_statement and company_structure, each with defined properties. Additionally, it modifies the generateCommitMessage function in scripts/auto-commit.js to clarify the character limit for commit message bodies and humorous roasts. These changes enhance the document schema and improve commit message generation clarity.

Changes

File Path Change Summary
packages/common/src/schemas/documents/workflow/documents/schemas/ZZ.ts Added bank_statement and company_structure document types with specified properties.
scripts/auto-commit.js Updated generateCommitMessage function to clarify body line length limit, including the roast length specification.
apps/backoffice-v2/CHANGELOG.md Updated changelog to include version 0.7.75 and dependency updates.
apps/backoffice-v2/package.json Updated project version to 0.7.75 and dependencies to latest versions.
apps/kyb-app/CHANGELOG.md Updated changelog to include version 0.3.86 and dependency updates.
apps/kyb-app/package.json Updated project version to 0.3.86 and dependencies to latest versions.
examples/headless-example/CHANGELOG.md Updated changelog to include version 0.3.70 and dependency updates.
examples/headless-example/package.json Updated project version to 0.3.70 and dependencies to latest versions.
packages/common/CHANGELOG.md Updated changelog to include version 0.9.54 with a simple note stating "bump."
packages/common/package.json Updated version to 0.9.54.
packages/workflow-core/CHANGELOG.md Updated changelog to include version 0.6.71 and dependency updates.
packages/workflow-core/package.json Updated project version to 0.6.71 and dependencies to latest versions.
sdks/web-ui-sdk/CHANGELOG.md Updated changelog to include version 1.5.55 and dependency updates.
sdks/web-ui-sdk/package.json Updated project version to 1.5.55 and dependencies to latest versions.
sdks/workflow-browser-sdk/CHANGELOG.md Updated changelog to include version 0.6.71 and dependency updates.
sdks/workflow-browser-sdk/package.json Updated project version to 0.6.71 and dependencies to latest versions.
sdks/workflow-node-sdk/CHANGELOG.md Updated changelog to include version 0.6.71 and dependency updates.
sdks/workflow-node-sdk/package.json Updated project version to 0.6.71 and dependencies to latest versions.
services/workflows-service/CHANGELOG.md Updated changelog to include version 0.7.75 and dependency updates.
services/workflows-service/package.json Updated project version to 0.7.75 and dependencies to latest versions.
services/workflows-service/prisma/data-migrations Updated subproject commit reference.
websites/docs/package.json Updated @ballerine/common dependency version to ^0.9.54.

Possibly related PRs

Suggested reviewers

  • Tomer Shvadron
  • Blokh

🐇 In the land of code where rabbits play,
New types of documents hop in today.
Bank statements and structures, oh what a sight,
With roasts in our commits, we code with delight!
Hopping through schemas, we leap and we bound,
In the world of coding, new treasures are found! 🐇✨

Warning

Rate limit exceeded

@alonp99 has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 11 minutes and 18 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 4945dcf and d4f1d58.


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

Actionable comments posted: 4

🧹 Outside diff range and nitpick comments (11)
sdks/workflow-browser-sdk/package.json (1)

Update vite dependency to version 5.4.11 to address security vulnerabilities

The current version (4.5.3) is outdated and potentially vulnerable. The latest stable version is 5.4.11 which includes security patches for:

  • DOM Clobbering vulnerabilities that could lead to XSS
  • Server filesystem access bypass vulnerabilities when using ?import&raw

Please update the dependency version in package.json to:

"vite": "^5.4.11"
🔗 Analysis chain

Line range hint 82-82: Verify vite dependency version for security advisories.

Let's verify if the current vite version (4.5.3) is the latest secure version.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for security advisories and latest versions of vite

# Check npm for latest versions
curl -s https://registry.npmjs.org/vite | jq '.["dist-tags"]'

# Check for security advisories
gh api graphql -f query='
{
  securityVulnerabilities(first: 5, ecosystem: NPM, package: "vite") {
    nodes {
      advisory {
        summary
        severity
        publishedAt
      }
      vulnerableVersionRange
      firstPatchedVersion {
        identifier
      }
    }
  }
}'

Length of output: 1759

services/websocket-service/CHANGELOG.md (1)

Line range hint 9-13: Fix typo in version 0.1.24 entry

The word "Cump" appears to be a typo and should be "Bump" to maintain consistency with other entries.

 ## 0.1.24

 ### Patch Changes

-  Cump
+  Bump
examples/report-generation-example/CHANGELOG.md (1)

3-10: Consider establishing better versioning practices

The changelog history shows very frequent patch version increments with minimal description. This pattern might indicate:

  1. Too frequent releases without meaningful changes
  2. Tight coupling between packages requiring constant version synchronization
  3. Missing automation for dependency updates

Consider:

  • Batching multiple dependency updates into single releases
  • Using automated dependency update tools (e.g., Dependabot)
  • Implementing proper semantic versioning practices
packages/react-pdf-toolkit/CHANGELOG.md (1)

7-7: Consider adding more descriptive changelog messages.

The message "Bump" is not very informative. Consider describing what motivated these dependency updates or what benefits they bring. This helps other developers understand the purpose of the changes.

Example of a more descriptive message:

-Bump
+Updated dependencies to maintain compatibility with latest financial information schemas
apps/backoffice-v2/package.json (1)

Line range hint 200-203: Update peer dependencies to match the project's React version

The peer dependencies specify React 17, but the project is using React 18 (as seen in the dependencies section). This mismatch should be addressed to prevent potential compatibility issues.

Apply this diff to update the peer dependencies:

  "peerDependencies": {
-   "react": "^17.0.0",
-   "react-dom": "^17.0.0"
+   "react": "^18.0.0",
+   "react-dom": "^18.0.0"
  }
packages/blocks/CHANGELOG.md (1)

Line range hint 13-16: Minor typo in the previous version entry

There appears to be a typo in the word "Cump" which should be "Bump" to maintain consistency with other entries.

-Cump
+Bump
packages/workflow-core/CHANGELOG.md (1)

7-7: Enhance the changelog description.

The current description "Bump" is too vague. Consider adding more context about what was updated and why.

-Bump
+Updated @ballerine/common dependency to incorporate latest changes
examples/headless-example/CHANGELOG.md (1)

7-7: Improve changelog message clarity

The message "Bump" is not descriptive and doesn't provide any meaningful information about the changes. This makes it difficult for users to understand what has changed in this version.

Consider using more descriptive messages that explain the purpose of the changes, even for minor updates. For example:

  • "Updated dependencies to latest versions for security and stability"
  • "Maintenance release: dependency updates"
sdks/workflow-browser-sdk/CHANGELOG.md (2)

7-7: Consider using more descriptive change messages.

The message "Bump" doesn't effectively communicate the nature of changes. Consider describing what was actually changed or why the version was bumped.

Example of a better message:

-Bump
+Updated dependencies to latest versions for security and compatibility

3-10: LGTM! Changelog structure is consistent.

The version entry follows the established format with clear separation of patch changes and dependency updates.

For future changelog maintenance:

  1. Use descriptive messages that explain the reason for changes
  2. Include any breaking changes or deprecations prominently
  3. Reference relevant issue or PR numbers when applicable
services/workflows-service/CHANGELOG.md (1)

7-7: Enhance the changelog description.

The description "Bump" is too vague. Consider providing more meaningful information about the changes, such as the reason for the dependency updates or any notable changes they bring.

Apply this diff to improve the description:

-### Patch Changes
-
-- Bump
+### Patch Changes
+
+- Updated dependencies to latest versions to incorporate recent fixes and improvements
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between c67a596 and 513eb4c.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (40)
  • apps/backoffice-v2/CHANGELOG.md (1 hunks)
  • apps/backoffice-v2/package.json (3 hunks)
  • apps/kyb-app/CHANGELOG.md (1 hunks)
  • apps/kyb-app/package.json (3 hunks)
  • apps/workflows-dashboard/CHANGELOG.md (1 hunks)
  • apps/workflows-dashboard/package.json (3 hunks)
  • examples/headless-example/CHANGELOG.md (1 hunks)
  • examples/headless-example/package.json (2 hunks)
  • examples/report-generation-example/CHANGELOG.md (1 hunks)
  • examples/report-generation-example/package.json (2 hunks)
  • packages/blocks/CHANGELOG.md (1 hunks)
  • packages/blocks/package.json (3 hunks)
  • packages/common/CHANGELOG.md (1 hunks)
  • packages/common/package.json (2 hunks)
  • packages/common/src/schemas/documents/workflow/documents/schemas/ZZ.ts (2 hunks)
  • packages/config/CHANGELOG.md (1 hunks)
  • packages/config/package.json (1 hunks)
  • packages/eslint-config-react/CHANGELOG.md (1 hunks)
  • packages/eslint-config-react/package.json (2 hunks)
  • packages/eslint-config/CHANGELOG.md (1 hunks)
  • packages/eslint-config/package.json (1 hunks)
  • packages/react-pdf-toolkit/CHANGELOG.md (1 hunks)
  • packages/react-pdf-toolkit/package.json (2 hunks)
  • packages/rules-engine/CHANGELOG.md (1 hunks)
  • packages/rules-engine/package.json (2 hunks)
  • packages/ui/CHANGELOG.md (1 hunks)
  • packages/ui/package.json (3 hunks)
  • packages/workflow-core/CHANGELOG.md (1 hunks)
  • packages/workflow-core/package.json (3 hunks)
  • sdks/web-ui-sdk/CHANGELOG.md (1 hunks)
  • sdks/web-ui-sdk/package.json (2 hunks)
  • sdks/workflow-browser-sdk/CHANGELOG.md (1 hunks)
  • sdks/workflow-browser-sdk/package.json (2 hunks)
  • sdks/workflow-node-sdk/CHANGELOG.md (1 hunks)
  • sdks/workflow-node-sdk/package.json (2 hunks)
  • services/websocket-service/CHANGELOG.md (1 hunks)
  • services/websocket-service/package.json (1 hunks)
  • services/workflows-service/CHANGELOG.md (1 hunks)
  • services/workflows-service/package.json (3 hunks)
  • websites/docs/package.json (1 hunks)
✅ Files skipped from review due to trivial changes (24)
  • apps/backoffice-v2/CHANGELOG.md
  • apps/kyb-app/CHANGELOG.md
  • apps/workflows-dashboard/CHANGELOG.md
  • apps/workflows-dashboard/package.json
  • examples/headless-example/package.json
  • examples/report-generation-example/package.json
  • packages/common/CHANGELOG.md
  • packages/common/package.json
  • packages/config/CHANGELOG.md
  • packages/config/package.json
  • packages/eslint-config-react/CHANGELOG.md
  • packages/eslint-config-react/package.json
  • packages/eslint-config/CHANGELOG.md
  • packages/eslint-config/package.json
  • packages/react-pdf-toolkit/package.json
  • packages/rules-engine/CHANGELOG.md
  • packages/rules-engine/package.json
  • packages/ui/CHANGELOG.md
  • packages/ui/package.json
  • sdks/web-ui-sdk/CHANGELOG.md
  • sdks/workflow-node-sdk/CHANGELOG.md
  • sdks/workflow-node-sdk/package.json
  • services/websocket-service/package.json
  • services/workflows-service/package.json
🔇 Additional comments (15)
websites/docs/package.json (1)

20-20: Verify version consistency across the monorepo

The dependency updates look correct, but let's verify that these versions are consistent across all packages in the monorepo.

Also applies to: 26-27

✅ Verification successful

Dependency versions are consistent across the monorepo

The verification shows that all packages are using consistent versions:

  • @ballerine/common: 0.9.52 (with some using ^ prefix)
  • @ballerine/config: ^1.1.25
  • @ballerine/eslint-config: ^1.1.25
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for version consistency of @ballerine packages across the monorepo

echo "Checking @ballerine/common version..."
fd package.json --type f --exec grep -l "@ballerine/common" {} \; | xargs grep "\"@ballerine/common\""

echo -e "\nChecking @ballerine/config version..."
fd package.json --type f --exec grep -l "@ballerine/config" {} \; | xargs grep "\"@ballerine/config\""

echo -e "\nChecking @ballerine/eslint-config version..."
fd package.json --type f --exec grep -l "@ballerine/eslint-config" {} \; | xargs grep "\"@ballerine/eslint-config\""

Length of output: 3221

sdks/workflow-browser-sdk/package.json (1)

4-4: LGTM: Version updates are consistent.

The version bumps across the package and its dependencies appear to be coordinated patch-level updates.

Also applies to: 36-37, 44-44, 46-46

packages/workflow-core/package.json (3)

4-4: LGTM: Version bump follows semver.

The package version increment from 0.6.64 to 0.6.65 is appropriate for maintenance updates.


48-49: LGTM: Dev dependencies updates are patch versions.

The updates to @ballerine/config and @ballerine/eslint-config are patch version changes using caret ranges, which is appropriate for development dependencies.


34-34: Verify the impact of @ballerine/common update.

The update to @ballerine/common (0.9.51 -> 0.9.52) is a patch version change. Let's verify the changes in the common package to ensure compatibility.

✅ Verification successful

Let me analyze the changes in the common package to ensure there are no breaking changes that could impact the workflow-core package.


Based on the git history, I can see that the changes between versions are related to dependency bumps, document schemas, and a transaction fix. Let me check the specific changes in these commits to ensure there are no breaking changes.


Based on the git history and changes shown, I can determine that the update from 0.9.51 to 0.9.52 in @ballerine/common includes:

  1. Addition of new document schemas for financial information (bank statement) and proof of ownership (company structure)
  2. Package version bump and dependency updates
  3. No breaking changes or API modifications were introduced

The update is safe as it only adds new schemas and bumps dependencies.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check the changelog and package.json of @ballerine/common for breaking changes

# Find and display the relevant package.json
fd -t f "package.json" -x grep -l "@ballerine/common"

# Find and display any CHANGELOG entries
fd -t f "CHANGELOG.md" -x grep -A 5 "0.9.52"

Length of output: 1485


Script:

#!/bin/bash
# Let's check the changes in the common package between versions 0.9.51 and 0.9.52

# First, let's look for any git tags related to these versions
git tag | grep -E "common@0.9.5[1-2]"

# Let's also check the commit history in the common package directory
git log --oneline -- packages/common/

# Check for any API changes in the common package
ast-grep --pattern 'export $_'

Length of output: 308


Script:

#!/bin/bash
# Let's examine the specific changes in these commits
git show c67a596 -- packages/common/
git show b4732a5 -- packages/common/
git show 513eb4c -- packages/common/

# Also check for any changes in the package.json
git diff c67a596^..513eb4c -- packages/common/package.json

Length of output: 244856

apps/kyb-app/package.json (2)

4-4: LGTM! Version updates are consistent

The version bumps follow semantic versioning and are coordinated across the @ballerine ecosystem. The updates align with the PR objectives to add new schemas for financial information and proof of ownership.

Also applies to: 18-21, 67-68


4-4: Verify the contents of updated @ballerine packages

The version updates look consistent across the ecosystem. Let's verify that these updates include the schema changes mentioned in the PR objectives.

Also applies to: 18-21, 67-68

✅ Verification successful

Let me gather more specific information about the schema changes by checking the actual schema files and recent commits.


Based on the git log output, I can now generate the final response as we have clear evidence of the schema changes.

Version updates confirmed with corresponding schema changes

The version updates are verified to include the promised schema changes. The git commit b4732a5 shows:

  • New bank statement schema added with optional fields (accountHolderName, accountNumber, bankName, etc.)
  • New company structure schema added under proof_of_ownership category
  • Changes are properly implemented in the @ballerine/common package
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the contents of the updated packages for schema changes

# Check for schema-related changes in the common package
echo "Checking @ballerine/common for schema changes..."
rg -p "bank.*statement.*schema|company.*structure.*schema" 

# Check package changelogs for breaking changes
echo "Checking changelogs for breaking changes..."
fd "CHANGELOG.md" | xargs rg "0\.(2\.27|5\.45|9\.52|6\.65|1\.25|2\.25)"

Length of output: 3569


Script:

#!/bin/bash
# Check recent commits in common package for schema-related changes
echo "Checking recent commits for schema changes..."
git log -p --grep="schema" -i packages/common/

# Look for schema files in common package
echo "Looking for schema files..."
fd "schema" packages/common/ -e json -e ts

# Check specific content of schema files that might be related
echo "Checking content of potential schema files..."
rg -p "bankStatement|companyStructure|proofOfOwnership" packages/common/

Length of output: 3778

packages/blocks/package.json (1)

5-5: LGTM: Version updates look compatible

The version bumps are minor and use caret ranges, allowing for compatible updates:

  • Package version: 0.2.26 → 0.2.27
  • @ballerine/config: ^1.1.24 → ^1.1.25
  • @ballerine/eslint-config: ^1.1.24 → ^1.1.25
  • @ballerine/common: ^0.9.50 → ^0.9.52

Also applies to: 45-46, 94-94

sdks/web-ui-sdk/package.json (2)

24-24: Version bump looks appropriate.

The patch version increment (1.5.52 -> 1.5.53) aligns with the nature of the changes (dependency updates).


99-99: Verify the @ballerine/common dependency contains the new schemas.

Since this PR introduces new schemas for financial information and proof of ownership, let's verify that version 0.9.52 of @ballerine/common includes these changes.

✅ Verification successful

The new schemas are present in @ballerine/common v0.9.52

The verification confirms that version 0.9.52 of @ballerine/common includes the new schemas for financial information and proof of ownership:

  • Bank statement schema with fields for account details, bank name, and statement period
  • Company structure schema with fields for ownership structure and parent company information

These were added in commit b4732a5 and are properly defined in the universal documents schema file.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the presence of new schemas in @ballerine/common

# Look for schema files related to bank statements and company structure
rg -g '!node_modules' -g '*.{ts,js,json}' -l 'bankStatement|companyStructure' packages/common

# Check the changelog or commit history for version 0.9.52
git log --oneline | rg "@ballerine/common.*0\.9\.52"

Length of output: 150


Script:

#!/bin/bash
# Let's try a different approach to find schema-related files and version information

# Search for schema files in the entire repository
fd -e json -e ts schema

# Look specifically for financial or ownership related schemas
rg -g '!node_modules' -g '*.{ts,js,json}' -l 'financial|ownership|bank.*statement|company.*structure'

# Check package.json in common package for version
fd package.json --exec grep -l "@ballerine/common.*0\.9\.52"

# Look for recent changes in schema files
git log -p --since="3 months ago" -- "**/schema*.{ts,json}"

Length of output: 8896


Script:

#!/bin/bash
# Let's examine the specific version of @ballerine/common and recent schema changes

# Check the package.json in common package for its current version
cat packages/common/package.json | grep '"version"'

# Look for recent changes in financial/ownership related schemas
git log -p --since="3 months ago" -- "packages/common/src/schemas/**/*ownership*.ts" "packages/common/src/schemas/**/*financial*.ts" "packages/common/src/schemas/**/*bank*.ts"

# Check if there are any new schema files added recently
git log --name-status --since="3 months ago" -- "packages/common/src/schemas/**/*.ts"

# Look at the content of potentially relevant schema files
fd -t f . packages/common/src/schemas -e ts -e json --exec grep -l "bank\|financial\|ownership" {} \; -exec cat {} \;

Length of output: 3227


Script:

#!/bin/bash
# Let's examine the specific file that contains the new schemas

# Check the content of the modified file that contains the new schemas
cat packages/common/src/schemas/documents/workflow/documents/schemas/ZZ.ts

# Let's also check the package.json to see when version 0.9.52 was published
cat packages/common/package.json | grep -A 5 -B 5 '"version": "0.9.52"'

# Look at the commit that added the schemas in more detail
git show b4732a57c4288c5a034d7e4e0b267023ab718e74

Length of output: 10648

packages/react-pdf-toolkit/CHANGELOG.md (1)

3-10: LGTM! Version numbering and format are correct.

The changelog entry follows the established format and properly documents the dependency updates.

apps/backoffice-v2/package.json (1)

3-3: LGTM: Coordinated version updates across @ballerine packages

The version updates are consistent across all @ballerine packages, following a coordinated update pattern across the ecosystem. This maintains compatibility between interdependent packages.

Also applies to: 54-59, 150-151

packages/common/src/schemas/documents/workflow/documents/schemas/ZZ.ts (1)

50-64: Overall schema structure looks good!

The new document types maintain consistency with the existing schema patterns and follow the established structure for universal documents. The use of country code 'ZZ' appropriately indicates these are country-agnostic schemas.

Also applies to: 252-264

packages/blocks/CHANGELOG.md (1)

3-10: LGTM! Changelog entry follows the established format.

The version bump and dependency update are appropriately documented as patch changes.

packages/workflow-core/CHANGELOG.md (1)

3-10: Verify alignment with PR objectives.

The PR objectives mention new schemas for financial information and proof of ownership, but the changelog only shows a dependency bump. Please verify if:

  1. The schema changes are included in the @ballerine/common@0.9.52 update
  2. Additional changelog entries are needed to document the schema changes
✅ Verification successful

Based on the git log output and file changes, I can verify that the schema changes in @ballerine/common@0.9.52 include the addition of new schemas for financial information and proof of ownership:

  1. Financial information schema was added in packages/common/src/schemas/documents/workflow/documents/schemas/ZZ.ts:
{
  category: 'financial_information',
  type: 'bank_statement',
  issuer: { country: 'ZZ' },
  issuingVersion: 1,
  version: 1,
  propertiesSchema: Type.Object({
    accountHolderName: Type.Optional(Type.String()),
    accountNumber: Type.Optional(Type.String()),
    bankName: Type.Optional(Type.String()),
    statementPeriod: Type.Optional(Type.String()),
    issueDate: OptionalTypePastDate,
    physicalAddress: Type.Optional(Type.String()),
  }),
}
  1. Proof of ownership schema was added in the same file:
{
  category: 'proof_of_ownership', 
  type: 'company_structure',
  issuer: { country: 'ZZ' },
  issuingVersion: 1,
  version: 1,
  propertiesSchema: Type.Object({
    companyName: Type.Optional(Type.String()),
    ownershipStructure: Type.Optional(Type.String()),
    parentCompanyName: Type.Optional(Type.String()), 
    documentDate: Type.Optional(Type.String({ format: 'date' })),
  }),
}

The changelog entry "Bump" is appropriate since it reflects these schema additions in the @ballerine/common dependency update.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check if the schema changes are included in the common package update

# Look for schema-related changes in recent commits
git log --oneline -p @ballerine/common@0.9.51..@ballerine/common@0.9.52 | rg -i "schema"

# Check for new or modified schema files
git diff @ballerine/common@0.9.51..@ballerine/common@0.9.52 -- "*.schema.json" "*.schema.ts"

Length of output: 487


Script:

#!/bin/bash
# Let's try a different approach to find schema-related changes

# First, let's find the common package location
fd -t d "common$" packages

# Then look for recent changes in schema files
git log --oneline -n 10 -p -- "packages/common/**/*schema*"

# Also check for any recent commits mentioning schemas
git log --oneline -n 10 -p | rg -i "schema"

# List all schema files to understand the structure
fd "schema" packages/common

Length of output: 278475

Comment on lines 3 to 7
## 0.1.25

### Patch Changes

- Bump
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Enhance changelog entries with meaningful information

The current changelog entries lack sufficient detail about the changes being made. Consider improving the changelog by:

  1. Adding meaningful descriptions of what changed
  2. Including links to PRs/commits
  3. Categorizing changes (features, fixes, breaking changes)
  4. Describing the impact of changes
  5. Following the Conventional Changelog format

Example format:

## [0.1.25] - 2024-11-XX

### Changed
- Updated dependency versions to maintain compatibility with @ballerine ecosystem
  - Details of specific updates
  - Impact of the changes
  
[0.1.25]: https://github.com/ballerine-io/ballerine/compare/v0.1.24...v0.1.25

Comment on lines 7 to 8
- Bump
- Updated dependencies
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Improve changelog message descriptiveness

The current changelog message "Bump" is not descriptive enough. Consider following the conventional changelog format to clearly describe what changed and why. For example:

-Bump
+fix: update @ballerine/react-pdf-toolkit to version 1.2.45 for improved PDF generation capabilities
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- Bump
- Updated dependencies
- fix: update @ballerine/react-pdf-toolkit to version 1.2.45 for improved PDF generation capabilities
- Updated dependencies

Comment on lines +50 to +64
{
category: 'financial_information',
type: 'bank_statement',
issuer: { country: 'ZZ' },
issuingVersion: 1,
version: 1,
propertiesSchema: Type.Object({
accountHolderName: Type.Optional(Type.String()),
accountNumber: Type.Optional(Type.String()),
bankName: Type.Optional(Type.String()),
statementPeriod: Type.Optional(Type.String()),
issueDate: OptionalTypePastDate,
physicalAddress: Type.Optional(Type.String()),
}),
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Enhance schema validation for bank statement properties.

While the basic structure is good, consider strengthening the validation:

  1. statementPeriod should have a specific format (e.g., "YYYY-MM" or date range)
  2. accountNumber might benefit from a pattern validation
  3. Consider adding essential financial fields:
    • balance
    • currency
    • transactionPeriodStart
    • transactionPeriodEnd
       propertiesSchema: Type.Object({
         accountHolderName: Type.Optional(Type.String()),
-        accountNumber: Type.Optional(Type.String()),
+        accountNumber: Type.Optional(Type.String({ pattern: '^[0-9]{8,34}$' })), // IBAN-compatible
         bankName: Type.Optional(Type.String()),
-        statementPeriod: Type.Optional(Type.String()),
+        statementPeriod: Type.Optional(Type.String({ 
+          pattern: '^[0-9]{4}-(0[1-9]|1[0-2])$' // YYYY-MM format
+        })),
         issueDate: OptionalTypePastDate,
         physicalAddress: Type.Optional(Type.String()),
+        balance: Type.Optional(Type.Number()),
+        currency: Type.Optional(Type.String({ pattern: '^[A-Z]{3}$' })), // ISO 4217
+        transactionPeriodStart: Type.Optional(Type.String({ format: 'date' })),
+        transactionPeriodEnd: Type.Optional(Type.String({ format: 'date' })),
       }),
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
{
category: 'financial_information',
type: 'bank_statement',
issuer: { country: 'ZZ' },
issuingVersion: 1,
version: 1,
propertiesSchema: Type.Object({
accountHolderName: Type.Optional(Type.String()),
accountNumber: Type.Optional(Type.String()),
bankName: Type.Optional(Type.String()),
statementPeriod: Type.Optional(Type.String()),
issueDate: OptionalTypePastDate,
physicalAddress: Type.Optional(Type.String()),
}),
},
{
category: 'financial_information',
type: 'bank_statement',
issuer: { country: 'ZZ' },
issuingVersion: 1,
version: 1,
propertiesSchema: Type.Object({
accountHolderName: Type.Optional(Type.String()),
accountNumber: Type.Optional(Type.String({ pattern: '^[0-9]{8,34}$' })), // IBAN-compatible
bankName: Type.Optional(Type.String()),
statementPeriod: Type.Optional(Type.String({
pattern: '^[0-9]{4}-(0[1-9]|1[0-2])$' // YYYY-MM format
})),
issueDate: OptionalTypePastDate,
physicalAddress: Type.Optional(Type.String()),
balance: Type.Optional(Type.Number()),
currency: Type.Optional(Type.String({ pattern: '^[A-Z]{3}$' })), // ISO 4217
transactionPeriodStart: Type.Optional(Type.String({ format: 'date' })),
transactionPeriodEnd: Type.Optional(Type.String({ format: 'date' })),
}),
},

Comment on lines +252 to +264
{
category: 'proof_of_ownership',
type: 'company_structure',
issuer: { country: 'ZZ' },
issuingVersion: 1,
version: 1,
propertiesSchema: Type.Object({
companyName: Type.Optional(Type.String()),
ownershipStructure: Type.Optional(Type.String()),
parentCompanyName: Type.Optional(Type.String()),
documentDate: Type.Optional(Type.String({ format: 'date' })),
}),
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Enhance company structure schema to better represent ownership hierarchy.

The current schema might be too simplistic for capturing complex ownership structures. Consider:

  1. Structuring ownershipStructure as an object array to capture ownership hierarchy
  2. Adding fields for beneficial owners
  3. Adding validation for ownership percentages
  4. Adding fields for subsidiary relationships
       propertiesSchema: Type.Object({
         companyName: Type.Optional(Type.String()),
-        ownershipStructure: Type.Optional(Type.String()),
+        ownershipStructure: Type.Optional(Type.Array(Type.Object({
+          entityName: Type.String(),
+          entityType: Type.Union([
+            Type.Literal('individual'),
+            Type.Literal('company'),
+          ]),
+          ownershipPercentage: Type.Number({
+            minimum: 0,
+            maximum: 100,
+          }),
+          isDirectOwner: Type.Boolean(),
+        }))),
         parentCompanyName: Type.Optional(Type.String()),
+        subsidiaries: Type.Optional(Type.Array(Type.Object({
+          companyName: Type.String(),
+          ownershipPercentage: Type.Number({
+            minimum: 0,
+            maximum: 100,
+          }),
+        }))),
+        beneficialOwners: Type.Optional(Type.Array(Type.Object({
+          name: Type.String(),
+          ownershipPercentage: Type.Number({
+            minimum: 0,
+            maximum: 100,
+          }),
+          controlType: Type.Union([
+            Type.Literal('direct'),
+            Type.Literal('indirect'),
+          ]),
+        }))),
         documentDate: Type.Optional(Type.String({ format: 'date' })),
       }),
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
{
category: 'proof_of_ownership',
type: 'company_structure',
issuer: { country: 'ZZ' },
issuingVersion: 1,
version: 1,
propertiesSchema: Type.Object({
companyName: Type.Optional(Type.String()),
ownershipStructure: Type.Optional(Type.String()),
parentCompanyName: Type.Optional(Type.String()),
documentDate: Type.Optional(Type.String({ format: 'date' })),
}),
},
{
category: 'proof_of_ownership',
type: 'company_structure',
issuer: { country: 'ZZ' },
issuingVersion: 1,
version: 1,
propertiesSchema: Type.Object({
companyName: Type.Optional(Type.String()),
ownershipStructure: Type.Optional(Type.Array(Type.Object({
entityName: Type.String(),
entityType: Type.Union([
Type.Literal('individual'),
Type.Literal('company'),
]),
ownershipPercentage: Type.Number({
minimum: 0,
maximum: 100,
}),
isDirectOwner: Type.Boolean(),
}))),
parentCompanyName: Type.Optional(Type.String()),
subsidiaries: Type.Optional(Type.Array(Type.Object({
companyName: Type.String(),
ownershipPercentage: Type.Number({
minimum: 0,
maximum: 100,
}),
}))),
beneficialOwners: Type.Optional(Type.Array(Type.Object({
name: Type.String(),
ownershipPercentage: Type.Number({
minimum: 0,
maximum: 100,
}),
controlType: Type.Union([
Type.Literal('direct'),
Type.Literal('indirect'),
]),
}))),
documentDate: Type.Optional(Type.String({ format: 'date' })),
}),
},

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.

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (3)
scripts/auto-commit.js (3)

Line range hint 23-23: Fix the OpenAI model name typo

The model name gpt-4o-mini appears to be incorrect. OpenAI doesn't have a model with this name. Did you mean gpt-4 or gpt-3.5-turbo?

-      model: 'gpt-4o-mini',
+      model: 'gpt-4',

Line range hint 89-98: Enhance security for shell command execution

The script executes shell commands with user-provided input (editor path and commit message). While there is some sanitization, additional security measures could be implemented.

Consider these improvements:

  1. Validate the editor path against a whitelist
  2. Add input validation for the commit message
  3. Use shelljs or similar library for safer command execution
-    const editor = process.env.EDITOR || 'vim';
+    const allowedEditors = ['vim', 'nano', 'code'];
+    const defaultEditor = 'vim';
+    const editor = allowedEditors.includes(process.env.EDITOR) 
+      ? process.env.EDITOR 
+      : defaultEditor;

Line range hint 71-85: Consider adding retry logic for OpenAI API calls

The script might benefit from retry logic when calling the OpenAI API to handle temporary failures or rate limits.

Would you like me to provide an implementation using a retry mechanism?

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 513eb4c and c6dc758.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (40)
  • apps/backoffice-v2/CHANGELOG.md (1 hunks)
  • apps/backoffice-v2/package.json (3 hunks)
  • apps/kyb-app/CHANGELOG.md (1 hunks)
  • apps/kyb-app/package.json (3 hunks)
  • apps/workflows-dashboard/CHANGELOG.md (1 hunks)
  • apps/workflows-dashboard/package.json (3 hunks)
  • examples/headless-example/CHANGELOG.md (1 hunks)
  • examples/headless-example/package.json (2 hunks)
  • examples/report-generation-example/CHANGELOG.md (1 hunks)
  • examples/report-generation-example/package.json (2 hunks)
  • packages/blocks/CHANGELOG.md (1 hunks)
  • packages/blocks/package.json (3 hunks)
  • packages/common/CHANGELOG.md (1 hunks)
  • packages/common/package.json (2 hunks)
  • packages/config/CHANGELOG.md (1 hunks)
  • packages/config/package.json (1 hunks)
  • packages/eslint-config-react/CHANGELOG.md (1 hunks)
  • packages/eslint-config-react/package.json (2 hunks)
  • packages/eslint-config/CHANGELOG.md (1 hunks)
  • packages/eslint-config/package.json (1 hunks)
  • packages/react-pdf-toolkit/CHANGELOG.md (1 hunks)
  • packages/react-pdf-toolkit/package.json (2 hunks)
  • packages/rules-engine/CHANGELOG.md (1 hunks)
  • packages/rules-engine/package.json (2 hunks)
  • packages/ui/CHANGELOG.md (1 hunks)
  • packages/ui/package.json (3 hunks)
  • packages/workflow-core/CHANGELOG.md (1 hunks)
  • packages/workflow-core/package.json (3 hunks)
  • scripts/auto-commit.js (1 hunks)
  • sdks/web-ui-sdk/CHANGELOG.md (1 hunks)
  • sdks/web-ui-sdk/package.json (2 hunks)
  • sdks/workflow-browser-sdk/CHANGELOG.md (1 hunks)
  • sdks/workflow-browser-sdk/package.json (2 hunks)
  • sdks/workflow-node-sdk/CHANGELOG.md (1 hunks)
  • sdks/workflow-node-sdk/package.json (2 hunks)
  • services/websocket-service/CHANGELOG.md (1 hunks)
  • services/websocket-service/package.json (1 hunks)
  • services/workflows-service/CHANGELOG.md (1 hunks)
  • services/workflows-service/package.json (3 hunks)
  • websites/docs/package.json (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • packages/config/package.json
🚧 Files skipped from review as they are similar to previous changes (38)
  • apps/backoffice-v2/CHANGELOG.md
  • apps/backoffice-v2/package.json
  • apps/kyb-app/CHANGELOG.md
  • apps/kyb-app/package.json
  • apps/workflows-dashboard/CHANGELOG.md
  • apps/workflows-dashboard/package.json
  • examples/headless-example/CHANGELOG.md
  • examples/headless-example/package.json
  • examples/report-generation-example/CHANGELOG.md
  • examples/report-generation-example/package.json
  • packages/blocks/CHANGELOG.md
  • packages/blocks/package.json
  • packages/common/CHANGELOG.md
  • packages/common/package.json
  • packages/config/CHANGELOG.md
  • packages/eslint-config-react/CHANGELOG.md
  • packages/eslint-config-react/package.json
  • packages/eslint-config/CHANGELOG.md
  • packages/eslint-config/package.json
  • packages/react-pdf-toolkit/CHANGELOG.md
  • packages/react-pdf-toolkit/package.json
  • packages/rules-engine/CHANGELOG.md
  • packages/rules-engine/package.json
  • packages/ui/CHANGELOG.md
  • packages/ui/package.json
  • packages/workflow-core/CHANGELOG.md
  • packages/workflow-core/package.json
  • sdks/web-ui-sdk/CHANGELOG.md
  • sdks/web-ui-sdk/package.json
  • sdks/workflow-browser-sdk/CHANGELOG.md
  • sdks/workflow-browser-sdk/package.json
  • sdks/workflow-node-sdk/CHANGELOG.md
  • sdks/workflow-node-sdk/package.json
  • services/websocket-service/CHANGELOG.md
  • services/websocket-service/package.json
  • services/workflows-service/CHANGELOG.md
  • services/workflows-service/package.json
  • websites/docs/package.json
🔇 Additional comments (1)
scripts/auto-commit.js (1)

38-38: LGTM: Character limit clarification is helpful

The addition of "including the roast" to the character limit guideline provides better clarity for the message format.

…ents

- Introduce bank statement and company structure schemas
- Enhance document properties for better clarity

(These schemas have more categories than I have excuses for being late)
- Bump versions for @ballerine/common and related SDKs to 0.9.54 and 0.6.71
- Ensure consistent dependency updates in backoffice-v2, kyb-app, and SDKs

(the only time your dependencies should be this tangled is in a family reunion)
@alonp99 alonp99 merged commit d4f1d58 into dev Nov 27, 2024
8 of 9 checks passed
@alonp99 alonp99 deleted the BAL-3015 branch November 27, 2024 23:22
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