chitralverma opened a new pull request, #9417:
URL: https://github.com/apache/opendal/pull/9417

   # Which issue does this PR close?
   
   Part of #9322 (tracker: #9320).
   
   # Rationale for this change
   
   Node.js does not expose the core `WriteOptions::expires` and 
`content_language` fields. D#4931 asks for a per-write TTL on `redis` from 
Python. Typical Node.js uses:
   - Cache a session blob in `redis` for one hour: `op.write('sessions/abc', 
blob, { expires: 3600 })`.
   - Upload a localized page to S3: `op.write('docs/fr-CA/index.html', html, { 
contentLanguage: 'fr-CA' })`.
   
   # What changes are included in this PR?
   
   - `WriteOptions` gets the optional members `contentLanguage?: string` and 
`expires?: number`, and the conversion passes both to core.
   - `expires` is a `number` of seconds, like the presign `expires`, with the 
same check: an integer from 1 to 4294967295.
   - The JSDoc comes from core in Node.js names. Core's "A zero or 
unrepresentable duration" reads "A duration that the service cannot represent", 
because the binding rejects `0` first.
   - Tests: the surface test adds both members and invalid `expires` values. 
The write suites check a stored `contentLanguage` and an expired file.
   
   # Are there any user-facing changes?
   
   - `write`, `writeSync`, `writer`, and `writerSync` accept `expires` and 
`contentLanguage`.
   - Type check only: a value with either member of another type no longer 
matches `WriteOptions`, for example a class with `expires = '1h'`. Mapped types 
such as `Required<WriteOptions>` get both members.
   - Behavior: napi ignored both members before. Now `expires` fails with 
`Unsupported` except on `redis` and `memcached`. `s3` and `memory` store 
`contentLanguage`; other services ignore it.
   
   Verified: `generated.d.ts` vs `main` adds only the two members; TypeScript 
probes match the type impact. Through all four write methods: files expire on 
`redis` 7.4 and `memcached` 1.6, `expires` overrides `default_ttl`, and 
`contentLanguage` round-trips on `s3` (Silo). Each new test and guard fails 
under a mutation. All `ci_odev` generators, fmt and `git diff --exit-code`; dev 
and Node.js tests and clippy.
   
   Not verified: Redis cluster, TLS, Dragonfly, and kvrocks; AWS S3. PR CI 
skips the `expires` suite test; nightly `redis` and `memcached` jobs run it.
   
   # Breaking changes
   
   None
   
   # AI Usage Statement
   
   - **Harness:** Claude Code via T3 Code | **Model:** Claude Opus 5.5 | 
**Effort:** xhigh
   - **Role:** Implemented the changes and tests, verified the docs on real 
servers, drafted this text. The author reviews every change and claim.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to