Repository navigation
Conversation
📝 WalkthroughWalkthroughThis PR updates TypeScript version targets to 6.0, bumps related dev dependencies, refactors several APIs from properties to getters for encapsulation, updates JSDoc references to use fully-qualified namespaces, expands TypeDoc configuration, and makes targeted improvements to database dialect implementations. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~30 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
packages/postgres/src/connection-manager.ts (1)
393-407: Consider simplifying the redundant conditional checks.The
textFormat === 'text'conditionals on lines 395 and 403 are always true or the check is unnecessary sincetextFormatis either'text'orundefined, and both branches callgetTypeParserwith compatible arguments.♻️ Suggested simplification
if (typeData.type === 'range-array') { - return this.#buildArrayParser( - textFormat === 'text' - ? this.getTypeParser(typeData.rangeOid!, textFormat) - : this.getTypeParser(typeData.rangeOid!), - ); + return this.#buildArrayParser(this.getTypeParser(typeData.rangeOid!, 'text')); } if (typeData.type === 'array') { - return this.#buildArrayParser( - textFormat === 'text' - ? this.getTypeParser(typeData.baseOid!, textFormat) - : this.getTypeParser(typeData.baseOid!), - ); + return this.#buildArrayParser(this.getTypeParser(typeData.baseOid!, 'text')); }Since
#getCustomTypeParserreturnsnullfor binary format (line 381-383), this method only runs for text format. Always passing'text'explicitly is clearer and removes the conditional.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/postgres/src/connection-manager.ts` around lines 393 - 407, The redundant ternary checks on textFormat in the array handling should be removed: since `#getCustomTypeParser` returns null for binary, this code only runs for text, so always call getTypeParser with the explicit 'text' argument and pass its result to `#buildArrayParser`; update both branches handling typeData.type === 'range-array' and typeData.type === 'array' to call `#buildArrayParser`(getTypeParser(typeData.rangeOid!,'text')) and `#buildArrayParser`(getTypeParser(typeData.baseOid!,'text')) respectively, eliminating the conditional and keeping existing symbols (`#buildArrayParser`, getTypeParser, typeData.rangeOid, typeData.baseOid, typeData.type).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@package.json`:
- Around line 104-107: The package.json currently pins "typescript": "6.0.2"
which is incompatible with the older ts-node tool; update package.json to remove
or replace ts-node usage by switching dev-dependency and any scripts referencing
"ts-node" to a TypeScript 6-compatible runner (for example replace the ts-node
devDependency with "tsx" and update scripts that call "ts-node" to call "tsx"
instead), or if you must keep ts-node add a clear comment and constrain
TypeScript to a compatible version (<6.0) and/or change scripts to use "ts-node
--swc" as a partial workaround; locate references to the package name "ts-node"
in package.json scripts and devDependencies and update them accordingly.
---
Nitpick comments:
In `@packages/postgres/src/connection-manager.ts`:
- Around line 393-407: The redundant ternary checks on textFormat in the array
handling should be removed: since `#getCustomTypeParser` returns null for binary,
this code only runs for text, so always call getTypeParser with the explicit
'text' argument and pass its result to `#buildArrayParser`; update both branches
handling typeData.type === 'range-array' and typeData.type === 'array' to call
`#buildArrayParser`(getTypeParser(typeData.rangeOid!,'text')) and
`#buildArrayParser`(getTypeParser(typeData.baseOid!,'text')) respectively,
eliminating the conditional and keeping existing symbols (`#buildArrayParser`,
getTypeParser, typeData.rangeOid, typeData.baseOid, typeData.type).
🪄 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
Run ID: 632c1279-ec9a-48fd-805e-49839d899c2c
⛔ Files ignored due to path filters (2)
.yarn/patches/mariadb-npm-3.5.2-52603499c8.patchis excluded by!**/.yarn/**yarn.lockis excluded by!**/yarn.lock,!**/*.lock
📒 Files selected for processing (43)
.github/workflows/ci.ymlpackage.jsonpackages/core/src/abstract-dialect/query-generator-typescript.tspackages/core/src/abstract-dialect/query-generator.jspackages/core/src/associations/base.tspackages/core/src/associations/belongs-to.tspackages/core/src/decorators/shared/model.tspackages/core/src/deferrable.tspackages/core/src/expression-builders/attribute.tspackages/core/src/expression-builders/cast.tspackages/core/src/expression-builders/col.tspackages/core/src/expression-builders/dialect-aware-fn.tspackages/core/src/expression-builders/fn.tspackages/core/src/expression-builders/identifier.tspackages/core/src/expression-builders/json-path.tspackages/core/src/expression-builders/json.tspackages/core/src/expression-builders/list.tspackages/core/src/expression-builders/literal.tspackages/core/src/expression-builders/random.tspackages/core/src/expression-builders/sql.tspackages/core/src/expression-builders/value.tspackages/core/src/expression-builders/where.tspackages/core/src/model-definition.tspackages/core/src/model.d.tspackages/core/src/model.jspackages/core/src/sequelize-typescript.tspackages/core/src/sequelize.d.tspackages/core/src/sequelize.internals.tspackages/core/src/sequelize.jspackages/core/test/integration/cls.test.tspackages/core/test/integration/data-types/data-types.test.tspackages/mariadb/package.jsonpackages/mariadb/src/_internal/data-types-db.tspackages/mariadb/src/connection-manager.tspackages/mariadb/src/query.jspackages/mssql/package.jsonpackages/mysql/src/_internal/connection-options.tspackages/postgres/src/_internal/connection-options.tspackages/postgres/src/connection-manager.tspackages/snowflake/src/dialect.tspackages/utils/src/common/get-synchronized-type-keys.tstypedoc.base.jsontypedoc.js
💤 Files with no reviewable changes (2)
- packages/core/src/decorators/shared/model.ts
- packages/core/src/model-definition.ts
|
I've undone the suggestion by coderabbit to replace ts-node and will bring it back in another PR. This is large enough as it is |
ea797c8 to
adb406c
Compare
This reverts commit e53877d.
Co-authored-by: Alyx <[email protected]>
Drop the Yarn patch-based MariaDB dependency so published installs remain package-manager agnostic. Restore the pre-patch typings setup and pin 3.4.5 until the upstream type exports are fixed.
`_dataTypeFormat` is a private field of the driver's `ColumnDefinition` and is absent from its published typings. `isDataTypeFormatJson()` is public and does exactly the same comparison, so use that instead. Qualify the `orgName()` fallback by the table the column originates from. It is only reached when a column was aliased, and without the qualification a joined table could match it with a column that happens to share its original name. Cover `handleJsonSelectQuery` with unit tests, and describe it in the package's hand-written declarations so they can be typed. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
`getTypeParser` treats a missing format as the text format, so the branches that distinguished `'text'` from `undefined` all resolved to the same call. Keep only the narrowing the per-format overloads actually require. Cover the format-aware parser cache with unit tests. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Moving DEFERRED and IMMEDIATE out of the class body left their descriptions on the constructors, so the symbols the documentation points at, the static accessors, ended up without one. Cover the accessors with unit tests. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
d18d718 to
693b265
Compare
Pull Request Checklist
Description of Changes (generated by AI)
Summary
5.8,5.9, and6.0, and adjusted the codebase to work with newer dependency type surfaces.Details
TypeScript / CI
5.5-5.8to5.8-6.0.typescriptto6.0.2.@ts-ignoreworkarounds that are no longer needed with newer TypeScript versions.TypeDoc / documentation generation
typedocto0.28.19.typedoc-plugin-missing-exportsto4.1.3.sql.fn,sql.literal,ValidationError,TimeoutError,InferAttributes,InferCreationAttributes, and decorator helpers.@sequelize/coretargets so TypeDoc resolves them correctly.mysql2
enableCleartextPluginto the supported boolean connection options list.postgres
fallback_application_nameto the supported Postgres connection options.pg/pg-types.snowflake-sdk
browserRedirectPortto the supported Snowflake connection options.mariadb
^3.5.3, whose published declarations resolve under this repo'smoduleResolution: nodenext. No Yarn patch and noskipLibCheckis needed for it.isDataTypeFormatJson()rather than its private_dataTypeFormatfield, and the fallback match on a column's original name is qualified by the table it comes from, so anincludecannot match a same-named column of another table.handleJsonSelectQueryin the package's hand-written declarations.Associations / constraint checking
Association.foreignKeyto a getter and updatedBelongsToAssociationto store it privately for better type/runtime consistency.ConstraintChecking.DEFERREDandConstraintChecking.IMMEDIATEso their class names are preserved correctly, keeping their descriptions on the static accessors that the generated docs point at.Shared utility
getSynchronizedTypeKeysto string keys only, which matchesObject.keys(...)behavior and avoids newer dependency key-type mismatches.Tests
packages/mariadb/src/query.test.tscovershandleJsonSelectQuery: metadata matched by column rather than by the position of the attribute in the model, the json-format guard, the aliased-column fallback and its table qualification, and the case where no metadata describes the column.packages/postgres/src/connection-manager.test.tscovers the format-aware parser cache, including that a text parser is never handed out for the binary format, or the other way around.packages/core/test/unit/deferrable.test.tscoversConstraintChecking.DEFERREDandIMMEDIATE: accessor identity, name preservation, construction with and withoutnew, frozen constraints, andisEqual.Notes
node-gypis held at11.5.0through a resolution, becausenode-gyp@latestis now13, which requires Node >= 22, while CI still tests Node 20. No other dependency versions were pinned back to older releases.Summary by CodeRabbit
New Features
enableCleartextPlugin), PostgreSQL (fallback_application_name), and Snowflake (browserRedirectPort).Bug Fixes
Refactor
Association.foreignKeyfrom property to read-only getter.ConstraintChecking.DEFERREDandIMMEDIATEto static accessors.Dependencies
Documentation