-
Notifications
You must be signed in to change notification settings - Fork 58
Add getCrudTransactions()
returning an async generator
#693
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
Conversation
🦋 Changeset detectedLatest commit: 75c3e2c The changes in this PR will be included in the next version bump. This PR includes changesets to release 8 packages
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 |
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.
Overall looks good to me. Left some comments to consider with React Native.
Sometimes, users want a batch of data to upload while also ensuring that that batch respects transaction boundaries. At the moment, we don't really have APIs for that, because:
getCrudBatch()
returns a batch of items with a flexible size limit, but doesn't respect transaction boundaries (so it's possible to accidentally upload half of a transaction).getNextCrudTransaction()
returns a complete transaction, but nothing more. It will also always return the oldest transaction, so you can't callgetNextCrudTransaction()
multiple times to get more than one.This adds
getCrudTransactions()
, an async iterable that starts with the oldest transaction and then keeps on yielding more transactions until the iterator is closed. This gives users a tool to compose batches with flexible sizes while still ensuring everything is grouped by transactions.