Skip to content

Commit 0d0a700

Browse files
author
alxndrsn
committed
Merge branch 'master' into missing-spit
2 parents 141c552 + 92cb640 commit 0d0a700

File tree

113 files changed

+779
-1488
lines changed

Some content is hidden

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

113 files changed

+779
-1488
lines changed

.devcontainer/Dockerfile

+4-2
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,11 @@ ARG USERNAME=node
1616
ARG USER_UID=1000
1717
ARG USER_GID=$USER_UID
1818

19+
RUN echo "deb http://archive.debian.org/debian stretch main" > /etc/apt/sources.list
20+
1921
# Configure apt and install packages
2022
RUN apt-get update \
21-
&& apt-get -y install --no-install-recommends apt-utils dialog 2>&1 \
23+
&& apt-get -y install --no-install-recommends dialog 2>&1 \
2224
#
2325
# Verify git and needed tools are installed
2426
&& apt-get -y install git iproute2 procps \
@@ -33,6 +35,7 @@ RUN apt-get update \
3335
&& echo "deb https://dl.yarnpkg.com/$(lsb_release -is | tr '[:upper:]' '[:lower:]')/ stable main" | tee /etc/apt/sources.list.d/yarn.list \
3436
&& apt-get update \
3537
&& apt-get -y install --no-install-recommends yarn tmux locales postgresql \
38+
&& apt-get install libpq-dev g++ make \
3639
#
3740
# Install eslint globally
3841
&& npm install -g eslint \
@@ -47,7 +50,6 @@ RUN apt-get update \
4750
&& apt-get install -y sudo \
4851
&& echo node ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
4952
&& chmod 0440 /etc/sudoers.d/$USERNAME \
50-
#
5153
# Clean up
5254
&& apt-get autoremove -y \
5355
&& apt-get clean -y \

.devcontainer/devcontainer.json

+9-24
Original file line numberDiff line numberDiff line change
@@ -4,28 +4,13 @@
44
"dockerComposeFile": "docker-compose.yml",
55
"service": "web",
66
"workspaceFolder": "/workspace",
7-
8-
// Use 'settings' to set *default* container specific settings.json values on container create.
9-
// You can edit these settings after create using File > Preferences > Settings > Remote.
10-
"settings": {
11-
"terminal.integrated.shell.linux": "/bin/bash"
12-
},
13-
14-
// Uncomment the next line if you want start specific services in your Docker Compose config.
15-
// "runServices": [],
16-
17-
// Uncomment the line below if you want to keep your containers running after VS Code shuts down.
18-
// "shutdownAction": "none",
19-
20-
// Uncomment the next line to run commands after the container is created.
21-
// "postCreateCommand": "npm install",
22-
23-
// Uncomment the next line to have VS Code connect as an existing non-root user in the container. See
24-
// https://aka.ms/vscode-remote/containers/non-root for details on adding a non-root user if none exist.
25-
// "remoteUser": "node",
26-
277
// Add the IDs of extensions you want installed when the container is created in the array below.
28-
"extensions": [
29-
"dbaeumer.vscode-eslint"
30-
]
31-
}
8+
"customizations":{
9+
"vscode": {
10+
"extensions": ["dbaeumer.vscode-eslint"],
11+
"settings": {
12+
"terminal.integrated.shell.linux": "/bin/bash"
13+
}
14+
}
15+
}
16+
}

.devcontainer/docker-compose.yml

+9-4
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information.
44
#-------------------------------------------------------------------------------------------------------------
55

6-
version: '3'
6+
version: '3.9'
77
services:
88
web:
99
# Uncomment the next line to use a non-root user for all processes. You can also
@@ -32,16 +32,21 @@ services:
3232
# Overrides default command so things don't shut down after the process ends.
3333
command: sleep infinity
3434

35-
links:
35+
depends_on:
3636
- db
3737

