Skip to content

Commit df54360

Browse files
committed
Merge branch 'master' of github.com:brianc/node-postgres
2 parents 2f5e812 + 0b9bb34 commit df54360

Some content is hidden

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

61 files changed

+2025
-1327
lines changed

.eslintrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"plugins": ["prettier"],
33
"parser": "@typescript-eslint/parser",
44
"extends": ["plugin:prettier/recommended", "prettier/@typescript-eslint"],
5-
"ignorePatterns": ["node_modules", "coverage", "packages/pg-protocol/dist/**/*"],
5+
"ignorePatterns": ["node_modules", "coverage", "packages/pg-protocol/dist/**/*", "packages/pg-query-stream/dist/**/*"],
66
"parserOptions": {
77
"ecmaVersion": 2017,
88
"sourceType": "module"

.travis.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,38 @@ matrix:
4343
postgresql: '9.5'
4444
dist: precise
4545

46+
# Run tests/paths with client certificate authentication
47+
- node_js: lts/*
48+
env:
49+
- CC=clang CXX=clang++ npm_config_clang=1 PGUSER=postgres PGDATABASE=postgres
50+
PGSSLMODE=verify-full
51+
PGSSLROOTCERT=$TRAVIS_BUILD_DIR/packages/pg/test/tls/test-server-ca.crt
52+
PGSSLCERT=$TRAVIS_BUILD_DIR/packages/pg/test/tls/test-client.crt
53+
PGSSLKEY=$TRAVIS_BUILD_DIR/packages/pg/test/tls/test-client.key
54+
PG_CLIENT_CERT_TEST=1
55+
before_script:
56+
- chmod go= packages/pg/test/tls/test-client.key
57+
- |
58+
sudo sed -i \
59+
-e '/^ssl_cert_file =/d' \
60+
-e '/^ssl_key_file =/d' \
61+
/etc/postgresql/10/main/postgresql.conf
62+
63+
cat <<'travis ci breaks heredoc' | sudo tee -a /etc/postgresql/10/main/postgresql.conf > /dev/null
64+
ssl_cert_file = 'test-server.crt'
65+
ssl_key_file = 'test-server.key'
66+
ssl_ca_file = 'test-client-ca.crt'
67+
68+
- printf 'hostssl all all %s cert\n' 127.0.0.1/32 ::1/128 | sudo tee /etc/postgresql/10/main/pg_hba.conf > /dev/null
69+
- sudo make -C packages/pg/test/tls install DESTDIR=/var/ramfs/postgresql/10/main
70+
- sudo systemctl restart postgresql@10-main
71+
- yarn build
72+
script:
73+
- cd packages/pg
74+
- node test/integration/connection-pool/tls-tests.js
75+
- npm install --no-save pg-native
76+
- node test/integration/connection-pool/tls-tests.js native
77+
4678
# different PostgreSQL versions on Node LTS
4779
- node_js: lts/erbium
4880
addons:
@@ -57,6 +89,10 @@ matrix:
5789
addons:
5890
postgresql: '9.6'
5991

92+
# only run lint on latest Node LTS
93+
- node_js: lts/*
94+
script: yarn lint
95+
6096
# PostgreSQL 9.2 only works on precise
6197
- node_js: lts/carbon
6298
addons:

.yarnrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
--install.ignore-engines true

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ For richer information consult the commit log on github with referenced pull req
44

55
We do not include break-fix version release in this file.
66

7+
### pg@8.5.0
8+
9+
- Fix bug forwarding [ssl key](https://github.com/brianc/node-postgres/pull/2394).
10+
- Convert pg-query-stream internals to [typescript](https://github.com/brianc/node-postgres/pull/2376).
11+
- Performance [improvements](https://github.com/brianc/node-postgres/pull/2286).
12+
713
### pg@8.4.0
814

915
- Switch to optional peer dependencies & remove [semver](https://github.com/brianc/node-postgres/commit/a02dfac5ad2e2abf0dc3a9817f953938acdc19b1) package which has been a small thorn in the side of a few users.

SPONSORS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ node-postgres is made possible by the helpful contributors from the community as
88
- [Nafundi](https://nafundi.com)
99
- [CrateDB](https://crate.io/)
1010
- [BitMEX](https://www.bitmex.com/app/trade/XBTUSD)
11+
- [Dataform](https://dataform.co/)
1112

1213
# Supporters
1314

@@ -32,3 +33,4 @@ node-postgres is made possible by the helpful contributors from the community as
3233
- Simple Analytics
3334
- Trevor Linton
3435
- Ian Walter
36+
- @Guido4000

package.json

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,23 @@
1010
"packages/*"
1111
],
1212
"scripts": {
13-
"test": "yarn lint && yarn lerna exec yarn test",
14-
"build": "yarn lerna exec --scope pg-protocol yarn build",
13+
"test": "yarn lerna exec yarn test",
14+
"build": "tsc --build",
15+
"build:watch": "tsc --build --watch",
1516
"pretest": "yarn build",
16-
"lint": "if [ -x ./node_modules/.bin/prettier ]; then eslint '*/**/*.{js,ts,tsx}'; fi;"
17+
"prepublish": "yarn build",
18+
"lint": "eslint '*/**/*.{js,ts,tsx}'"
1719
},
1820
"devDependencies": {
19-
"@typescript-eslint/eslint-plugin": "^2.27.0",
20-
"@typescript-eslint/parser": "^2.27.0",
21-
"eslint": "^6.8.0",
22-
"eslint-config-prettier": "^6.10.1",
21+
"@typescript-eslint/eslint-plugin": "^4.4.0",
22+
"@typescript-eslint/parser": "^4.4.0",
23+
"eslint": "^7.11.0",
24+
"eslint-config-prettier": "^6.12.0",
2325
"eslint-plugin-node": "^11.1.0",
24-
"eslint-plugin-prettier": "^3.1.2",
25-
"lerna": "^3.19.0"
26-
},
27-
"optionalDependencies": {
28-
"prettier": "2.0.4"
26+
"eslint-plugin-prettier": "^3.1.4",
27+
"lerna": "^3.19.0",
28+
"prettier": "2.1.2",
29+
"typescript": "^4.0.3"
2930
},
3031
"prettier": {
3132
"semi": false,

packages/pg-cursor/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "pg-cursor",
3-
"version": "2.4.1",
3+
"version": "2.5.1",
44
"description": "Query cursor extension for node-postgres",
55
"main": "index.js",
66
"directories": {
@@ -17,6 +17,6 @@
1717
"license": "MIT",
1818
"devDependencies": {
1919
"mocha": "^7.1.2",
20-
"pg": "^8.4.1"
20+
"pg": "^8.5.1"
2121
}
2222
}

packages/pg-pool/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "pg-pool",
3-
"version": "3.2.1",
3+
"version": "3.2.2",
44
"description": "Connection pool for node-postgres",
55
"main": "index.js",
66
"directories": {

packages/pg-protocol/package.json

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "pg-protocol",
3-
"version": "1.3.0",
3+
"version": "1.4.0",
44
"description": "The postgres client/server binary protocol, implemented in TypeScript",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",
@@ -13,13 +13,17 @@
1313
"chunky": "^0.0.0",
1414
"mocha": "^7.1.2",
1515
"ts-node": "^8.5.4",
16-
"typescript": "^3.7.3"
16+
"typescript": "^4.0.3"
1717
},
1818
"scripts": {
1919
"test": "mocha dist/**/*.test.js",
2020
"build": "tsc",
2121
"build:watch": "tsc --watch",
2222
"prepublish": "yarn build",
2323
"pretest": "yarn build"
24-
}
24+
},
25+
"files": [
26+
"/dist/*{js,ts,map}",
27+
"/src"
28+
]
2529
}

packages/pg-protocol/src/buffer-writer.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export class Writer {
55
private offset: number = 5
66
private headerPosition: number = 0
77
constructor(private size = 256) {
8-
this.buffer = Buffer.alloc(size)
8+
this.buffer = Buffer.allocUnsafe(size)
99
}
1010

1111
private ensure(size: number): void {
@@ -15,7 +15,7 @@ export class Writer {
1515
// exponential growth factor of around ~ 1.5
1616
// https://stackoverflow.com/questions/2269063/buffer-growth-strategy
1717
var newSize = oldBuffer.length + (oldBuffer.length >> 1) + size
18-
this.buffer = Buffer.alloc(newSize)
18+
this.buffer = Buffer.allocUnsafe(newSize)
1919
oldBuffer.copy(this.buffer)
2020
}
2121
}

0 commit comments

Comments
 (0)