-
Notifications
You must be signed in to change notification settings - Fork 495
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/cloudflare kv support #2642
base: main
Are you sure you want to change the base?
Feat/cloudflare kv support #2642
Conversation
Review or Edit in CodeSandboxOpen the branch in Web Editor • VS Code • Insiders |
🦋 Changeset detectedLatest commit: b550643 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
@Mrinank-Bhowmick is attempting to deploy a commit to the Mastra Team on Vercel. A member of the Team first needs to authorize it. |
📝 Documentation updates detected! You can review documentation updates here |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add some tests, docs, and a README for this storage class? You can use cursor to follow the examples set by other storage classes.
Thanks for the review! I will make those changes, but I need some time as I am currently busy with my exams. Once they are over, I will resume work aggressively. |
Thanks a lot for this! |
@NikAiyer |
📝 Documentation updates detected! You can review documentation updates here |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good! Needs tests though :) Cursor or windsurf can write them. Copy the upstash ones from stores/upstash/src/storage/upstash.test.ts and tell cursor that you copied those tests from upstash and it needs to update them to test cloudflare/src/storage/index.ts
Fixes #2504
Some changes that needs to be reviewed -
I imported
{ TABLE_THREADS } from '@mastra/core/storage'
directly, becauseMastraStorage.TABLE_THREADS
was showing deprecated.VSCode Warning
Some helper functions that were done because of REST API implementation.
getKV(key)
redis.get(key)
putKV(key, value)
redis.set(key, value)
deleteKV(key)
redis.del(key)
listKV(prefix)
redis.keys(pattern)
zadd
,zrank
,zrange
putKV
,getKV
(JSON)redis.set
,redis.get
Note: I took some help from chatgpt to structure this code for clarity, but I ensured the correctness of the mappings based on my understanding.