38+
links:
39+
- db:db
40+
3841
db:
39-
image: postgres
42+
image: postgres:14-alpine
4043
restart: unless-stopped
4144
ports:
4245
- 5432:5432
46+
command: postgres -c password_encryption=md5
4347
environment:
48+
POSTGRES_HOST_AUTH_METHOD: trust
49+
POSTGRES_INITDB_ARGS: "--auth-local=md5"
4450
POSTGRES_PASSWORD: pass
4551
POSTGRES_USER: user
4652
POSTGRES_DB: data
47-

.eslintrc

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"plugins": ["prettier"],
2+
"plugins": ["@typescript-eslint", "prettier"],
33
"parser": "@typescript-eslint/parser",
44
"extends": ["plugin:prettier/recommended", "prettier"],
55
"ignorePatterns": ["node_modules", "coverage", "packages/pg-protocol/dist/**/*", "packages/pg-query-stream/dist/**/*"],
@@ -11,5 +11,11 @@
1111
"node": true,
1212
"es6": true,
1313
"mocha": true
14+
},
15+
"rules": {
16+
"@typescript-eslint/no-unused-vars": ["error", {
17+
"args": "none"
18+
}],
19+
"no-unused-vars": "off"
1420
}
1521
}

.github/CODEOWNERS

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/packages/pg-connection-string @hjr3

.github/workflows/ci.yml

+4-5
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ jobs:
2121
- run: yarn install --frozen-lockfile
2222
- run: yarn lint
2323
build:
24-
timeout-minutes: 10
24+
timeout-minutes: 15
2525
needs: lint
2626
services:
2727
postgres:
28-
image: postgres:11
28+
image: ghcr.io/railwayapp-templates/postgres-ssl
2929
env:
3030
POSTGRES_USER: postgres
3131
POSTGRES_PASSWORD: postgres
@@ -44,8 +44,8 @@ jobs:
4444
- '22'
4545
os:
4646
- ubuntu-latest
47-
name: Node.js ${{ matrix.node }} (${{ matrix.os }})
48-
runs-on: ${{ matrix.os }}
47+
name: Node.js ${{ matrix.node }}
48+
runs-on: ubuntu-latest
4949
env:
5050
PGUSER: postgres
5151
PGPASSWORD: postgres
@@ -71,5 +71,4 @@ jobs:
7171
node-version: ${{ matrix.node }}
7272
cache: yarn
7373
- run: yarn install --frozen-lockfile
74-
# TODO(bmc): get ssl tests working in ci
7574
- run: yarn test

README.md

+5-4
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,11 @@ If your change involves breaking backwards compatibility please please point tha
7575
### Setting up for local development
7676

7777
1. Clone the repo
78-
2. From your workspace root run `yarn` and then `yarn lerna bootstrap`
79-
3. Ensure you have a PostgreSQL instance running with SSL enabled and an empty database for tests
80-
4. Ensure you have the proper environment variables configured for connecting to the instance
81-
5. Run `yarn test` to run all the tests
78+
2. Ensure you have installed libpq-dev in your system.
79+
3. From your workspace root run `yarn` and then `yarn lerna bootstrap`
80+
4. Ensure you have a PostgreSQL instance running with SSL enabled and an empty database for tests
81+
5. Ensure you have the proper environment variables configured for connecting to the instance
82+
6. Run `yarn test` to run all the tests
8283

8384
## Troubleshooting and FAQ
8485

