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

implementation tmp #23

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open

implementation tmp #23

wants to merge 10 commits into from

Conversation

nagasawaryoya
Copy link
Collaborator

@nagasawaryoya nagasawaryoya commented Nov 6, 2023

Summary by CodeRabbit

  • New Features

    • Introduced @connectable-io/storage-plugin-tmp package for temporary storage solutions.
    • Added functionality to create storage based on local temporary directories.
  • Enhancements

    • Improved URL construction for file storage, ensuring correct URL format.
  • Documentation

    • Added README for the new temporary storage plugin package.
  • Tests

    • Expanded test coverage for file and temporary storage adapters and plugins, including path resolution and URL schema handling.

@nagasawaryoya nagasawaryoya added enhancement New feature or request good first issue Good for newcomers labels Nov 6, 2023
@nagasawaryoya nagasawaryoya self-assigned this Nov 6, 2023
@nagasawaryoya nagasawaryoya marked this pull request as draft November 6, 2023 00:18
@nagasawaryoya nagasawaryoya changed the title wip: implement tmp implement tmp Nov 6, 2023
@nagasawaryoya nagasawaryoya changed the title implement tmp implementation tmp Nov 6, 2023
Copy link

changeset-bot bot commented Jan 17, 2024

⚠️ No Changeset found

Latest commit: 9d7ea98

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

coderabbitai bot commented Jan 17, 2024

Important

Auto Review Skipped

Review was skipped due to path filters

Files ignored due to path filters (2)
  • package-lock.json is excluded by: !**/*.json
  • packages/@connectable-io/storage-plugin-tmp/package.json is excluded by: !**/*.json

Walkthrough

The recent updates involve enhancements to the @connectable-io/storage-plugin-file by refining path and URL handling, and the introduction of a new @connectable-io/storage-plugin-tmp package for temporary storage solutions. Changes include the use of a consistent base directory reference, URL formatting adjustments, and additional test cases to ensure proper functionality. The TmpStoragePlugin extends the file storage capabilities to handle temporary files, with a focus on correct path resolutions and URL schema definitions.

Changes

File Pattern Change Summary
.../FileSystemStorageAdapter.test.ts Replaced process.cwd() with storage.baseDir for path construction in tests.
.../FileSystemStorageAdapter.ts Updated URL format to use // instead of /.
.../FileSystemStoragePlugin.spec.ts Added resolve function and tests for absolute/relative paths with baseDir.
.../pnp.ts Updated URLString type definition and restructured module declaration.
.../storage-plugin-tmp/README.md Introduced the @connectable-io/storage-plugin-tmp package.
.../TmpStorageAdapter.test.ts, .../TmpStoragePlugin.test.ts Added test cases for TmpStorageAdapter and TmpStoragePlugin functionality.
.../TmpStorageAdapter.ts, .../TmpStoragePlugin.ts Introduced classes for temporary storage handling with URL schema and baseDir options.
.../constant.ts, .../index.ts Added DEFAULT_SCHEMA constant and exports for temporary storage functionality.
.../storage-plugin-tmp/src/pnp.ts Introduced local temporary directory storage creation using a URL.

Poem

"In the realm of bytes and bits, 🐇💾
A rabbit hopped, fixing scripts.
With a wave of its paw, paths align,
Temporary stores, now benign."

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.

@nagasawaryoya
Copy link
Collaborator Author

