[oracledb] Update types for node-oracledb 7.0 features#1
Conversation
…s & lob.trim() method to types
0118338 to
2f57b60
Compare
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughUpdates OracleDB TypeScript types to v7.0: adds thick-mode DSN passthrough, Deep Data Security types and APIs, synchronous appContext, direct-path load and Pipeline APIs, LOB trimming, async-dispose signatures, SQL helper functions, extended TraceHandlerBase hooks, tests, and package/tsconfig updates. ChangesOracleDB 7.0 Type Definitions
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@types/oracledb/index.d.ts`:
- Around line 1068-1099: EndUserSecurityContextOptions currently allows invalid
combinations; replace the single interface with a discriminated union of two
shapes: one for token-based context (with required databaseAccessToken and
required endUserToken, and explicitly no endUserName/key) and one for name-based
context (with required databaseAccessToken, required endUserName and required
key, and explicitly no endUserToken); preserve optional dataRoles and attributes
on both variants and ensure the union prevents both or neither being set. Use
the existing type name EndUserSecurityContextOptions and the property names
endUserToken, endUserName, and key as the discriminators so callers and tooling
pick the correct shape.
- Around line 1484-1490: The declaration of [Symbol.asyncDispose]():
Promise<void> in types/oracledb/index.d.ts (also present around the other
occurrences) requires the ESNext disposable lib / TS 5.2+ baseline; update the
package typings to declare that requirement by adding either a "Minimum
TypeScript Version: 5.2" header to the type package or inserting a triple-slash
reference directive /// <reference lib="esnext.disposable" /> at the top of
types/oracledb/index.d.ts (and ensure types/oracledb/tsconfig.json includes
"lib": ["es6","esnext.disposable"] or equivalent) so Symbol.asyncDispose is
recognized by consumers.
In `@types/oracledb/oracledb-tests.ts`:
- Around line 915-1034: Add type-checks for the new async disposal signatures by
asserting that Connection, Pool, and ResultSet implement Symbol.asyncDispose:
after obtaining `connection` in `version7Tests`, add expectType checks that
`connection[Symbol.asyncDispose]` exists and is a function, likewise for
`oracledb.Pool.prototype[Symbol.asyncDispose]` and
`oracledb.ResultSet.prototype[Symbol.asyncDispose]` (or instances obtained from
`connection.getPool()` / `connection.execute()`), ensuring the tests reference
Symbol.asyncDispose and the Connection/Pool/ResultSet types to validate the new
signatures.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: d3d08835-2d2b-4d01-8db9-44b6015f4d2d
📒 Files selected for processing (3)
types/oracledb/index.d.tstypes/oracledb/oracledb-tests.tstypes/oracledb/package.json
There was a problem hiding this comment.
🧹 Nitpick comments (1)
types/oracledb/oracledb-tests.ts (1)
1037-1042: ⚡ Quick winAdd test coverage for
trimcallback variant with length parameter.The promise-based tests cover both
trim()andtrim(10), but the callback-based test only coverstrim(callback). Consider adding test coverage fortrim(length, callback)to ensure all overload combinations are validated.✅ Suggested test addition
lob.trim(error => { expectType<oracledb.DBError | null>(error); }); +lob.trim(10, error => { + expectType<oracledb.DBError | null>(error); +});🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@types/oracledb/oracledb-tests.ts` around lines 1037 - 1042, Add a callback-based test for the lob.trim overload that accepts a length parameter: locate the LOB created via connection.createLob(oracledb.CLOB) and add a call to lob.trim(10, callback) similar to the existing lob.trim(callback) case; in the callback assert the error type with expectType<oracledb.DBError | null>(error) (and optionally validate behavior if needed) so both promise and callback overloads (trim() / trim(length) and trim(callback) / trim(length, callback)) are covered.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@types/oracledb/oracledb-tests.ts`:
- Around line 1037-1042: Add a callback-based test for the lob.trim overload
that accepts a length parameter: locate the LOB created via
connection.createLob(oracledb.CLOB) and add a call to lob.trim(10, callback)
similar to the existing lob.trim(callback) case; in the callback assert the
error type with expectType<oracledb.DBError | null>(error) (and optionally
validate behavior if needed) so both promise and callback overloads (trim() /
trim(length) and trim(callback) / trim(length, callback)) are covered.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 71f82cd5-adaf-459e-8575-a0b3f76901c0
📒 Files selected for processing (3)
types/oracledb/index.d.tstypes/oracledb/oracledb-tests.tstypes/oracledb/tsconfig.json
✅ Files skipped from review due to trivial changes (1)
- types/oracledb/tsconfig.json
🚧 Files skipped from review as they are similar to previous changes (1)
- types/oracledb/index.d.ts
| * This read-only property is a string that identifies the name of the | ||
| * pluggable database associated with the connection. This property | ||
| * returns the same value as the SQL expression: | ||
| * SELECT UPPER(SYS_CONTEXT('USERENV', 'CON_NAME')) FROM DUAL; |
There was a problem hiding this comment.
This property is also only available in Thin mode, right?
There was a problem hiding this comment.
Not actually, its not stated explicitly in documentation but I tested, conn.pdbName returns pdbName in thick mode too without NJS-089, unlike dbUniqueName
Summary
This PR updates
@types/oracledbwith node-oracledb 7.0-aligned type changes:oracledb.Pipelinepipeline.addCommit()pipeline.addExecute()pipeline.addExecuteMany()pipeline.addFetchAll()pipeline.addFetchMany()pipeline.addFetchOne()connection.runPipeline()connection.directPathLoad()DirectPathLoadColumnsDirectPathLoadDataconnection.appContext()connection.clearAppContext()AppContextKeyValue[Symbol.asyncDispose]()forConnection,Pool, andResultSetconnection.pdbNameconnection.dbUniqueNamelob.trim()typings (Promise + callback overloads)oracledb.thickModeDSNPassthroughTraceHandlerBaseoracledb.isSimpleSqlName()oracledb.isQualifiedSqlName()oracledb.enquoteLiteral()oracledb.enquoteName()oracledb.EndUserSecurityContextconstructor typingEndUserSecurityContextOptionsconnection.setEndUserSecurityContext()connection.clearEndUserSecurityContext()version7Testscoverage intypes/oracledb/oracledb-tests.tstypes/oracledb/package.json:6.10.9999->7.0.9999Checklist
pnpm test oracledb.Summary by CodeRabbit