packages/pg-connection-string/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "pg-connection-string",
3-
"version": "2.6.4",
3+
"version": "2.7.0",
44
"description": "Functions for dealing with a PostgresSQL connection string",
55
"main": "./index.js",
66
"types": "./index.d.ts",
@@ -30,7 +30,7 @@
3030
"chai": "^4.1.1",
3131
"coveralls": "^3.0.4",
3232
"istanbul": "^0.4.5",
33-
"mocha": "^7.1.2"
33+
"mocha": "^10.5.2"
3434
},
3535
"files": [
3636
"index.js",

packages/pg-cursor/package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "pg-cursor",
3-
"version": "2.11.0",
3+
"version": "2.12.0",
44
"description": "Query cursor extension for node-postgres",
55
"main": "index.js",
66
"directories": {
@@ -17,8 +17,8 @@
1717
"author": "Brian M. Carlson",
1818
"license": "MIT",
1919
"devDependencies": {
20-
"mocha": "^7.1.2",
21-
"pg": "^8.12.0"
20+
"mocha": "^10.5.2",
21+
"pg": "^8.13.0"
2222
},
2323
"peerDependencies": {
2424
"pg": "^8"

packages/pg-native/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "pg-native",
3-
"version": "3.1.0",
3+
"version": "3.2.0",
44
"description": "A slightly nicer interface to Postgres over node-libpq",
55
"main": "index.js",
66
"scripts": {
@@ -30,7 +30,7 @@
3030
"concat-stream": "^1.4.6",
3131
"generic-pool": "^2.1.1",
3232
"lodash": "^2.4.1",
33-
"mocha": "3.4.2",
33+
"mocha": "10.5.2",
3434
"node-gyp": ">=10.x",
3535
"okay": "^0.3.0",
3636
"semver": "^4.1.0"

packages/pg-native/test/many-connections.js

+1-12
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ var bytes = require('crypto').pseudoRandomBytes
66
describe('many connections', function () {
77
describe('async', function () {
88
var test = function (count, times) {
9-
it('connecting ' + count + ' clients ' + times, function (done) {
9+
it(`connecting ${count} clients ${times} times`, function (done) {
1010
this.timeout(200000)
1111

1212
var connectClient = function (n, cb) {
@@ -38,20 +38,9 @@ describe('many connections', function () {
3838
}
3939

4040
test(1, 1)
41-
test(1, 1)
42-
test(1, 1)
43-
test(5, 5)
4441
test(5, 5)
45-
test(5, 5)
46-
test(5, 5)
47-
test(10, 10)
4842
test(10, 10)
49-
test(10, 10)
50-
test(20, 20)
51-
test(20, 20)
5243
test(20, 20)
5344
test(30, 10)
54-
test(30, 10)
55-
test(30, 10)
5645
})
5746
})

packages/pg-pool/package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "pg-pool",
3-
"version": "3.6.2",
3+
"version": "3.7.0",
44
"description": "Connection pool for node-postgres",
55
"main": "index.js",
66
"directories": {
@@ -27,11 +27,11 @@
2727
},
2828
"homepage": "https://github.com/brianc/node-pg-pool#readme",
2929
"devDependencies": {
30-
"bluebird": "3.4.1",
30+
"bluebird": "3.7.2",
3131
"co": "4.6.0",
3232
"expect.js": "0.3.1",
3333
"lodash": "^4.17.11",
34-
"mocha": "^7.1.2",
34+
"mocha": "^10.5.2",
3535
"pg-cursor": "^1.3.0"
3636
},
3737
"peerDependencies": {

packages/pg-protocol/package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
{
22
"name": "pg-protocol",
3-
"version": "1.6.1",
3+
"version": "1.7.0",
44
"description": "The postgres client/server binary protocol, implemented in TypeScript",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",
77
"license": "MIT",
88
"devDependencies": {
99
"@types/chai": "^4.2.7",
10-
"@types/mocha": "^5.2.7",
10+
"@types/mocha": "^10.0.7",
1111
"@types/node": "^12.12.21",
1212
"chai": "^4.2.0",
1313
"chunky": "^0.0.0",
14-
"mocha": "^7.1.2",
14+
"mocha": "^10.5.2",
1515
"ts-node": "^8.5.4",
1616
"typescript": "^4.0.3"
1717
},

packages/pg-protocol/src/b.ts

-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
// file for microbenchmarking
22

3-
import { Writer } from './buffer-writer'
4-
import { serialize } from './index'
53
import { BufferReader } from './buffer-reader'
64

75
const LOOPS = 1000
86
let count = 0
97
let start = Date.now()
10-
const writer = new Writer()
118

129
const reader = new BufferReader()
1310
const buffer = Buffer.from([33, 33, 33, 33, 33, 33, 33, 0])

packages/pg-protocol/src/inbound-parser.test.ts

-11
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,6 @@ var parseCompleteBuffer = buffers.parseComplete()
1414
var bindCompleteBuffer = buffers.bindComplete()
1515
var portalSuspendedBuffer = buffers.portalSuspended()
1616

17-
var addRow = function (bufferList: BufferList, name: string, offset: number) {
18-
return bufferList
19-
.addCString(name) // field name
20-
.addInt32(offset++) // table id
21-
.addInt16(offset++) // attribute of column number
22-
.addInt32(offset++) // objectId of field's data type
23-
.addInt16(offset++) // datatype size
24-
.addInt32(offset++) // type modifier
25-
.addInt16(0) // format code, 0 => text
26-
}
27-
2817
var row1 = {
2918
name: 'id',
3019
tableID: 1,

packages/pg-protocol/src/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { BackendMessage, DatabaseError } from './messages'
1+
import { DatabaseError } from './messages'
22
import { serialize } from './serializer'
33
import { Parser, MessageCallback } from './parser'
44

packages/pg-protocol/src/parser.ts

-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ import {
2727
NoticeMessage,
2828
} from './messages'
2929
import { BufferReader } from './buffer-reader'
30-
import assert from 'assert'
3130

3231
// every message is prefixed with a single bye
3332
const CODE_LENGTH = 1

packages/pg-query-stream/package.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "pg-query-stream",
3-
"version": "4.6.0",
3+
"version": "4.7.0",
44
"description": "Postgres query result returned as readable stream",
55
"main": "./dist/index.js",
66
"types": "./dist/index.d.ts",
@@ -30,14 +30,14 @@
3030
},
3131
"devDependencies": {
3232
"@types/chai": "^4.2.13",
33-
"@types/mocha": "^8.0.3",
33+
"@types/mocha": "^10.0.7",
3434
"@types/node": "^14.0.0",
3535
"@types/pg": "^7.14.5",
3636
"JSONStream": "~1.3.5",
3737
"concat-stream": "~1.0.1",
3838
"eslint-plugin-promise": "^6.0.1",
39-
"mocha": "^7.1.2",
40-
"pg": "^8.12.0",
39+
"mocha": "^10.5.2",
40+
"pg": "^8.13.0",
4141
"stream-spec": "~0.3.5",
4242
"ts-node": "^8.5.4",
4343
"typescript": "^4.0.3"
@@ -46,6 +46,6 @@
4646
"pg": "^8"
4747
},
4848
"dependencies": {
49-
"pg-cursor": "^2.11.0"
49+
"pg-cursor": "^2.12.0"
5050
}
5151
}

packages/pg-query-stream/test/async-iterator.ts

+2
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,11 @@ if (!process.version.startsWith('v8')) {
122122
const pool = new pg.Pool({ max: 1 })
123123
const client = await pool.connect()
124124

125+
/* eslint-disable @typescript-eslint/no-unused-vars */
125126
for await (const _ of client.query(new QueryStream('select TRUE', [], { highWaterMark: 1 }))) break
126127
for await (const _ of client.query(new QueryStream('select TRUE', [], { highWaterMark: 1 }))) break
127128
for await (const _ of client.query(new QueryStream('select TRUE', [], { highWaterMark: 1 }))) break
129+
/* eslint-enable @typescript-eslint/no-unused-vars */
128130

129131
client.release()
130132
await pool.end()

packages/pg-query-stream/test/pauses.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import helper from './helper'
22
import concat from 'concat-stream'
33
import JSONStream from 'JSONStream'
44
import QueryStream from '../src'
5-
import { Transform, TransformCallback } from 'stream'
5+
import { Transform } from 'stream'
66

77
class PauseStream extends Transform {
88
constructor() {

0 commit comments

Comments
 (0)