Skip to content

Commit daeeba1

Browse files
authored
refactor(sap)!: remove SapConnectionOptions' deprecated properties (#12080)
1 parent 5f6eb4c commit daeeba1

4 files changed

Lines changed: 21 additions & 51 deletions

File tree

docs/docs/drivers/sap.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,16 @@ See [Data Source Options](../data-source/2-data-source-options.md) for the commo
2222
- `encrypt` - Whether to encrypt the connection. For example, `true`.
2323
- `sslValidateCertificate` - Whether to validate the SSL certificate. For example, `true`.
2424
- `key`, `cert` and `ca` - Private key, public certificate and certificate authority for the encrypted connection.
25+
- `driver` - Optional explicit `@sap/hana-client` module instance. If omitted, TypeORM loads `@sap/hana-client` automatically.
2526
- `pool` — Connection pool configuration object:
2627
- `maxConnectedOrPooled` (number) — Max active or idle connections in the pool (default: 10).
2728
- `maxPooledIdleTime` (seconds) — Time before an idle connection is closed (default: 30).
2829
- `maxWaitTimeoutIfPoolExhausted` (milliseconds) - Time to wait for a connection to become available (default: 0, no wait). Requires `@sap/hana-client` version `2.27` or later.
2930
- `pingCheck` (boolean) — Whether to validate connections before use (default: false).
3031
- `poolCapacity` (number) — Maximum number of connections to be kept available (default: no limit).
3132

33+
Removed legacy aliases: `hanaClientDriver`, `pool.max`, `pool.requestTimeout`, `pool.idleTimeout`, `pool.min`, `pool.maxWaitingRequests`, and `pool.checkInterval`.
34+
3235
See the official documentation of SAP HANA Client for more details as well as the `extra` properties: [Node.js Connection Properties](https://help.sap.com/docs/SAP_HANA_CLIENT/f1b440ded6144a54ada97ff95dac7adf/4fe9978ebac44f35b9369ef5a4a26f4c.html).
3336

3437
## Column Types

docs/docs/guides/8-migration-v1.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,21 @@ TypeORM requires newer versions of the database client libraries.
1414

1515
The `connectorPackage` option was removed, together with the support for the old `mysql` client. The only database client supported is now `mysql2`, which TypeORM will try to load by default. If you were using `mysql` in your project, simply replace it with `mysql2`.
1616

17+
## SAP HANA
18+
19+
Several deprecated SAP HANA connection aliases were removed.
20+
21+
- `hanaClientDriver` was removed. Use `driver`.
22+
- `pool.max` was removed. Use `pool.maxConnectedOrPooled`.
23+
- `pool.requestTimeout` was removed. Use `pool.maxWaitTimeoutIfPoolExhausted`.
24+
- `pool.idleTimeout` was removed. Use `pool.maxPooledIdleTime` (seconds).
25+
- `pool.min`, `pool.maxWaitingRequests`, and `pool.checkInterval` were removed with no replacement.
26+
27+
Also note the default behavior changes in pool configuration:
28+
29+
- `pool.maxPooledIdleTime` now defaults to `30` seconds and no longer falls back to `pool.idleTimeout`.
30+
- `pool.maxWaitTimeoutIfPoolExhausted` now defaults to `0` and no longer falls back to `pool.requestTimeout`.
31+
1732
## SQLite
1833

1934
Drop support to `sqlite3` in favour of `better-sqlite3` as the primary driver for `sqlite` databases:

src/driver/sap/SapDataSourceOptions.ts

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,6 @@ export interface SapDataSourceOptions
2222
*/
2323
readonly driver?: any
2424

25-
/**
26-
* @deprecated Use {@link driver} instead.
27-
*/
28-
readonly hanaClientDriver?: any
29-
3025
/**
3126
* Pool options.
3227
*/
@@ -64,42 +59,6 @@ export interface SapDataSourceOptions
6459
*/
6560
readonly poolCapacity?: number
6661

67-
/**
68-
* Max number of connections.
69-
* @deprecated Use {@link maxConnectedOrPooled} instead.
70-
*/
71-
readonly max?: number
72-
73-
/**
74-
* Minimum number of connections.
75-
* @deprecated Obsolete, no alternative exists.
76-
*/
77-
readonly min?: number
78-
79-
/**
80-
* Maximum number of waiting requests allowed.
81-
* @deprecated Obsolete, no alternative exists.
82-
*/
83-
readonly maxWaitingRequests?: number
84-
85-
/**
86-
* Max milliseconds a request will wait for a resource before timing out.
87-
* @deprecated Use {@link maxWaitTimeoutIfPoolExhausted} instead.
88-
*/
89-
readonly requestTimeout?: number
90-
91-
/**
92-
* How often to run resource timeout checks.
93-
* @deprecated Obsolete, no alternative exists.
94-
*/
95-
readonly checkInterval?: number
96-
97-
/**
98-
* Idle timeout (in milliseconds).
99-
* @deprecated Use {@link maxPooledIdleTime} (in seconds) instead .
100-
*/
101-
readonly idleTimeout?: number
102-
10362
/**
10463
* Function handling errors thrown by drivers pool.
10564
* Defaults to logging error with `warn` level.

src/driver/sap/SapDriver.ts

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -280,18 +280,11 @@ export class SapDriver implements Driver {
280280
const poolOptions: any = {
281281
maxConnectedOrPooled:
282282
this.options.pool?.maxConnectedOrPooled ??
283-
this.options.pool?.max ??
284283
this.options.poolSize ??
285284
10,
286-
maxPooledIdleTime:
287-
this.options.pool?.maxPooledIdleTime ??
288-
(this.options.pool?.idleTimeout
289-
? this.options.pool.idleTimeout / 1000
290-
: 30),
285+
maxPooledIdleTime: this.options.pool?.maxPooledIdleTime ?? 30,
291286
maxWaitTimeoutIfPoolExhausted:
292-
this.options.pool?.maxWaitTimeoutIfPoolExhausted ??
293-
this.options.pool?.requestTimeout ??
294-
0,
287+
this.options.pool?.maxWaitTimeoutIfPoolExhausted ?? 0,
295288
}
296289
if (this.options.pool?.pingCheck) {
297290
poolOptions.pingCheck = this.options.pool.pingCheck
@@ -894,7 +887,7 @@ export class SapDriver implements Driver {
894887
* If driver dependency is not given explicitly, then try to load it via "require".
895888
*/
896889
protected loadDependencies(): void {
897-
const client = this.options.driver ?? this.options.hanaClientDriver
890+
const client = this.options.driver
898891
if (client) {
899892
this.client = client
900893

0 commit comments

Comments
 (0)