@vercel/functions 2.2.7 → 2.2.8
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/CHANGELOG.md +6 -0
- package/db-connections/index.d.ts +6 -2
- package/db-connections/index.js +4 -1
- package/docs/modules/index.md +28 -3
- package/index.d.ts +1 -1
- package/index.js +2 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -72,10 +72,14 @@ export type DbPool = PgPool | MySQLPool | MySQL2Pool | MariaDBPool | MongoDBPool
|
|
|
72
72
|
* const pgPool = new Pool({
|
|
73
73
|
* connectionString: process.env.DATABASE_URL,
|
|
74
74
|
* });
|
|
75
|
-
*
|
|
75
|
+
* attachDatabasePool(pgPool);
|
|
76
76
|
* ```
|
|
77
77
|
*
|
|
78
78
|
* @experimental
|
|
79
79
|
*/
|
|
80
|
-
export declare function
|
|
80
|
+
export declare function attachDatabasePool(dbPool: DbPool): void;
|
|
81
|
+
/**
|
|
82
|
+
* @deprecated Use attachDatabasePool instead.
|
|
83
|
+
*/
|
|
84
|
+
export declare const experimental_attachDatabasePool: typeof attachDatabasePool;
|
|
81
85
|
export {};
|
package/db-connections/index.js
CHANGED
|
@@ -18,6 +18,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var db_connections_exports = {};
|
|
20
20
|
__export(db_connections_exports, {
|
|
21
|
+
attachDatabasePool: () => attachDatabasePool,
|
|
21
22
|
experimental_attachDatabasePool: () => experimental_attachDatabasePool
|
|
22
23
|
});
|
|
23
24
|
module.exports = __toCommonJS(db_connections_exports);
|
|
@@ -87,7 +88,7 @@ function waitUntilIdleTimeout(dbPool) {
|
|
|
87
88
|
console.warn("Pool release event triggered outside of request scope.");
|
|
88
89
|
}
|
|
89
90
|
}
|
|
90
|
-
function
|
|
91
|
+
function attachDatabasePool(dbPool) {
|
|
91
92
|
if (idleTimeout) {
|
|
92
93
|
idleTimeoutResolve?.();
|
|
93
94
|
clearTimeout(idleTimeout);
|
|
@@ -142,7 +143,9 @@ function experimental_attachDatabasePool(dbPool) {
|
|
|
142
143
|
}
|
|
143
144
|
throw new Error("Unsupported database pool type");
|
|
144
145
|
}
|
|
146
|
+
const experimental_attachDatabasePool = attachDatabasePool;
|
|
145
147
|
// Annotate the CommonJS export names for ESM import in node:
|
|
146
148
|
0 && (module.exports = {
|
|
149
|
+
attachDatabasePool,
|
|
147
150
|
experimental_attachDatabasePool
|
|
148
151
|
});
|
package/docs/modules/index.md
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
### Functions
|
|
12
12
|
|
|
13
|
+
- [attachDatabasePool](index.md#attachdatabasepool)
|
|
13
14
|
- [experimental_attachDatabasePool](index.md#experimental_attachdatabasepool)
|
|
14
15
|
- [geolocation](index.md#geolocation)
|
|
15
16
|
- [getCache](index.md#getcache)
|
|
@@ -21,9 +22,9 @@
|
|
|
21
22
|
|
|
22
23
|
## Functions
|
|
23
24
|
|
|
24
|
-
###
|
|
25
|
+
### attachDatabasePool
|
|
25
26
|
|
|
26
|
-
▸ **
|
|
27
|
+
▸ **attachDatabasePool**(`dbPool`): `void`
|
|
27
28
|
|
|
28
29
|
Call this function right after creating a database pool with the database pool object
|
|
29
30
|
as argument.
|
|
@@ -36,7 +37,7 @@ idle database connections to be removed from the pool.
|
|
|
36
37
|
const pgPool = new Pool({
|
|
37
38
|
connectionString: process.env.DATABASE_URL,
|
|
38
39
|
});
|
|
39
|
-
|
|
40
|
+
attachDatabasePool(pgPool);
|
|
40
41
|
```
|
|
41
42
|
|
|
42
43
|
#### Parameters
|
|
@@ -55,6 +56,30 @@ experimental_attachDatabasePool(pgPool);
|
|
|
55
56
|
|
|
56
57
|
---
|
|
57
58
|
|
|
59
|
+
### experimental_attachDatabasePool
|
|
60
|
+
|
|
61
|
+
▸ **experimental_attachDatabasePool**(`dbPool`): `void`
|
|
62
|
+
|
|
63
|
+
**`Deprecated`**
|
|
64
|
+
|
|
65
|
+
Use attachDatabasePool instead.
|
|
66
|
+
|
|
67
|
+
#### Parameters
|
|
68
|
+
|
|
69
|
+
| Name | Type |
|
|
70
|
+
| :------- | :------- |
|
|
71
|
+
| `dbPool` | `DbPool` |
|
|
72
|
+
|
|
73
|
+
#### Returns
|
|
74
|
+
|
|
75
|
+
`void`
|
|
76
|
+
|
|
77
|
+
#### Defined in
|
|
78
|
+
|
|
79
|
+
[packages/functions/src/db-connections/index.ts:221](https://github.com/vercel/vercel/blob/main/packages/functions/src/db-connections/index.ts#L221)
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
58
83
|
### geolocation
|
|
59
84
|
|
|
60
85
|
▸ **geolocation**(`request`): [`Geo`](../interfaces/index.Geo.md)
|
package/index.d.ts
CHANGED
|
@@ -4,5 +4,5 @@ export { getEnv } from './get-env';
|
|
|
4
4
|
export { waitUntil } from './wait-until';
|
|
5
5
|
export { rewrite, next } from './middleware';
|
|
6
6
|
export { getCache } from './cache';
|
|
7
|
-
export { experimental_attachDatabasePool } from './db-connections';
|
|
7
|
+
export { attachDatabasePool, experimental_attachDatabasePool, } from './db-connections';
|
|
8
8
|
export type { RuntimeCache } from './cache/types';
|
package/index.js
CHANGED
|
@@ -18,6 +18,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var src_exports = {};
|
|
20
20
|
__export(src_exports, {
|
|
21
|
+
attachDatabasePool: () => import_db_connections.attachDatabasePool,
|
|
21
22
|
experimental_attachDatabasePool: () => import_db_connections.experimental_attachDatabasePool,
|
|
22
23
|
geolocation: () => import_headers.geolocation,
|
|
23
24
|
getCache: () => import_cache.getCache,
|
|
@@ -36,6 +37,7 @@ var import_cache = require("./cache");
|
|
|
36
37
|
var import_db_connections = require("./db-connections");
|
|
37
38
|
// Annotate the CommonJS export names for ESM import in node:
|
|
38
39
|
0 && (module.exports = {
|
|
40
|
+
attachDatabasePool,
|
|
39
41
|
experimental_attachDatabasePool,
|
|
40
42
|
geolocation,
|
|
41
43
|
getCache,
|