Skip to content

Conversation

@fracek
Copy link
Contributor

@fracek fracek commented Oct 29, 2024

This enables developers to use plain pgTable and pgIndexerTable in the same schema file.

@fracek fracek requested a review from jaipaljadeja October 29, 2024 21:22
@coderabbitai
Copy link

coderabbitai bot commented Oct 29, 2024

📝 Walkthrough

Walkthrough

The pull request introduces a new JSON file for the @apibara/indexer package, indicating a prerelease version and documenting the renaming of pgTable to pgIndexerTable. Corresponding changes are made in multiple TypeScript files, including updates to import statements, variable definitions, and type signatures to reflect the new naming convention. The overall functionality remains unchanged, with existing logic preserved across the affected files.

Changes

File Path Change Summary
change/@apibara-indexer-43e28d2b-5062-4907-8504-f0287b439697.json Introduced a new JSON file specifying a prerelease version and documenting the renaming of pgTable to pgIndexerTable.
examples/starknet-indexer/src/indexer.ts Updated import statement and variable definition from pgTable to pgIndexerTable for headers.
packages/indexer/src/sinks/drizzle/drizzle.test.ts Changed test table definition from pgTable to pgIndexerTable, maintaining test structure and logic.
packages/indexer/src/sinks/drizzle/utils.ts Renamed PgTableWithCursorFn to PgIndexerTableWithCursorFn and pgTable to pgIndexerTable, updating type and function signatures accordingly.

Possibly related PRs

🐇 In the code, we hop and play,
Renaming tables, come what may!
From pgTable to pgIndexerTable we leap,
Keeping our logic, oh so deep.
With tests that run and functions bright,
Our changes make the code just right! 🌟


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

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 25fe12b and ec7cd32.

📒 Files selected for processing (4)
  • change/@apibara-indexer-43e28d2b-5062-4907-8504-f0287b439697.json (1 hunks)
  • examples/starknet-indexer/src/indexer.ts (1 hunks)
  • packages/indexer/src/sinks/drizzle/drizzle.test.ts (1 hunks)
  • packages/indexer/src/sinks/drizzle/utils.ts (2 hunks)
✅ Files skipped from review due to trivial changes (1)
  • change/@apibara-indexer-43e28d2b-5062-4907-8504-f0287b439697.json
🧰 Additional context used
📓 Learnings (1)
packages/indexer/src/sinks/drizzle/drizzle.test.ts (1)
Learnt from: fracek
PR: apibara/typescript-sdk#109
File: packages/indexer/src/sinks/drizzle/drizzle.test.ts:16-18
Timestamp: 2024-10-22T11:16:00.689Z
Learning: In `packages/indexer/src/sinks/drizzle`, the import references are correct and up-to-date according to the new code structure.
🔇 Additional comments (5)
examples/starknet-indexer/src/indexer.ts (2)

4-4: LGTM: Clean import rename

The import statement has been correctly updated to use pgIndexerTable.


12-12: LGTM: Table definition updated consistently

The table definition has been properly updated to use pgIndexerTable while maintaining the existing table structure and configuration.

packages/indexer/src/sinks/drizzle/utils.ts (1)

Line range hint 32-68: LGTM: Type renaming is clean and maintains compatibility.

The renaming from PgTableWithCursorFn to PgIndexerTableWithCursorFn is well-structured and preserves the existing type constraints and cursor column requirements.

packages/indexer/src/sinks/drizzle/drizzle.test.ts (2)

18-18: LGTM: Import statement updated correctly.

The import statement has been properly updated to use pgIndexerTable instead of pgTable, which aligns with the PR objectives.


20-23: LGTM: Table definition updated correctly.

The table definition has been properly migrated to use pgIndexerTable while maintaining the same schema structure. This change allows for the coexistence of both pgTable and pgIndexerTable in schema files as intended.

Comment on lines +69 to +73
export const pgIndexerTable: PgIndexerTableWithCursorFn = (
name,
columns,
extraConfig?,
) => {
Copy link

Choose a reason for hiding this comment

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

💡 Codebase verification

Found remaining usage of pgTable in examples that needs updating

The renaming from pgTable to pgIndexerTable is incomplete. While the implementation file correctly aliases the import from drizzle-orm, there's still direct usage of pgTable in:

  • examples/indexer/src/indexer.ts: Uses the original pgTable from drizzle-orm directly

This example should be updated to use the new pgIndexerTable for consistency with the rest of the codebase.

🔗 Analysis chain

LGTM: Function renaming is consistent with type changes.

The implementation maintains the same functionality while adopting the new naming convention.

Let's verify there are no remaining references to the old name:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for any remaining instances of 'pgTable' that might need updating
rg 'pgTable' --type ts --type tsx --type js --type jsx -g '!*.test.*' -g '!*.spec.*'

Length of output: 112


Script:

#!/bin/bash
# Search for any remaining instances of 'pgTable' using ripgrep with correct file type options
rg 'pgTable' --type typescript --type javascript -g '!*.test.*' -g '!*.spec.*'

Length of output: 113


Script:

#!/bin/bash
# Search for any remaining instances of 'pgTable' using basic ripgrep without file type filters
# but exclude test files using glob patterns
rg 'pgTable' -g '!*.test.*' -g '!*.spec.*' -g '*.ts' -g '*.js'

Length of output: 451

Copy link
Member

@jaipaljadeja jaipaljadeja left a comment

Choose a reason for hiding this comment

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

Looks good. Thank you!

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.

2 participants