• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

typeorm / typeorm / 22870173721

09 Mar 2026 07:07PM UTC coverage: 74.771% (+0.003%) from 74.768%
22870173721

push

github

web-flow
feat(invalid-where-values-behavior): make throw the default (#11710)

26506 of 31974 branches covered (82.9%)

Branch coverage included in aggregate %.

6 of 10 new or added lines in 3 files covered. (60.0%)

2 existing lines in 1 file now uncovered.

84167 of 116041 relevant lines covered (72.53%)

65789.27 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/data-source/BaseDataSourceOptions.ts
1
import type { EntitySchema } from "../entity-schema/EntitySchema"
×
2
import type { LoggerOptions } from "../logger/LoggerOptions"
×
3
import type { NamingStrategyInterface } from "../naming-strategy/NamingStrategyInterface"
×
4
import type { DatabaseType } from "../driver/types/DatabaseType"
×
5
import type { Logger } from "../logger/Logger"
×
6
import type { DataSource } from "../data-source/DataSource"
×
7
import type { QueryResultCache } from "../cache/QueryResultCache"
×
8
import type { MixedList } from "../common/MixedList"
×
9

×
10
/**
×
11
 * BaseDataSourceOptions is set of DataSourceOptions shared by all database types.
×
12
 */
×
13
export interface BaseDataSourceOptions {
×
14
    /**
×
15
     * Database type. This value is required.
×
16
     */
×
17
    readonly type: DatabaseType
×
18

×
19
    /**
×
20
     * Entities to be loaded for this connection.
×
21
     * Accepts both entity classes and directories where from entities need to be loaded.
×
22
     * Directories support glob patterns.
×
23
     */
×
24
    readonly entities?: MixedList<Function | string | EntitySchema>
×
25

×
26
    /**
×
27
     * Subscribers to be loaded for this connection.
×
28
     * Accepts both subscriber classes and directories where from subscribers need to be loaded.
×
29
     * Directories support glob patterns.
×
30
     */
×
31
    readonly subscribers?: MixedList<Function | string>
×
32

×
33
    /**
×
34
     * Migrations to be loaded for this connection.
×
35
     * Accepts both migration classes and glob patterns representing migration files.
×
36
     */
×
37
    readonly migrations?: MixedList<Function | string>
×
38

×
39
    /**
×
40
     * Migrations table name, in case of different name from "migrations".
×
41
     * Accepts single string name.
×
42
     */
×
43
    readonly migrationsTableName?: string
×
44

×
45
    /**
×
46
     * Transaction mode for migrations to run in
×
47
     */
×
48
    readonly migrationsTransactionMode?: "all" | "none" | "each"
×
49

×
50
    /**
×
51
     * Typeorm metadata table name, in case of different name from "typeorm_metadata".
×
52
     * Accepts single string name.
×
53
     */
×
54
    readonly metadataTableName?: string
×
55

×
56
    /**
×
57
     * Naming strategy to be used to name tables and columns in the database.
×
58
     */
×
59
    readonly namingStrategy?: NamingStrategyInterface
×
60

×
61
    /**
×
62
     * Logging options.
×
63
     */
×
64
    readonly logging?: LoggerOptions
×
65

×
66
    /**
×
67
     * Logger instance used to log queries and events in the ORM.
×
68
     */
×
69
    readonly logger?:
×
70
        | "advanced-console"
×
71
        | "simple-console"
×
72
        | "formatted-console"
×
73
        | "file"
×
74
        | "debug"
×
75
        | Logger
×
76

×
77
    /**
×
78
     * Maximum number of milliseconds query should be executed before logger log a warning.
×
79
     */
×
80
    readonly maxQueryExecutionTime?: number
×
81

×
82
    /**
×
83
     * Maximum number of clients the pool should contain.
×
84
     */
×
85
    readonly poolSize?: number
×
86

×
87
    /**
×
88
     * Indicates if database schema should be auto created on every application launch.
×
89
     * Be careful with this option and don't use this in production - otherwise you can lose production data.
×
90
     * This option is useful during debug and development.
×
91
     * Alternative to it, you can use CLI and run schema:sync command.
×
92
     *
×
93
     * Note that for MongoDB database it does not create schema, because MongoDB is schemaless.
×
94
     * Instead, it syncs just by creating indices.
×
95
     */
×
96
    readonly synchronize?: boolean
×
97

×
98
    /**
×
99
     * Indicates if migrations should be auto run on every application launch.
×
100
     * Alternative to it, you can use CLI and run migrations:run command.
×
101
     */
×
102
    readonly migrationsRun?: boolean
×
103

×
104
    /**
×
105
     * Drops the schema each time connection is being established.
×
106
     * Be careful with this option and don't use this in production - otherwise you'll lose all production data.
×
107
     * This option is useful during debug and development.
×
108
     */
×
109
    readonly dropSchema?: boolean
×
110

×
111
    /**
×
112
     * Prefix to use on all tables (collections) of this connection in the database.
×
113
     */
×
114
    readonly entityPrefix?: string
×
115

×
116
    /**
×
117
     * When creating new Entity instances, skip all constructors when true.
×
118
     */
×
119
    readonly entitySkipConstructor?: boolean
×
120

×
121
    /**
×
122
     * Extra connection options to be passed to the underlying driver.
×
123
     *
×
124
     * todo: deprecate this and move all database-specific types into hts own connection options object.
×
125
     */
×
126
    readonly extra?: any
×
127

×
128
    /**
×
129
     * Specifies how relations must be loaded - using "joins" or separate queries.
×
130
     * If you are loading too much data with nested joins it's better to load relations
×
131
     * using separate queries.
×
132
     *
×
133
     * Default strategy is "join", but this default can be changed here.
×
134
     * Also, strategy can be set per-query in FindOptions and QueryBuilder.
×
135
     */
×
136
    readonly relationLoadStrategy?: "join" | "query"
×
137

×
138
    /**
×
139
     * Optionally applied "typename" to the model.
×
140
     * If set, then each hydrated model will have this property with the target model / entity name inside.
×
141
     *
×
142
     * (works like a discriminator property).
×
143
     */
×
144
    readonly typename?: string
×
145

×
146
    /**
×
147
     * Holds reference to the baseDirectory where configuration file are expected.
×
148
     * @internal
×
149
     */
×
150
    baseDirectory?: string
×
151

×
152
    /**
×
153
     * Allows to setup cache options.
×
154
     */
×
155
    readonly cache?:
×
156
        | boolean
×
157
        | {
×
158
              /**
×
159
               * Type of caching.
×
160
               *
×
161
               * - "database" means cached values will be stored in the separate table in database. This is default value.
×
162
               * - "redis" means cached values will be stored inside redis. You must provide redis connection options.
×
163
               */
×
164
              readonly type?:
×
165
                  | "database"
×
166
                  | "redis"
×
167
                  | "ioredis"
×
168
                  | "ioredis/cluster" // todo: add mongodb and other cache providers as well in the future
×
169

×
170
              /**
×
171
               * Factory function for custom cache providers that implement QueryResultCache.
×
172
               */
×
173
              readonly provider?: (dataSource: DataSource) => QueryResultCache
×
174

×
175
              /**
×
176
               * Configurable table name for "database" type cache.
×
177
               * Default value is "query-result-cache"
×
178
               */
×
179
              readonly tableName?: string
×
180

×
181
              /**
×
182
               * Used to provide redis connection options.
×
183
               */
×
184
              readonly options?: any
×
185

×
186
              /**
×
187
               * If set to true then queries (using find methods and QueryBuilder's methods) will always be cached.
×
188
               */
×
189
              readonly alwaysEnabled?: boolean
×
190

×
191
              /**
×
192
               * Time in milliseconds in which cache will expire.
×
193
               * This can be setup per-query.
×
194
               * Default value is 1000 which is equivalent to 1 second.
×
195
               */
×
196
              readonly duration?: number
×
197

×
198
              /**
×
199
               * Used to specify if cache errors should be ignored, and pass through the call to the Database.
×
200
               */
×
201
              readonly ignoreErrors?: boolean
×
202
          }
×
203

×
204
    /**
×
205
     * Allows automatic isolation of where clauses
×
206
     */
×
207
    readonly isolateWhereStatements?: boolean
×
208

×
209
    /**
×
210
     * Controls how null and undefined values are handled in find operations.
×
211
     */
×
212
    readonly invalidWhereValuesBehavior?: {
×
213
        /**
×
214
         * How to handle null values in where conditions.
×
NEW
215
         * - 'ignore': Skip null properties
×
216
         * - 'sql-null': Transform null to SQL NULL
×
NEW
217
         * - 'throw': Throw an error when null is encountered (default)
×
218
         */
×
219
        readonly null?: "ignore" | "sql-null" | "throw"
×
220

×
221
        /**
×
222
         * How to handle undefined values in where conditions.
×
NEW
223
         * - 'ignore': Skip undefined properties
×
NEW
224
         * - 'throw': Throw an error when undefined is encountered (default)
×
225
         */
×
226
        readonly undefined?: "ignore" | "throw"
×
227
    }
×
228
}
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc