-
Notifications
You must be signed in to change notification settings - Fork 703
feat(bindings/nodejs): Add DeleteOptions support for new options API #6349
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
|
Hi, this PR LGTM to me. I will let Copilot in to see how it works. |
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.
Pull Request Overview
Adds support for versioned delete options in the Node.js bindings and updates tests and capabilities accordingly.
- Defines a N-API
DeleteOptionsstruct with conversion to the Rustopendal::options::DeleteOptions. - Extends
Operatormethods (delete/delete_sync) to accept optional delete options. - Introduces
delete_with_versioncapability and adds corresponding async/sync test suites.
Reviewed Changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| bindings/nodejs/src/options.rs | Added N-API DeleteOptions struct and From impl |
| bindings/nodejs/src/lib.rs | Updated delete/delete_sync to accept delete options |
| bindings/nodejs/src/capability.rs | Added delete_with_version getter |
| bindings/nodejs/tests/suites/asyncDeleteOptions.suite.mjs | New async delete options tests |
| bindings/nodejs/tests/suites/syncDeleteOptions.suite.mjs | New sync delete options tests |
| bindings/nodejs/tests/suites/index.mjs | Registered the new delete options test suites |
Comments suppressed due to low confidence (5)
bindings/nodejs/tests/suites/syncDeleteOptions.suite.mjs:31
- The suite title is incorrect for synchronous tests. Rename 'async delete options' to 'sync delete options' to reflect the correct context.
describe.runIf(capability.write && capability.delete)('async delete options', () => {
bindings/nodejs/tests/suites/syncDeleteOptions.suite.mjs:88
- This test does not assert the outcome of deleting with a non-existing version. Consider adding an assertion (e.g.,
assert.isTrue(op.existsSync(filename2))) to verify the file was not deleted.
op.deleteSync(filename2, { version })
bindings/nodejs/tests/suites/asyncDeleteOptions.suite.mjs:88
- There is no assertion confirming that the file remains after a delete with a non-matching version. Add something like
assert.isTrue(await op.exists(filename2))after this line.
await op.delete(filename2, { version })
bindings/nodejs/tests/suites/syncDeleteOptions.suite.mjs:81
- This references
filename, which is undefined in this scope. It should usefilename1to retrieve the metadata.
const meta = op.statSync(filename)
bindings/nodejs/tests/suites/asyncDeleteOptions.suite.mjs:81
filenameis undefined here; you likely meantfilename1to get the metadata for the first file.
const meta = await op.stat(filename)
fd7c3ff to
ecedccc
Compare
ecedccc to
cb4b551
Compare
|
Thank you @kingsword09 for working on this! |
Which issue does this PR close?
Related to #6281.
Rationale for this change
This PR adds support for opendal::options::DeleteOptions conversion in the nodejs bindings. This is part of the migration to the new options API outlined in RFC-6213 (#6213).
What changes are included in this PR?
Are there any user-facing changes?
Yes, users can now add options to their delete requests