@coderabbitai review

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.

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 7571070 and 0e147ce.
Files ignored due to path filters (5)
  • package-lock.json is excluded by: !**/*.json
  • packages/@connectable-io/storage-plugin-tmp/package.json is excluded by: !**/*.json
  • packages/@connectable-io/storage-plugin-tmp/tsconfig.json is excluded by: !**/*.json
  • tsconfig.build.json is excluded by: !**/*.json
  • tsconfig.json is excluded by: !**/*.json
Files selected for processing (12)
  • packages/@connectable-io/storage-plugin-file/src/adapters/FileSystemStorageAdapter.test.ts (5 hunks)
  • packages/@connectable-io/storage-plugin-file/src/adapters/FileSystemStorageAdapter.ts (1 hunks)
  • packages/@connectable-io/storage-plugin-file/src/plugins/FileSystemStoragePlugin.spec.ts (2 hunks)
  • packages/@connectable-io/storage-plugin-file/src/pnp.ts (1 hunks)
  • packages/@connectable-io/storage-plugin-tmp/README.md (1 hunks)
  • packages/@connectable-io/storage-plugin-tmp/src/adapters/TmpStorageAdapter.test.ts (1 hunks)
  • packages/@connectable-io/storage-plugin-tmp/src/adapters/TmpStorageAdapter.ts (1 hunks)
  • packages/@connectable-io/storage-plugin-tmp/src/constant.ts (1 hunks)
  • packages/@connectable-io/storage-plugin-tmp/src/index.ts (1 hunks)
  • packages/@connectable-io/storage-plugin-tmp/src/plugins/TmpStoragePlugin.test.ts (1 hunks)
  • packages/@connectable-io/storage-plugin-tmp/src/plugins/TmpStoragePlugin.ts (1 hunks)
  • packages/@connectable-io/storage-plugin-tmp/src/pnp.ts (1 hunks)
Files skipped from review due to trivial changes (2)
  • packages/@connectable-io/storage-plugin-tmp/README.md
  • packages/@connectable-io/storage-plugin-tmp/src/constant.ts
Additional comments: 19
packages/@connectable-io/storage-plugin-tmp/src/index.ts (1)
  • 1-2: The export statements for TmpStorageAdapter and TmpStoragePlugin are correct and follow standard ES module syntax.
packages/@connectable-io/storage-plugin-tmp/src/adapters/TmpStorageAdapter.test.ts (2)
  • 9-24: The tests for the TmpStorageAdapter constructor are well-structured and cover the default base directory, URL schema, and path resolution.
  • 17-23: The test for using absolute paths correctly checks that the provided absolute path is used as is.
packages/@connectable-io/storage-plugin-file/src/pnp.ts (2)
  • 6-6: The URLString type definition has been updated to use the DEFAULT_SCHEMA which should ensure consistency across the codebase.
  • 3-11: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [8-41]

The module declaration for @connectable-io/storage has been expanded with examples and documentation, which is good for maintainability and clarity.

packages/@connectable-io/storage-plugin-tmp/src/pnp.ts (2)
  • 6-6: The URLString type definition is consistent with the one in the storage-plugin-file package, which is good for consistency across related packages.
  • 8-41: The module declaration for @connectable-io/storage within the storage-plugin-tmp package is well-documented and provides clear examples for usage.
packages/@connectable-io/storage-plugin-tmp/src/adapters/TmpStorageAdapter.ts (1)
  • 38-41: The TmpStorageAdapter class is correctly extending FileSystemStorageAdapter and properly handling the baseDir and urlSchema options.
packages/@connectable-io/storage-plugin-tmp/src/plugins/TmpStoragePlugin.ts (2)
  • 19-41: The TmpStoragePlugin class correctly implements the ResourcePlugin interface and handles the construction of the TmpStorageAdapter with appropriate options.
  • 24-42: The build method in TmpStoragePlugin correctly generates a unique directory if no pathname is provided and ensures the directory exists if the createDirectoryIfNotExists option is true.
packages/@connectable-io/storage-plugin-file/src/plugins/FileSystemStoragePlugin.spec.ts (1)
  • 67-77: The tests for the FileSystemStoragePlugin class correctly handle both absolute and relative path scenarios for the baseDir option.
packages/@connectable-io/storage-plugin-tmp/src/plugins/TmpStoragePlugin.test.ts (1)
  • 42-87: The tests for the TmpStoragePlugin class are comprehensive, covering constructor behavior, URL schema setting, base directory resolution, and directory creation based on the createDirectoryIfNotExists option.
packages/@connectable-io/storage-plugin-file/src/adapters/FileSystemStorageAdapter.ts (1)
  • 72-72: The change to the url getter to use double slashes (//) is correct and aligns with the standard URL format.
packages/@connectable-io/storage-plugin-file/src/adapters/FileSystemStorageAdapter.test.ts (6)
  • 104-104: The test for the delete method correctly uses storage.baseDir to construct the path, which is a good practice for maintainability.
  • 188-188: The test for the open method correctly asserts the URI format, ensuring that the url getter change is reflected in the tests.
  • 216-216: The test for the createReadStream method correctly asserts the file opening with read permission, which is essential for correct functionality.
  • 285-285: The test for the createWriteStream method correctly asserts the file opening with write and create permissions, ensuring that the file system adapter behaves as expected.
  • 292-292: The test for the createWriteStream method with a given mode correctly asserts that the file is opened with the specified mode.
  • 318-318: The test for directory creation when createDirectoryIfNotExists is true correctly asserts that the directory is created recursively.

@nagasawaryoya nagasawaryoya marked this pull request as ready for review February 24, 2024 16:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants