Skip to content

Remove APIs marked as deprecated in v0.3.0 #11603

Closed

Description

@michaelbromley

In v0.3.0, several APIs were changed but the existing APIs were kept but marked as deprecated.

Examples: Connection -> DataSource, findByIds.

In the v1.0 of TypeORM, we will remove these deprecated APIs.

This issue is currently a placeholder to track the overall task, but needs to have a list of the exact APIs to be removed, and should be referenced in any PRs removing these APIs.

MongoDB/BSON: Seems those deprecations are rather from the client, we just copy-pasted the types. Not sure if we need to do anything there.

Activity

  1. added this to the Next Major milestone on Aug 16, 2025
  2. jovanadjuric commented on Aug 18, 2025

    @jovanadjuric
    Contributor

    Releasing v1.0 without any deprecated APIs sounds like a good idea. I'll start working on it this week and I'll document things as I go. I'll keep you posted

  3. alumni commented on Aug 18, 2025

    @alumni
    Collaborator

    @jovanadjuric nice, there might be some things that don't have an alternative (or some deprecated functions that are used internally).

    I'm thinking about ConnectionManager - we actually implemented our own in our project, but others might still rely on it. I don't think it should be a part of the ORM, but could be released as a separate package. Might be easier with the monorepo. Or we can let the community do that.

    I think one that is used internally is findByIds - in SubjectDatabaseEntityLoader and PlainObjectToDatabaseEntityTransformer. First usage is probably easy to replace, second IDK. Not sure if there others.

    We might need to decide how to separate the work for the next patch and the next major. Shall we create a main branch and make it the default?

    @michaelbromley @naorpeled maybe we can have a meeting when everyone's back from holidays (late August / early September?) to plan the next major.

  4. naorpeled commented on Aug 18, 2025

    @naorpeled
    Member

    @jovanadjuric nice, there might be some things that don't have an alternative (or some deprecated functions that are used internally).

    I'm thinking about ConnectionManager - we actually implemented our own in our project, but others might still rely on it. I don't think it should be a part of the ORM, but could be released as a separate package. Might be easier with the monorepo. Or we can let the community do that.

    I think one that is used internally is findByIds - in SubjectDatabaseEntityLoader and PlainObjectToDatabaseEntityTransformer. First usage is probably easy to replace, second IDK. Not sure if there others.

    We might need to decide how to separate the work for the next patch and the next major. Shall we create a main branch and make it the default?

    @michaelbromley @naorpeled maybe we can have a meeting when everyone's back from holidays (late August / early September?) to plan the next major.

    Yeah, let's do that, I'll send a poll at the beginning of September

  5. moved this to Planned in TypeORM Roadmapon Dec 3, 2025
  6. michaelbromley commented on Feb 20, 2026

    @michaelbromley
    MemberAuthor

    Deprecated API Survey — TypeORM v1.0

    Full inventory of all deprecated APIs in src/ (excluding upstream MongoDB driver typings in typings.ts).

    Totals

    Metric Count
    Total @deprecated JSDoc tags 95 (across 41 files)
    Unique @deprecated symbols 92 (3 extra tags from createConnection overloads)
    Comment-deprecated items 2 (lock modes in SelectQueryBuilder.ts)
    Total deprecated items 94

    By Removal Risk

    Risk Count Description
    Safe 41 Pure aliases/renames, dead code, or no internal deps beyond re-exports
    Moderate 28 Has test usage and/or minor internal deps, but no deep coupling
    Hard 23 Has active internal src/ dependencies that must be migrated first
    Needs analysis 2 Removal desirability is unclear — maintainer decision required

    Recommended Removal Phases

    Phase 1 — Safe removals (41 items)

    Zero internal dependency, lowest user disruption. Can be done in a single PR or small batch.

    • All 13 global functions (src/globals.ts)
    • Container module: UseContainerOptions, ContainedType, ContainerInterface, defaultContainer, useContainer (5 items)
    • Repository.exist() (delegates to exists())
    • WhereExpression interface (empty extends alias)
    • InsertQueryBuilder.orUpdate() object-arg overload
    • SAP dead pool options: pool.min, pool.maxWaitingRequests, pool.checkInterval (3 items)
    • SAP fallback aliases: hanaClientDriver, pool.max, pool.requestTimeout (3 items)
    • MongoDB SSL aliases: ssl, sslCA, sslCRL, sslCert, sslKey, sslPass, sslValidate (7 items)
    • MongoDB write concern aliases: w, wtimeoutMS (2 items)
    • Binary.SUBTYPE_UUID_OLD
    • DriverUtils.buildColumnAlias
    • EntityMetadata.createPropertyPath
    • MigrationExecutor.getAllMigrations
    • Broadcaster.broadcastLoadEventsForAll
    Phase 2 — Moderate removals (28 items)

    Require test suite migration and/or minor internal code changes.

    • DataSource members: name, isConnected, connect(), close(), getCustomRepository() + BaseDataSourceOptions.name (6 items)
    • ConnectionManager, ConnectionOptions type alias (2 items)
    • EntityManager: findOneById, getCustomRepository, MongoEntityManager.findOneById (3 items)
    • Repository: findOneById × 3 variants, BaseEntity.findByIds, BaseEntity.findOneById (4 items)
    • QueryBuilder: replacePropertyNames (no-op stub, remove call sites), onConflict (2 items)
    • Find Options: FindOneOptions.join, JoinOptions (2 items)
    • Lock modes: pessimistic_partial_write, pessimistic_write_or_fail (2 items)
    • Column options: ColumnNumericOptions.unsigned, ColumnOptions.readonly, EntitySchemaColumnOptions.readonly (3 items)
    • Driver: SAP pool.idleTimeout, MongoDB keepAlive/keepAliveInitialDelay, SqlServer domain (4 items)
    Phase 3 — Hard removals (23 items)

    Require significant internal migration before removal. Should be done as focused sub-projects.

    Sub-project A: Container + Connection subsystem (4 items)

    • getFromContainer → refactor ConnectionMetadataBuilder off IoC container pattern
    • Connection class → migrate SpannerDriver to use DataSource
    • BaseConnectionOptions → migrate SpannerConnectionOptions to extend BaseDataSourceOptions
    • ConnectionOptionsEnvReader → refactor ConnectionOptionsReader to inline env reading

    Sub-project B: findByIds persistence migration (4 items)

    • EntityManager.findByIds, MongoEntityManager.findByIds, Repository.findByIds, MongoRepository.findByIds
    • Blocked by: PlainObjectToDatabaseEntityTransformer.ts:135 and SubjectDatabaseEntityLoader.ts:118 must be migrated to use findBy + In operator

    Sub-project C: Custom repository system removal (3 items)

    • AbstractRepository class
    • EntityRepository decorator
    • Must remove together with entityRepositories metadata storage, DataSource.getCustomRepository, and EntityManager.getCustomRepository

    Sub-project D: RelationCount pipeline (1 item)

    • RelationCount decorator → delete RelationCountAttribute, RelationCountLoader, RelationCountMetadata, RelationCountMetadataToAttributeTransformer

    Sub-project E: nativeParameters refactor (2 items)

    • QueryExpressionMap.nativeParameters + QueryBuilder.setNativeParameters
    • Requires rewriting escapeQueryWithParameters in all 12 driver files

    Sub-project F: OrderByCondition replacement (1 item)

    • OrderByCondition type used in 9 src/ files (QueryExpressionMap, entity metadata, entity schema, decorators)
    • Requires defining a new type and updating all references

    Sub-project G: MySQL width/zerofill removal (7 items)

    • 6 zerofill/width properties across 4 interfaces + MysqlQueryRunner.isDefaultColumnWidth
    • Deeply embedded in schema generation, junction/closure table builders, and driver query runners

    Sub-project H: QueryRunner cache properties (2 items)

    • QueryRunner.loadedTables, QueryRunner.loadedViews
    • Used in 20+ locations in RdbmsSchemaBuilder — major refactor to use getTables()/getViews() instead

    Needs Maintainer Decision

    Symbol Issue
    FindOptionsSelectByString Removing breaks .find({ select: ["name", "email"] }) string-array syntax. SelectQueryBuilder has explicit Array.isArray() branches (lines 3256, 3276, 3773, 3778) and MongoEntityManager handles it too. Is this syntax actually meant to be removed in v1?
    FindOptionsRelationByString Removing breaks .find({ relations: ["author", "category"] }) string-array syntax. Same Array.isArray() branches in SelectQueryBuilder. Is this syntax actually meant to be removed in v1?

    Items Flagged as Potentially Incorrectly Deprecated

    Symbol Reason
    MysqlQueryRunner.isDefaultColumnWidth Actively called during loadTables() schema introspection. No replacement method exists. AuroraMysqlQueryRunner has its own non-deprecated copy. Deprecation tag may be premature.
    FindOptionsSelectByString Powers a widely-used user-facing syntax; unclear if deprecation was intentional or aspirational
    FindOptionsRelationByString Same as above
    OrderByCondition Core internal type with 9 src/ dependents; no replacement type exists; @deprecated tag has no replacement text

    Key Internal Dependency Chains

    DataSource.initialize()
      → ConnectionMetadataBuilder.build()
        → getFromContainer()           ← deprecated (container.ts)
          → defaultContainer           ← deprecated (container.ts)
    
    DataSource.save() / .remove()
      → EntityPersistExecutor.execute()
        → SubjectDatabaseEntityLoader
          → MongoRepository.findByIds() ← deprecated
            → MongoEntityManager.findByIds() ← deprecated
    
    DataSource.manager.preload()
      → PlainObjectToDatabaseEntityTransformer.transform()
        → EntityManager.findByIds()    ← deprecated
    
    EntityRepository decorator
      → getMetadataArgsStorage().entityRepositories
      → EntityManager.getCustomRepository() ← deprecated
        → instanceof AbstractRepository    ← deprecated
    

    Per-Category Detail

    1. Global Functions (src/globals.ts) — 13 items, all Safe

    All 13 functions are deprecated with no replacement text. All publicly exported via export * from "./globals". None are imported by non-deprecated src/ code. createConnection() has 4 overloaded signatures (lines 63, 70, 77, 90).

    Symbol Kind File Replacement Internal src/ usage Test usage Pure alias? Still used internally? Risk
    getConnectionOptions() function :44 — 0 3 files (stub names) No No Safe
    getConnectionManager() function :55 — 0 0 No No Safe
    createConnection() function :65–101 — 0 0 No No Safe
    createConnections() function :112 — 0 0 No No Safe
    getConnection() function :132 — 0 0 No No Safe
    getManager() function :142 — 0 0 No No Safe
    getMongoManager() function :152 — 0 0 No No Safe
    getSqljsManager() function :166 — 0 0 No No Safe
    getRepository() function :178 — 0 0 No No Safe
    getTreeRepository() function :192 — 0 0 No No Safe
    getCustomRepository() function :206 — 0 0 No No Safe
    getMongoRepository() function :220 — 0 0 No No Safe
    createQueryBuilder() function :234 — 0 0 No No Safe

    2. Connection Module (src/connection/) — 5 items

    Symbol Kind File Replacement Internal src/ usage Test usage Pure alias? Still used internally? Risk Notes
    Connection class Connection.ts:10 — SpannerDriver.ts (type + constructor param) 4 files (type imports) Yes (extends DataSource, no body) Yes — SpannerDriver Hard Must migrate SpannerDriver first
    ConnectionManager class ConnectionManager.ts:12 — globals.ts (deprecated) 2 files (15 refs) No (has Map-backed store logic) No Moderate
    ConnectionOptions type ConnectionOptions.ts:10 DataSourceOptions index.ts re-export only 15 files (59 refs) Yes (= DataSourceOptions) No Moderate Wide test surface
    BaseConnectionOptions type BaseConnectionOptions.ts:8 — SpannerConnectionOptions.ts extends it 0 Yes (= BaseDataSourceOptions) Yes — non-deprecated driver code Hard Not publicly exported
    ConnectionOptionsEnvReader class ConnectionOptionsEnvReader.ts:12 — ConnectionOptionsReader.ts (non-deprecated) depends on it 0 No (reads ~20 env vars) Yes Hard Removal requires refactoring ConnectionOptionsReader

    3. Container Module (src/container.ts) — 6 items

    Symbol Kind File Replacement Internal src/ usage Test usage Pure alias? Still used internally? Risk Notes
    UseContainerOptions interface :3 — 0 0 Yes No Safe
    ContainedType<T> type :18 — 0 0 Yes Indirectly (param type of getFromContainer) Safe
    ContainerInterface interface :23 — 0 0 Yes No Safe
    defaultContainer variable :32 — Used by getFromContainer() 0 No (singleton cache logic) Yes — fallback container Safe Not exported; removed with module
    useContainer() function :59 — 0 0 No No Safe Consumer-facing IoC integration
    getFromContainer() function :72 — globals.ts, ConnectionMetadataBuilder.ts (3 calls) 0 No Yes — ConnectionMetadataBuilder is non-deprecated Hard DataSource → ConnectionMetadataBuilder → getFromContainer

    4. DataSource Deprecated Members — 6 items

    Symbol Kind File Replacement Internal src/ usage Test usage Pure alias? Still used internally? Risk Notes
    DataSource.name property DataSource.ts:67 (none — "don't need names anymore") ConnectionManager.ts (deprecated) + self error messages (6 sites) 19 refs / 8 files No Yes — error messages Moderate
    BaseDataSourceOptions.name property BaseDataSourceOptions.ts:25 — DataSource.ts:143, ConnectionOptionsReader.ts:59,78 10 refs No Yes — constructor reads it Moderate Must remove with DataSource.name
    DataSource.isConnected getter DataSource.ts:170 isInitialized 0 7 refs / 2 files Yes (→ isInitialized) No Moderate
    DataSource.connect() method DataSource.ts:295 initialize() globals.ts (deprecated) 17 refs / 9 files Yes (→ initialize()) No (non-deprecated) Moderate
    DataSource.close() method DataSource.ts:320 destroy() 0 22 refs / 8 files Yes (→ destroy()) No Moderate
    DataSource.getCustomRepository() method DataSource.ts:502 Repository.extend globals.ts (deprecated) 3 refs / 2 files Yes (→ manager.getCustomRepository()) No (non-deprecated) Moderate

    5. Entity Manager — 5 items

    Symbol Kind File Replacement Internal src/ usage Test usage Pure alias? Still used internally? Risk Notes
    EntityManager.findByIds() method EntityManager.ts:1285 findBy + In PlainObjectToDatabaseEntityTransformer.ts:135, SubjectDatabaseEntityLoader.ts:118 8 refs / 4 files No (own query logic) Yes — persistence + preload Hard Core save/remove path depends on this
    EntityManager.findOneById() method EntityManager.ts:1366 findOneBy 0 7 refs / 5 files No No Moderate
    EntityManager.getCustomRepository() method EntityManager.ts:1621 Repository.extend DataSource.ts:503 (deprecated) 3 refs / 2 files No (has AbstractRepository branch) Only from deprecated caller Moderate
    MongoEntityManager.findByIds() method MongoEntityManager.ts:180 findBy SubjectDatabaseEntityLoader.ts:118 4 refs / 2 files No (MongoDB-specific) Yes — persistence code Hard
    MongoEntityManager.findOneById() method MongoEntityManager.ts:263 findOneBy 0 0 No No Moderate

    6. Repository & BaseEntity — 7 items

    Symbol Kind File Replacement Internal src/ usage Test usage Pure alias? Still used internally? Risk Notes
    Repository.exist() method Repository.ts:499 exists() 0 0 Yes (→ manager.exists()) No Safe
    Repository.findByIds() method Repository.ts:625 findBy + In SubjectDatabaseEntityLoader.ts (Mongo branch) 8 refs / 4 files Yes (→ manager.findByIds()) Yes — MongoDB persistence Hard
    Repository.findOneById() method Repository.ts:657 findOneBy 0 7 refs / 5 files Yes (→ manager.findOneById()) No Moderate
    MongoRepository.findByIds() method MongoRepository.ts:137 findBy + In SubjectDatabaseEntityLoader.ts:118 4 refs / 2 files Yes (→ manager.findByIds()) Yes — persistence code Hard
    MongoRepository.findOneById() method MongoRepository.ts:166 findOneBy 0 0 Yes (→ manager.findOneById()) No Moderate
    BaseEntity.findByIds() static method BaseEntity.ts:532 findBy + In 0 0 Yes (→ getRepository().findByIds()) No Moderate
    BaseEntity.findOneById() static method BaseEntity.ts:568 findOneBy 0 0 Yes (→ getRepository().findOneById()) No Moderate

    7. AbstractRepository — 1 item

    Symbol Kind File Replacement Internal src/ usage Test usage Pure alias? Still used internally? Risk Notes
    AbstractRepository class AbstractRepository.ts:19 Repository.extend EntityManager.ts (import + instanceof check in getCustomRepository) 6 refs / 3 test files No (protected helpers) Yes — EntityManager.getCustomRepository Hard Must remove with getCustomRepository + EntityRepository decorator

    8. Decorators — 2 items

    Symbol Kind File Replacement Internal src/ usage Test usage Pure alias? Still used internally? Risk Notes
    EntityRepository decorator EntityRepository.ts:12 Repository.extend 5 files (error-handling + lookup logic) 3 test files No (writes to metadata storage) Yes — DataSource/EntityManager resolve custom repos via this Hard Removing requires deleting entire entityRepositories metadata path
    RelationCount decorator RelationCount.ts:11 VirtualColumn 2 files (RelationCountMetadataToAttributeTransformer, RelationCountMetadata) 13 refs / 6 test files No (writes to metadata storage) Yes — relation-count pipeline active Hard Removing requires deleting entire relation-count subsystem

    9. Query Builder — 6 items

    Symbol Kind File Replacement Internal src/ usage Test usage Pure alias? Still used internally? Risk Notes
    setNativeParameters() method QueryBuilder.ts:444 setParameters SelectQueryBuilder.ts:3668 (pagination) 0 No Yes — pagination code Hard Cannot remove without nativeParameters
    nativeParameters property QueryExpressionMap.ts:341 Standard parameters 15 files (all 12 drivers read it) 0 No Yes — every driver Hard Core parameter-passing contract
    replacePropertyNames() method (protected) QueryBuilder.ts:723 replacePropertyNamesForTheWholeQuery 13+ call sites 0 No (but is a no-op stub) Yes — calls are harmless no-ops Moderate Low actual risk, just many call sites
    onConflict() method InsertQueryBuilder.ts:371 orIgnore/orUpdate 0 (method); expressionMap.onConflict consumed at :563–564 6 refs / 2 files No No Moderate Must also remove createInsertExpression branch
    orUpdate() (object overload) method overload InsertQueryBuilder.ts:396 .orUpdate(["col"], ["conflict_col"]) 0 0 No No Safe Can remove object signature + !Array.isArray branch
    WhereExpression interface WhereExpressionBuilder.ts:144 WhereExpressionBuilder 0 0 Yes (empty extends) No Safe Name alias only

    10. Find Options — 5 items

    Symbol Kind File Replacement Internal src/ usage Test usage Pure alias? Still used internally? Risk Notes
    FindOneOptions.join property FindOneOptions.ts:53 — SelectQueryBuilder.ts:3411–3447 handles it 0 No Yes Moderate
    JoinOptions interface JoinOptions.ts:35 — FindOneOptions.ts (type of join) 0 No Yes Moderate Different from query-builder/JoinOptions.ts
    OrderByCondition type OrderByCondition.ts:12 — 9 files (QueryExpressionMap.orderBys, entity metadata, etc.) 0 No Yes — core QB type Hard No replacement exists; deprecation may be aspirational
    FindOptionsSelectByString type FindOptionsSelect.ts:43 FindOptionsSelect (object form) FindOneOptions.ts:27, MongoEntityManager.ts:981 0 No Yes — Array.isArray() branches in SelectQueryBuilder Needs analysis Removing breaks .find({ select: ["name", "email"] })
    FindOptionsRelationByString type FindOptionsRelations.ts:43 FindOptionsRelations (object form) FindOneOptions.ts:37 0 No Yes — Array.isArray() branches in SelectQueryBuilder Needs analysis Removing breaks .find({ relations: ["author"] })

    11. Lock Modes (comment-deprecated) — 2 items

    These use // deprecated inline comments (not @deprecated JSDoc), so they're invisible to TypeScript deprecation warnings.

    Symbol Kind Locations Replacement Test usage Risk Notes
    "pessimistic_partial_write" lock-mode SelectQueryBuilder.ts:1635,1661,2885; QueryExpressionMap.ts:200; FindOneOptions.ts:83 pessimistic_write + onLocked: "skip_locked" 22 refs / 2 test files Moderate Both modes can be removed together
    "pessimistic_write_or_fail" lock-mode SelectQueryBuilder.ts:1636,1662,2896; QueryExpressionMap.ts:201; FindOneOptions.ts:84 pessimistic_write + onLocked: "nowait" (shared count above) Moderate Touches 4 source + 2 test files

    12. Column/Schema Options — 9 items

    MySQL 8.0.17+ deprecated display width and zerofill at the database level. These properties are deeply embedded in TypeORM's schema generation.

    Symbol Kind File Replacement Internal src/ usage Test usage Pure alias? Still used internally? Risk
    ColumnNumericOptions.zerofill property ColumnNumericOptions.ts:26 LPAD function 27 refs / 12 files 11 refs / 6 files No Yes Hard
    ColumnNumericOptions.unsigned property ColumnNumericOptions.ts:33 — Multiple Present No Yes Moderate
    ColumnOptions.width property ColumnOptions.ts:32 LPAD function 6 refs / 3 files 19 refs / 4 files No Yes Hard
    ColumnOptions.readonly property ColumnOptions.ts:49 update (inverted) 3 refs 4 refs No Yes Moderate
    ColumnOptions.zerofill property ColumnOptions.ts:115 LPAD function Shared 27 refs 11 refs No Yes Hard
    ColumnUnsignedOptions.width property ColumnUnsignedOptions.ts:13 LPAD function Shared refs Shared refs No Yes Hard
    ColumnUnsignedOptions.zerofill property ColumnUnsignedOptions.ts:24 LPAD function Shared 27 refs Shared refs No Yes Hard
    PrimaryGeneratedColumnNumericOptions.zerofill property PrimaryGeneratedColumnNumericOptions.ts:29 LPAD function Shared 0 No Yes Hard
    EntitySchemaColumnOptions.readonly property EntitySchemaColumnOptions.ts:88 update (inverted) 1 ref (EntitySchemaTransformer.ts) 0 No Yes Moderate

    13. Driver-specific Options — 22 items

    SAP HANA (SapConnectionOptions.ts)

    Symbol Kind Replacement Internal src/ usage Risk Notes
    hanaClientDriver property driver SapDriver.ts (?? fallback) Safe
    pool.max property pool.maxConnectedOrPooled SapDriver.ts (?? fallback) Safe
    pool.min property (obsolete, no alternative) 0 — never read Safe Dead option
    pool.maxWaitingRequests property (obsolete, no alternative) 0 — never read Safe Dead option
    pool.requestTimeout property pool.maxWaitTimeoutIfPoolExhausted SapDriver.ts (?? fallback) Safe
    pool.checkInterval property (obsolete, no alternative) 0 — never read Safe Dead option
    pool.idleTimeout property pool.maxPooledIdleTime (seconds, not ms) SapDriver.ts (divides by 1000) Moderate Unit conversion: ms→s

    MongoDB (MongoConnectionOptions.ts)

    Symbol Kind Replacement Internal src/ usage Risk Notes
    keepAlive property (none) validOptionNames passthrough Moderate Upstream deprecated
    keepAliveInitialDelay property (none) validOptionNames passthrough Moderate
    ssl property tls validOptionNames passthrough Safe
    sslCA property tlsCAFile validOptionNames passthrough Safe
    sslCRL property (none) validOptionNames passthrough Safe
    sslCert property tlsCertificateKeyFile validOptionNames passthrough Safe
    sslKey property tlsCertificateKeyFile validOptionNames passthrough Safe
    sslPass property tlsCertificateKeyFilePassword validOptionNames passthrough Safe
    sslValidate property tlsAllowInvalidCertificates validOptionNames passthrough Safe
    w property writeConcern validOptionNames passthrough Safe
    wtimeoutMS property writeConcern validOptionNames passthrough Safe

    Other Drivers

    Symbol Kind File Replacement Internal src/ usage Risk Notes
    Binary.SUBTYPE_UUID_OLD property bson.typings.ts:18 SUBTYPE_UUID 0 Safe Upstream BSON typing
    SqlServerCredentials.domain property SqlServerConnectionCredentialsOptions.ts:66 authentication/NtlmAuthentication SqlServerDriver.ts translates to NTLM auth Moderate
    MysqlQueryRunner.isDefaultColumnWidth() method MysqlQueryRunner.ts:3402 — Called in loadTables() (2 internal refs) Hard Possibly incorrectly deprecated — no replacement exists
    DriverUtils.buildColumnAlias() method DriverUtils.ts:153 buildAlias 0 Safe

    14. Misc — 5 items

    Symbol Kind File Replacement Internal src/ usage Test usage Pure alias? Still used internally? Risk Notes
    EntityMetadata.createPropertyPath() static method EntityMetadata.ts:934 — 0 external callers 1 ref No No Safe Old dead copy; QueryBuilder has its own
    QueryRunner.loadedTables property QueryRunner.ts:60 getTables() 16+ refs (RdbmsSchemaBuilder, BaseQueryRunner) 0 No (cache array) Yes — backbone of schema sync Hard 20+ read/write sites in RdbmsSchemaBuilder
    QueryRunner.loadedViews property QueryRunner.ts:67 getViews() 10+ refs (RdbmsSchemaBuilder, BaseQueryRunner) 0 No (cache array) Yes Hard Same as loadedTables
    MigrationExecutor.getAllMigrations() method MigrationExecutor.ts:98 getMigrations 0 0 Yes (→ getMigrations()) No Safe
    Broadcaster.broadcastLoadEventsForAll() method Broadcaster.ts:804 broadcastLoadEvent 0 0 Yes (→ broadcastLoadEvent()) No Safe JSDoc says broadcastLoadForAllEvent but actual method is broadcastLoadEvent
  7. michaelbromley commented on Mar 10, 2026

    @michaelbromley
    MemberAuthor

    Deprecated API Survey — TypeORM (2026-03-09)

    Follow-up to the previous survey performed earlier. This documents what has been removed and what remains.

    Note: This survey accounts for 4 in-flight PRs that are expected to merge imminently:

    • #12114 — Remove deprecated findByIds from Repository and EntityManager
    • #12149 — Replace deprecated substr with modern alternatives (no deprecated API impact)
    • #12159 — Batch DROP statements in CockroachDB (no deprecated API impact)
    • #12164 — Batch DROP statements in Postgres (no deprecated API impact)

    Summary

    Metric Previous Survey On master today After in-flight PRs merge
    @deprecated JSDoc tags (excl. MongoDB typings) 95 (41 files) 37 (15 files) 27 (12 files)
    Comment-deprecated items (// deprecated) 2 0 0
    Total deprecated items 94 35 25

    69 of the original 94 deprecated items will have been removed once the in-flight PRs merge. 25 will remain.


    Items REMOVED Since Previous Survey

    Already merged (58 items)

    Phase 1 — Safe removals (all 41 removed)

    All 41 items previously tagged "Safe" have been successfully removed:

    • All 13 global functions (src/globals.ts): getConnectionOptions, getConnectionManager, createConnection, createConnections, getConnection, getManager, getMongoManager, getSqljsManager, getRepository, getTreeRepository, getCustomRepository, getMongoRepository, createQueryBuilder — the file now only contains getMetadataArgsStorage()
    • Container module (5 items): UseContainerOptions, ContainedType, ContainerInterface, defaultContainer, useContainer — Note: these still exist in container.ts but see "Still Present" section
    • Repository.exist() — removed (only non-deprecated exists() remains)
    • WhereExpression interface — removed (replaced by WhereExpressionBuilder)
    • InsertQueryBuilder.orUpdate() object-arg overload — removed
    • SAP dead pool options (3): pool.min, pool.maxWaitingRequests, pool.checkInterval — removed
    • SAP fallback aliases (3): hanaClientDriver, pool.max, pool.requestTimeout — removed
    • MongoDB SSL aliases (7): ssl, sslCA, sslCRL, sslCert, sslKey, sslPass, sslValidate — still present in MongoDataSourceOptions.ts, see below
    • MongoDB write concern aliases (2): w, wtimeoutMS — still present, see below
    • Binary.SUBTYPE_UUID_OLD — still present in bson.typings.ts (upstream typing, excluded from count)
    • DriverUtils.buildColumnAlias() — removed
    • EntityMetadata.createPropertyPath() — removed
    • MigrationExecutor.getAllMigrations() — removed
    • Broadcaster.broadcastLoadEventsForAll() — removed
    Phase 2 — Moderate removals (17 of 28 removed)
    • DataSource members (all 6 removed): DataSource.name, BaseDataSourceOptions.name, DataSource.isConnected, DataSource.connect(), DataSource.close(), DataSource.getCustomRepository()
    • ConnectionManager — removed
    • ConnectionOptions type alias — removed
    • EntityManager.getCustomRepository() — removed
    • QueryBuilder.replacePropertyNames() no-op stub — still present but no longer deprecated (the @deprecated JSDoc remains, and it is still actively called ~20 times)
    • InsertQueryBuilder.onConflict() — removed
    • Lock modes (2): pessimistic_partial_write, pessimistic_write_or_fail — both removed
    • Column options (3): ColumnNumericOptions.unsigned, ColumnOptions.readonly, EntitySchemaColumnOptions.readonly — all removed (unsigned still exists as a non-deprecated property)
    • Driver options (4): SAP pool.idleTimeout, MongoDB keepAlive/keepAliveInitialDelay, SqlServer domain — SAP pool.idleTimeout removed, SqlServer domain removed; MongoDB keepAlive/keepAliveInitialDelay still present
    Phase 3 — Hard removals (partial)
    • Sub-project A (Container + Connection subsystem): Connection class, BaseConnectionOptions, ConnectionOptionsEnvReader — Connection class and BaseConnectionOptions removed. ConnectionOptionsEnvReader never existed as a separate file (was part of ConnectionOptionsReader). However, getFromContainer() is still present and still used by ConnectionMetadataBuilder.
    • Sub-project C (Custom repository system): AbstractRepository, EntityRepository decorator — both removed
    • Sub-project E (nativeParameters): nativeParameters + setNativeParameters — both removed
    • Sub-project G (MySQL width/zerofill): All 7 zerofill/width properties across 4 interfaces + MysqlQueryRunner.isDefaultColumnWidth — all removed (zerofill/width no longer in decorator options; unsigned remains as a non-deprecated property)

    Removed by in-flight PR #12114 (10 items)

    PR #12114 removes all findByIds variants and refactors the two internal callers that were blocking removal:

    • PlainObjectToDatabaseEntityTransformer → now uses createQueryBuilder().whereInIds().getMany()
    • SubjectDatabaseEntityLoader MongoDB path → now uses createEntityCursor with _id.$in directly
    Symbol File
    EntityManager.findByIds() EntityManager.ts
    MongoEntityManager.findByIds() MongoEntityManager.ts
    Repository.findByIds() Repository.ts
    MongoRepository.findByIds() MongoRepository.ts
    BaseEntity.findByIds() BaseEntity.ts
    EntityManager.findOneById() EntityManager.ts
    MongoEntityManager.findOneById() MongoEntityManager.ts
    Repository.findOneById() Repository.ts
    MongoRepository.findOneById() MongoRepository.ts
    BaseEntity.findOneById() BaseEntity.ts

    This resolves the findByIds persistence dependency chain, which was one of only 2 remaining hard blockers.


    Items STILL PRESENT After All PRs Merge (25 deprecated items)

    Container Module — 6 items (src/container.ts)

    Symbol Risk Notes
    UseContainerOptions Safe No internal usage
    ContainedType<T> Safe Only used as param type of getFromContainer
    ContainerInterface Safe No internal usage
    defaultContainer Safe Only used by getFromContainer
    useContainer() Safe No internal usage
    getFromContainer() Hard Still called by ConnectionMetadataBuilder.ts (lines 45, 68) — this is the last hard blocker

    Status: The entire container module is deprecated but getFromContainer still has a non-deprecated caller. ConnectionMetadataBuilder needs to be refactored to instantiate migrations/subscribers directly instead of going through the container.

    Query Builder — 2 items

    Symbol File Risk Notes
    replacePropertyNames() QueryBuilder.ts:706 Moderate Still deprecated but actively called ~20 times in SelectQueryBuilder, UpdateQueryBuilder, SoftDeleteQueryBuilder, and QueryBuilder itself. The previous survey noted it as a "no-op stub" but it appears to be a real method now.
    OrderByCondition OrderByCondition.ts:9 Hard Still used in 9+ src/ files. No replacement type exists.

    Find Options — 4 items

    Symbol File Risk Notes
    FindOneOptions.join FindOneOptions.ts:50 Moderate Still consumed by SelectQueryBuilder
    JoinOptions JoinOptions.ts:32 Moderate Type of FindOneOptions.join
    FindOptionsSelectByString FindOptionsSelect.ts:43 Needs decision Removing breaks .find({ select: ["name"] }) syntax
    FindOptionsRelationByString FindOptionsRelations.ts:43 Needs decision Removing breaks .find({ relations: ["author"] }) syntax

    RelationCount Decorator — 1 item

    Symbol File Risk Notes
    @RelationCount() RelationCount.ts:10 Hard Entire relation-count subsystem still active

    QueryRunner Cache — 2 items

    Symbol File Risk Notes
    QueryRunner.loadedTables QueryRunner.ts:57 Hard Still used in 16+ locations in RdbmsSchemaBuilder
    QueryRunner.loadedViews QueryRunner.ts:63 Hard Still used in 10+ locations in RdbmsSchemaBuilder

    MongoDB Driver Options — 11 items (src/driver/mongodb/MongoDataSourceOptions.ts)

    Symbol Replacement Risk
    keepAlive (none) Moderate
    keepAliveInitialDelay (none) Moderate
    ssl tls Safe
    sslCA tlsCAFile Safe
    sslCRL (none) Safe
    sslCert tlsCertificateKeyFile Safe
    sslKey tlsCertificateKeyFile Safe
    sslPass tlsCertificateKeyFilePassword Safe
    sslValidate tlsAllowInvalidCertificates Safe
    w writeConcern Safe
    wtimeoutMS writeConcern Safe

    Note: These were listed as "Safe" in the previous survey but were not removed. They are all passthrough options to the MongoDB driver and removal is straightforward.


    Remaining Blockers — Key Dependency Chains

    Only 1 hard dependency chain remains (down from 4 in the original survey, 2 on current master):

    Container chain:
      DataSource.initialize()
        → ConnectionMetadataBuilder.build()
          → getFromContainer()           ← deprecated (container.ts)
            → defaultContainer            ← deprecated (container.ts)
    

    The findByIds persistence chain, the EntityRepository/AbstractRepository/getCustomRepository chain, and the nativeParameters chain have all been fully resolved.


    Recommended Next Steps

    Immediate (Safe, no blockers)

    1. Remove MongoDB options (11 items) — pure passthrough, zero internal logic. Single PR.

    Short-term (minor refactoring)

    1. Refactor ConnectionMetadataBuilder to not use getFromContainer(), then remove entire container.ts (6 items)
    2. Remove FindOneOptions.join + JoinOptions (2 items) — moderate effort, remove SelectQueryBuilder handling

    Medium-term (focused sub-projects)

    1. Remove @RelationCount decorator — delete entire relation-count subsystem
    2. Replace OrderByCondition — define a new type and update 9+ src/ files
    3. Refactor QueryRunner.loadedTables / loadedViews — migrate RdbmsSchemaBuilder to use getTables()/getViews()

    Needs Maintainer Decision (unchanged)

    • FindOptionsSelectByString — Is .find({ select: ["name"] }) string-array syntax being removed in v1?
    • FindOptionsRelationByString — Is .find({ relations: ["author"] }) string-array syntax being removed in v1?
    • replacePropertyNames() — Tagged deprecated but actively used ~20 times. Is this actually being removed or should the tag be dropped?

    Progress Summary

    Category Original Removed (merged) Removed (in-flight) Remaining
    Global Functions 13 13 — 0
    Connection Module 5 4 — 0*
    Container Module 6 0 — 6
    DataSource Members 6 6 — 0
    Entity Manager 5 1 4 0
    Repository & BaseEntity 7 1 6 0
    AbstractRepository 1 1 — 0
    Decorators 2 1 — 1
    Query Builder 6 3 — 2 (+1 uncertain)
    Find Options 5 0 — 5
    Lock Modes 2 2 — 0
    Column/Schema Options 9 9 — 0
    SAP Driver Options 7 7 — 0
    MongoDB Driver Options 11 0 — 11
    SqlServer Options 1 1 — 0
    MySQL Driver 1 1 — 0
    Misc Utilities 5 4 — 1
    QueryRunner Cache 2 0 — 2
    Total 94 54 10 25

    * ConnectionOptionsEnvReader was folded into ConnectionOptionsReader, not a separate deprecated item

    Removal velocity

    • Original survey: 94 deprecated items
    • Removed to date (merged): 58 (62%)
    • Removed by in-flight PRs: 10 (11%)
    • Total removed after PRs merge: 69 (73%)
    • Remaining: 25 (27%)

    Of the 25 remaining, 11 are MongoDB passthrough options that could be removed in a single PR, which would bring the total down to 14 items (85% complete).

  8. GM-Alex commented on Mar 13, 2026

    @GM-Alex

    Will there be a replacement for the JoinOptions at FindOneOptions.join?

  9. alumni commented on Mar 13, 2026

    @alumni
    Collaborator

    @GM-Alex at the moment we haven't merged that PR, we still have some debate about it, but the debate is rather about accepting string[] for select/relations. I would say join would be removed since it was long time deprecated and it would cause issues with type inference in the future.

    Usually relations should cover it in most cases (the relation should be defined in the data model). There's also e.g. QueryBuilder.leftJoinAndMapMany, but I think you shouldn't have to use the QB methods in most cases.

    There's also PR #12064 that should also change the left outer joins to inner joins in case of non-nullable relations to improve performance (but would need some thorough review before merging).

    Do you have a use case that can't be handled via relations? I'd actually be curious how it looks like if you can share something :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

Projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions