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

refactor: separate set item and get item options types #271

Closed
wants to merge 1 commit into from

Conversation

Hebilicious
Copy link
Member

@Hebilicious Hebilicious commented Jul 16, 2023

πŸ”— Linked issue

#262

unblock #255
unblock #269

❓ Type of change

  • πŸ“– Documentation (updates to the documentation, readme, or JSdoc annotations)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

@pi0 Instead of refactoring all the drivers, I think we can track expiration support in #262.
This PR just adds support at the type level.

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@codecov
Copy link

codecov bot commented Jul 16, 2023

Codecov Report

Merging #271 (645b5ff) into main (59657f8) will not change coverage.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main     #271   +/-   ##
=======================================
  Coverage   76.55%   76.55%           
=======================================
  Files          26       26           
  Lines        3169     3169           
  Branches      473      473           
=======================================
  Hits         2426     2426           
  Misses        742      742           
  Partials        1        1           
Impacted Files Coverage Ξ”
src/drivers/cloudflare-r2-binding.ts 77.57% <100.00%> (ΓΈ)
src/types.ts 100.00% <100.00%> (ΓΈ)

@pi0
Copy link
Member

pi0 commented Jul 17, 2023

For simplification (of typing driver options), i think we can keep using one interface than two and introduce two if needed.

For ttl, i think it actually even makes sense to type possibly supported ttl in get operations for two reasons:

  • A single option object (including ttl, credentials, etc) can be used to be passed into all storage operations
  • ttl can also be respected in getItem for passive expiration support (drivers not implementing it, lazily invalidate entries on the next get operation)

Closing this issue for maintenance but still happy to discuss introducing two more types πŸ‘πŸΌ

@pi0 pi0 closed this Jul 17, 2023
@pi0 pi0 deleted the generic-ttl branch July 17, 2023 09:47
@Hebilicious
Copy link
Member Author

@pi0 Even if you do not want to split them now (and I think it's necessary based on the work done in #255), this PR still adds ttl in the TransactionOptions interface... Should I just have this change in #255 instead ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request ttl
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants