Skip to content

Commit 0b15126

Browse files
authored
Merge branch 'main' into mikeroelens/pending-connections
2 parents 7d135a7 + bdf1e87 commit 0b15126

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+2265
-1076
lines changed

.husky/pre-commit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/usr/bin/env sh
22
. "$(dirname -- "$0")/_/husky.sh"
33

4-
npm run lint && npm run test && npm run build
4+
npm run lint

README.md

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ Note: Using this project does not require TypeScript. It is a regular ES6 module
110110
* [`sql.timestamp`](#sqltimestamp)
111111
* [`sql.unnest`](#sqlunnest)
112112
* [`sql.unsafe`](#sqlunsafe)
113+
* [`sql.uuid`](#sqluuid)
113114
* [Query methods](#query-methods)
114115
* [`any`](#any)
115116
* [`anyFirst`](#anyfirst)
@@ -312,7 +313,7 @@ const pool = createPool('postgres://', {
312313
```
313314

314315
> [!NOTE]
315-
> Reseting a connection is a heavy operation. Depending on the application requirements, it may make sense to disable connection reset, e.g.
316+
> Resetting a connection is a heavy operation. Depending on the application requirements, it may make sense to disable connection reset, e.g.
316317
> ```ts
317318
> import {
318319
> createPool,
@@ -456,7 +457,10 @@ Supported parameters:
456457
|---|---|---|
457458
|`application_name`|[`application_name`](https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNECT-APPLICATION-NAME)||
458459
|`options`|[`options`](https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNECT-OPTIONS)||
459-
|`sslmode`|[`sslmode`](https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNECT-SSLMODE) (supported values: `disable`, `no-verify`, `require`)|`disable`|
460+
|`sslcert`|The location of the [certificate](https://www.postgresql.org/docs/current/libpq-ssl.html#LIBPQ-SSL-CLIENTCERT).|-|
461+
|`sslkey`|The location of the [certificate](https://www.postgresql.org/docs/current/libpq-ssl.html#LIBPQ-SSL-CLIENTCERT).|-|
462+
|`sslmode`|[`sslmode`](https://www.postgresql.org/docs/current/libpq-ssl.html#LIBPQ-SSL-PROTECTION) (supported values: `disable`, `no-verify`, `require`)|`disable`|
463+
|`sslrootcert`|The location of the [root certificate]((https://www.postgresql.org/docs/current/libpq-ssl.html#LIBQ-SSL-CERTIFICATES)) file.||
460464
461465
Note that unless listed above, other [libpq parameters](https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-PARAMKEYWORDS) are not supported.
462466
@@ -2212,6 +2216,33 @@ const result = await connection.one(sql.unsafe`
22122216
* Use `sql.typeAlias` to alias an existing type
22132217
* Use `sql.fragment` if you are writing a fragment of a query
22142218
2219+
### <code>sql.uuid</code>
2220+
2221+
```ts
2222+
(
2223+
uuid: string
2224+
) => TimestampSqlToken;
2225+
```
2226+
2227+
Inserts a UUID, e.g.
2228+
2229+
```ts
2230+
await connection.query(sql.unsafe`
2231+
SELECT ${sql.uuid('00000000-0000-0000-0000-000000000000')}
2232+
`);
2233+
```
2234+
2235+
Produces:
2236+
2237+
```ts
2238+
{
2239+
sql: 'SELECT $1::uuid',
2240+
values: [
2241+
'00000000-0000-0000-0000-000000000000'
2242+
]
2243+
}
2244+
```
2245+
22152246
## Query methods
22162247
22172248
### <code>any</code>
@@ -2563,6 +2594,8 @@ import {
25632594
parseDsn('postgresql://foo@localhost/bar?application_name=baz');
25642595
```
25652596
2597+
See [supported parameters](#connection-uri).
2598+
25662599
### <code>stringifyDsn</code>
25672600
25682601
```ts
@@ -2765,7 +2798,7 @@ The Slonik community has also shared their successes with these Node.js framewor
27652798
27662799
This package is using [TypeScript](http://typescriptlang.org/) types.
27672800
2768-
Refer to [`./src/types.ts`](./src/types.ts).
2801+
Refer to [`./packages/slonik/src/types.ts`](./packages/slonik/src/types.ts).
27692802
27702803
The public interface exports the following types:
27712804

cspell.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,6 @@ words:
1515
- kuizinas
1616
- plpgsql
1717
- roarr
18-
- slonik
18+
- slonik
19+
- sslcert
20+
- sslrootcert

knip.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
],
77
"ignoreDependencies": [
88
"@changesets/cli",
9-
"eslint-config-canonical",
9+
"@slonik/test-ssls",
1010
"husky"
1111
],
1212
"project": [

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
"packages/*"
1111
],
1212
"scripts": {
13-
"lint": "npm run lint:knip",
14-
"lint:knip": "knip"
13+
"lint:knip": "knip",
14+
"lint": "npm run lint:knip"
1515
},
1616
"dependencies": {
1717
"@changesets/cli": "^2.27.1"

packages/benchmark/CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# @slonik/benchmark
22

3+
## 46.3.0
4+
5+
### Patch Changes
6+
7+
- Updated dependencies [[`960bf89`](https://github.com/gajus/slonik/commit/960bf891f8f280551cc405210ea87e8dca2ff278)]:
8+
9+
310
## 46.2.0
411

512
### Patch Changes

packages/benchmark/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
"pg": "^8.13.1",
77
"pg-promise": "^11.10.2",
88
"postgres": "^3.4.5",
9-
"slonik": "^46.2.0"
9+
"slonik": "^46.3.0"
1010
},
1111
"scripts": {
1212
"benchmark": "NODE_ENV=production node benchmark.js"
1313
},
14-
"version": "46.2.0"
14+
"version": "46.3.0"
1515
}

packages/driver/CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# @slonik/driver
22

3+
## 46.3.0
4+
5+
### Patch Changes
6+
7+
- Updated dependencies []:
8+
- @slonik/types@46.3.0
9+
- @slonik/utilities@46.3.0
10+
311
## 46.2.0
412

513
### Patch Changes

packages/driver/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
]
1717
},
1818
"dependencies": {
19-
"@slonik/types": "^46.2.0",
20-
"@slonik/utilities": "^46.2.0",
19+
"@slonik/types": "^46.3.0",
20+
"@slonik/utilities": "^46.3.0",
2121
"roarr": "^7.21.1",
2222
"serialize-error": "^8.0.0",
2323
"strict-event-emitter-types": "^2.0.0"
@@ -28,7 +28,7 @@
2828
"@types/node": "^22.9.0",
2929
"ava": "^6.1.3",
3030
"cspell": "^8.16.0",
31-
"eslint": "^9.14.0",
31+
"eslint": "^9.16.0",
3232
"nyc": "^15.1.0",
3333
"ts-node": "^10.9.1",
3434
"typescript": "^5.6.3"
@@ -82,5 +82,5 @@
8282
"test": "nyc ava --verbose --serial"
8383
},
8484
"types": "./dist/index.d.ts",
85-
"version": "46.2.0"
85+
"version": "46.3.0"
8686
}

packages/errors/CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# @slonik/errors
22

3+
## 46.3.0
4+
5+
### Patch Changes
6+
7+
- Updated dependencies []:
8+
- @slonik/types@46.3.0
9+
310
## 46.2.0
411

512
### Patch Changes

0 commit comments

Comments
 (0)