Skip to content

Comments

Fix/extractors#589

Merged
dboskovic merged 5 commits intomainfrom
fix/extractors
Aug 1, 2024
Merged

Fix/extractors#589
dboskovic merged 5 commits intomainfrom
fix/extractors

Conversation

@dboskovic
Copy link
Contributor

@dboskovic dboskovic commented Aug 1, 2024

This makes the extractor use the far more efficient createAllRecords utility over the api.records.create

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 1, 2024

Walkthrough

The update introduces several enhancements across multiple plugins and utility functions. Notable changes include the implementation of a common utility function for extractors in various plugins, which enhances code maintainability and consistency. Additionally, the utility package has been optimized for data writing performance by adding a delay and utilizing an IO optimized writer. These refactorings improve both the efficiency and functionality of the extraction processes.

Changes

Files Change Summary
plugins/delimiter-extractor/CHANGELOG.md Added version 2.1.2; extractors now use a common utility function for better maintainability.
plugins/json-extractor/CHANGELOG.md Added version 0.8.2; extractors updated to use a common utility function, enhancing consistency.
plugins/xlsx-extractor/CHANGELOG.md Added version 3.1.3; extractors modified to utilize a common utility function.
plugins/xml-extractor/CHANGELOG.md Added version 0.6.2; extractors updated to utilize a common utility function.
utils/extractor/CHANGELOG.md Added version 2.1.2; introduced a delay before writing data and optimized IO writer.
utils/extractor/src/index.ts Changed imports and logic in Extractor; replaced asyncBatch with createAllRecords, added a 3-second delay.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Extractor
    participant Utility
    participant Writer

    User->>Extractor: Start extraction
    Extractor->>Utility: Create records
    Utility->>Extractor: Return records
    Extractor->>Writer: Write records with delay
    Writer-->>Extractor: Confirm records written
    Extractor-->>User: Extraction complete
Loading

Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between cdfc5ed and 33a9bf2.

Files selected for processing (1)
  • utils/extractor/src/index.ts (2 hunks)
Files skipped from review as they are similar to previous changes (1)
  • utils/extractor/src/index.ts

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 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 as 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.

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

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.

import api, { Flatfile } from '@flatfile/api'
import type { FlatfileListener } from '@flatfile/listener'
import { asyncBatch, slugify } from '@flatfile/util-common'
import { asyncBatch, createAllRecords, slugify } from '@flatfile/util-common'
Copy link
Collaborator

Choose a reason for hiding this comment

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

can we remove asyncBatch here now?

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, codebase verification and nitpick comments (1)
utils/extractor/src/index.ts (1)

1-3: Ensure consistent import style.

The import statement for api should be corrected to align with the rest of the codebase. Replace import api with import { FlatfileClient } as api to match the usage pattern.

  • utils/extractor/src/index.ts
Analysis chain

Ensure consistent import style.

The import statement for api has been changed to a default import. Verify that this change aligns with the rest of the codebase and that api is indeed exported as a default export.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that `api` is exported as a default export in the codebase.

# Test: Search for the export statement of `api`. Expect: `export default api`.
rg --type ts -A 5 $'export default api'

Length of output: 40


Script:

#!/bin/bash
# Description: Verify how `api` is exported in the codebase.

# Test: Search for any export statements related to `api`.
rg --type ts 'export .* api' -A 5

Length of output: 35


Script:

#!/bin/bash
# Description: Search for any file that imports `@flatfile/api` to trace back the export of `api`.

# Find all import statements for `@flatfile/api`.
rg 'import .* from \'@flatfile/api\'' -A 5

Length of output: 93


Script:

#!/bin/bash
# Description: Search for any file that imports `@flatfile/api` to trace back the export of `api`.

# Find all import statements for `@flatfile/api`.
rg "import .* from '@flatfile/api'" -A 5

Length of output: 30814

)

await new Promise((resolve) => {
setTimeout(resolve, 3_000)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we pull this 3_000 variable out into a config option?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good thinking

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