velocious 1.0.446 → 1.0.447
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/build/configuration-types.js +2 -2
- package/build/database/pool/async-tracked-multi-connection.js +3 -1
- package/build/database/record/index.js +10 -10
- package/build/frontend-models/base.js +99 -91
- package/build/frontend-models/preloader.js +7 -7
- package/build/frontend-models/query.js +18 -18
- package/build/frontend-models/use-created-event.js +1 -1
- package/build/frontend-models/use-destroyed-event.js +1 -1
- package/build/frontend-models/use-model-class-event.js +1 -1
- package/build/frontend-models/use-updated-event.js +1 -1
- package/build/routes/resolver.js +17 -14
- package/build/src/configuration-types.d.ts +6 -6
- package/build/src/configuration-types.js +3 -3
- package/build/src/database/pool/async-tracked-multi-connection.d.ts.map +1 -1
- package/build/src/database/pool/async-tracked-multi-connection.js +5 -2
- package/build/src/database/record/index.d.ts +19 -19
- package/build/src/database/record/index.d.ts.map +1 -1
- package/build/src/database/record/index.js +11 -11
- package/build/src/frontend-models/base.d.ts +163 -153
- package/build/src/frontend-models/base.d.ts.map +1 -1
- package/build/src/frontend-models/base.js +100 -92
- package/build/src/frontend-models/preloader.d.ts +10 -10
- package/build/src/frontend-models/preloader.d.ts.map +1 -1
- package/build/src/frontend-models/preloader.js +8 -8
- package/build/src/frontend-models/query.d.ts +8 -8
- package/build/src/frontend-models/query.d.ts.map +1 -1
- package/build/src/frontend-models/query.js +19 -19
- package/build/src/frontend-models/use-created-event.d.ts +2 -2
- package/build/src/frontend-models/use-created-event.d.ts.map +1 -1
- package/build/src/frontend-models/use-created-event.js +2 -2
- package/build/src/frontend-models/use-destroyed-event.d.ts +1 -1
- package/build/src/frontend-models/use-destroyed-event.d.ts.map +1 -1
- package/build/src/frontend-models/use-destroyed-event.js +2 -2
- package/build/src/frontend-models/use-model-class-event.d.ts +1 -1
- package/build/src/frontend-models/use-model-class-event.d.ts.map +1 -1
- package/build/src/frontend-models/use-model-class-event.js +2 -2
- package/build/src/frontend-models/use-updated-event.d.ts +1 -1
- package/build/src/frontend-models/use-updated-event.d.ts.map +1 -1
- package/build/src/frontend-models/use-updated-event.js +2 -2
- package/build/src/routes/resolver.d.ts.map +1 -1
- package/build/src/routes/resolver.js +7 -4
- package/build/src/utils/model-scope.d.ts +4 -4
- package/build/src/utils/model-scope.d.ts.map +1 -1
- package/build/src/utils/model-scope.js +3 -3
- package/build/src/utils/ransack.d.ts +1 -1
- package/build/src/utils/ransack.d.ts.map +1 -1
- package/build/src/utils/ransack.js +2 -2
- package/build/utils/model-scope.js +2 -2
- package/build/utils/ransack.js +1 -1
- package/package.json +1 -1
- package/src/configuration-types.js +2 -2
- package/src/database/pool/async-tracked-multi-connection.js +3 -1
- package/src/database/record/index.js +10 -10
- package/src/frontend-models/base.js +99 -91
- package/src/frontend-models/preloader.js +7 -7
- package/src/frontend-models/query.js +18 -18
- package/src/frontend-models/use-created-event.js +1 -1
- package/src/frontend-models/use-destroyed-event.js +1 -1
- package/src/frontend-models/use-model-class-event.js +1 -1
- package/src/frontend-models/use-updated-event.js +1 -1
- package/src/routes/resolver.js +17 -14
- package/src/utils/model-scope.js +2 -2
- package/src/utils/ransack.js +1 -1
package/README.md
CHANGED
|
@@ -1453,7 +1453,7 @@ database: {
|
|
|
1453
1453
|
}
|
|
1454
1454
|
```
|
|
1455
1455
|
|
|
1456
|
-
`pool.max` caps live async-tracked connections for that pool. When the cap is reached, new checkouts wait until a matching checked-in connection can be handed over or capacity is freed. The built-in debug endpoint reports each in-use connection's `checkedOutForMs`, each idle connection's `idleForMs`, and queued `pendingCheckouts[].waitingForMs` so production diagnostics can distinguish long-held checkouts from pool-capacity waits.
|
|
1456
|
+
`pool.max` caps live async-tracked connections for that pool and defaults to `10` when omitted. When the cap is reached, new checkouts wait until a matching checked-in connection can be handed over or capacity is freed. Set `pool.max` to `null` only when a process is deliberately allowed to open an unbounded number of database connections. The built-in debug endpoint reports each in-use connection's `checkedOutForMs`, each idle connection's `idleForMs`, and queued `pendingCheckouts[].waitingForMs` so production diagnostics can distinguish long-held checkouts from pool-capacity waits.
|
|
1457
1457
|
|
|
1458
1458
|
# Websockets
|
|
1459
1459
|
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
* @property {boolean} [options.trustServerCertificate] - Whether to trust the server certificate (MSSQL).
|
|
45
45
|
* @property {string} [password] - Password for the SQL user.
|
|
46
46
|
* @property {object} [pool] - Connection pool configuration.
|
|
47
|
-
* @property {number} [pool.max] - Maximum number of connections.
|
|
47
|
+
* @property {number | null} [pool.max] - Maximum number of connections. Set null to disable the cap.
|
|
48
48
|
* @property {number} [pool.min] - Minimum number of connections.
|
|
49
49
|
* @property {number} [pool.idleTimeoutMillis] - Idle timeout before releasing a connection.
|
|
50
50
|
* @property {string} [server] - SQL server hostname.
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
/**
|
|
55
55
|
* @typedef {object} DatabasePoolConfiguration
|
|
56
56
|
* @property {number | null} [idleTimeoutMillis] - Idle timeout before closing a checked-in async-tracked connection. Set null to disable idle reaping. Default: 5000.
|
|
57
|
-
* @property {number} [max] - Maximum live async-tracked connections for this pool. Extra checkouts wait until a matching connection is checked in or capacity is freed.
|
|
57
|
+
* @property {number | null} [max] - Maximum live async-tracked connections for this pool. Defaults to 10. Extra checkouts wait until a matching connection is checked in or capacity is freed. Set null to disable the cap.
|
|
58
58
|
*/
|
|
59
59
|
|
|
60
60
|
/**
|
|
@@ -6,6 +6,7 @@ import BasePool, {POOL_CONFIGURATION_KEY} from "./base.js"
|
|
|
6
6
|
export const CLOSED_CONNECTION = Symbol("velociousClosedConnection")
|
|
7
7
|
const IDLE_CONNECTION_CHECKED_IN_AT = Symbol("velociousIdleConnectionCheckedInAt")
|
|
8
8
|
const CONNECTION_CHECKED_OUT_AT = Symbol("velociousConnectionCheckedOutAt")
|
|
9
|
+
const DEFAULT_MAX_CONNECTIONS = 10
|
|
9
10
|
const DEFAULT_IDLE_TIMEOUT_MILLIS = 5000
|
|
10
11
|
|
|
11
12
|
/**
|
|
@@ -285,9 +286,10 @@ export default class VelociousDatabasePoolAsyncTrackedMultiConnection extends Ba
|
|
|
285
286
|
maxConnections() {
|
|
286
287
|
const value = this.getConfiguration().pool?.max
|
|
287
288
|
|
|
289
|
+
if (value === null) return
|
|
288
290
|
if (this.validMaxConnections(value)) return value
|
|
289
291
|
|
|
290
|
-
return
|
|
292
|
+
return DEFAULT_MAX_CONNECTIONS
|
|
291
293
|
}
|
|
292
294
|
|
|
293
295
|
/**
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Model class constructor type used for static `this` typing.
|
|
16
|
-
* @template
|
|
16
|
+
* @template T
|
|
17
17
|
* @typedef {{new (changes?: Record<string, unknown>): T}} ModelConstructor
|
|
18
18
|
*/
|
|
19
19
|
|
|
@@ -508,7 +508,7 @@ class VelociousDatabaseRecord {
|
|
|
508
508
|
/**
|
|
509
509
|
* Runs before validation.
|
|
510
510
|
* @template R
|
|
511
|
-
* @this {
|
|
511
|
+
* @this {ModelConstructor<R>}
|
|
512
512
|
* @param {LifecycleCallbackType<R>} callback - Callback function or instance method name.
|
|
513
513
|
* @returns {void}
|
|
514
514
|
*/
|
|
@@ -519,7 +519,7 @@ class VelociousDatabaseRecord {
|
|
|
519
519
|
/**
|
|
520
520
|
* Runs before save.
|
|
521
521
|
* @template R
|
|
522
|
-
* @this {
|
|
522
|
+
* @this {ModelConstructor<R>}
|
|
523
523
|
* @param {LifecycleCallbackType<R>} callback - Callback function or instance method name.
|
|
524
524
|
* @returns {void}
|
|
525
525
|
*/
|
|
@@ -530,7 +530,7 @@ class VelociousDatabaseRecord {
|
|
|
530
530
|
/**
|
|
531
531
|
* Runs before create.
|
|
532
532
|
* @template R
|
|
533
|
-
* @this {
|
|
533
|
+
* @this {ModelConstructor<R>}
|
|
534
534
|
* @param {LifecycleCallbackType<R>} callback - Callback function or instance method name.
|
|
535
535
|
* @returns {void}
|
|
536
536
|
*/
|
|
@@ -541,7 +541,7 @@ class VelociousDatabaseRecord {
|
|
|
541
541
|
/**
|
|
542
542
|
* Runs before update.
|
|
543
543
|
* @template R
|
|
544
|
-
* @this {
|
|
544
|
+
* @this {ModelConstructor<R>}
|
|
545
545
|
* @param {LifecycleCallbackType<R>} callback - Callback function or instance method name.
|
|
546
546
|
* @returns {void}
|
|
547
547
|
*/
|
|
@@ -552,7 +552,7 @@ class VelociousDatabaseRecord {
|
|
|
552
552
|
/**
|
|
553
553
|
* Runs before destroy.
|
|
554
554
|
* @template R
|
|
555
|
-
* @this {
|
|
555
|
+
* @this {ModelConstructor<R>}
|
|
556
556
|
* @param {LifecycleCallbackType<R>} callback - Callback function or instance method name.
|
|
557
557
|
* @returns {void}
|
|
558
558
|
*/
|
|
@@ -563,7 +563,7 @@ class VelociousDatabaseRecord {
|
|
|
563
563
|
/**
|
|
564
564
|
* Runs after save.
|
|
565
565
|
* @template R
|
|
566
|
-
* @this {
|
|
566
|
+
* @this {ModelConstructor<R>}
|
|
567
567
|
* @param {LifecycleCallbackType<R>} callback - Callback function or instance method name.
|
|
568
568
|
* @returns {void}
|
|
569
569
|
*/
|
|
@@ -574,7 +574,7 @@ class VelociousDatabaseRecord {
|
|
|
574
574
|
/**
|
|
575
575
|
* Runs after create.
|
|
576
576
|
* @template R
|
|
577
|
-
* @this {
|
|
577
|
+
* @this {ModelConstructor<R>}
|
|
578
578
|
* @param {LifecycleCallbackType<R>} callback - Callback function or instance method name.
|
|
579
579
|
* @returns {void}
|
|
580
580
|
*/
|
|
@@ -585,7 +585,7 @@ class VelociousDatabaseRecord {
|
|
|
585
585
|
/**
|
|
586
586
|
* Runs after update.
|
|
587
587
|
* @template R
|
|
588
|
-
* @this {
|
|
588
|
+
* @this {ModelConstructor<R>}
|
|
589
589
|
* @param {LifecycleCallbackType<R>} callback - Callback function or instance method name.
|
|
590
590
|
* @returns {void}
|
|
591
591
|
*/
|
|
@@ -596,7 +596,7 @@ class VelociousDatabaseRecord {
|
|
|
596
596
|
/**
|
|
597
597
|
* Runs after destroy.
|
|
598
598
|
* @template R
|
|
599
|
-
* @this {
|
|
599
|
+
* @this {ModelConstructor<R>}
|
|
600
600
|
* @param {LifecycleCallbackType<R>} callback - Callback function or instance method name.
|
|
601
601
|
* @returns {void}
|
|
602
602
|
*/
|