Skip to content
Snippets Groups Projects
Commit f9d0614f authored by Yadd's avatar Yadd
Browse files

New upstream version 8.13.1+~cs35.16.30

parent c60802a4
No related branches found
No related tags found
No related merge requests found
Showing
with 97 additions and 78 deletions
......@@ -16,9 +16,11 @@ ARG USERNAME=node
ARG USER_UID=1000
ARG USER_GID=$USER_UID
RUN echo "deb http://archive.debian.org/debian stretch main" > /etc/apt/sources.list
# Configure apt and install packages
RUN apt-get update \
&& apt-get -y install --no-install-recommends apt-utils dialog 2>&1 \
&& apt-get -y install --no-install-recommends dialog 2>&1 \
#
# Verify git and needed tools are installed
&& apt-get -y install git iproute2 procps \
......@@ -33,6 +35,7 @@ RUN apt-get update \
&& echo "deb https://dl.yarnpkg.com/$(lsb_release -is | tr '[:upper:]' '[:lower:]')/ stable main" | tee /etc/apt/sources.list.d/yarn.list \
&& apt-get update \
&& apt-get -y install --no-install-recommends yarn tmux locales postgresql \
&& apt-get install libpq-dev g++ make \
#
# Install eslint globally
&& npm install -g eslint \
......@@ -47,7 +50,6 @@ RUN apt-get update \
&& apt-get install -y sudo \
&& echo node ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
&& chmod 0440 /etc/sudoers.d/$USERNAME \
#
# Clean up
&& apt-get autoremove -y \
&& apt-get clean -y \
......
......@@ -4,28 +4,13 @@
"dockerComposeFile": "docker-compose.yml",
"service": "web",
"workspaceFolder": "/workspace",
// Use 'settings' to set *default* container specific settings.json values on container create.
// You can edit these settings after create using File > Preferences > Settings > Remote.
"settings": {
"terminal.integrated.shell.linux": "/bin/bash"
},
// Uncomment the next line if you want start specific services in your Docker Compose config.
// "runServices": [],
// Uncomment the line below if you want to keep your containers running after VS Code shuts down.
// "shutdownAction": "none",
// Uncomment the next line to run commands after the container is created.
// "postCreateCommand": "npm install",
// Uncomment the next line to have VS Code connect as an existing non-root user in the container. See
// https://aka.ms/vscode-remote/containers/non-root for details on adding a non-root user if none exist.
// "remoteUser": "node",
// Add the IDs of extensions you want installed when the container is created in the array below.
"extensions": [
"dbaeumer.vscode-eslint"
]
}
\ No newline at end of file
"customizations":{
"vscode": {
"extensions": ["dbaeumer.vscode-eslint"],
"settings": {
"terminal.integrated.shell.linux": "/bin/bash"
}
}
}
}
......@@ -3,7 +3,7 @@
# Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information.
#-------------------------------------------------------------------------------------------------------------
version: '3'
version: '3.9'
services:
web:
# Uncomment the next line to use a non-root user for all processes. You can also
......@@ -32,16 +32,21 @@ services:
# Overrides default command so things don't shut down after the process ends.
command: sleep infinity
links:
depends_on:
- db
links:
- db:db
db:
image: postgres
image: postgres:14-alpine
restart: unless-stopped
ports:
- 5432:5432
command: postgres -c password_encryption=md5
environment:
POSTGRES_HOST_AUTH_METHOD: trust
POSTGRES_INITDB_ARGS: "--auth-local=md5"
POSTGRES_PASSWORD: pass
POSTGRES_USER: user
POSTGRES_DB: data
{
"plugins": ["prettier"],
"plugins": ["@typescript-eslint", "prettier"],
"parser": "@typescript-eslint/parser",
"extends": ["plugin:prettier/recommended", "prettier"],
"ignorePatterns": ["node_modules", "coverage", "packages/pg-protocol/dist/**/*", "packages/pg-query-stream/dist/**/*"],
......@@ -11,5 +11,11 @@
"node": true,
"es6": true,
"mocha": true
},
"rules": {
"@typescript-eslint/no-unused-vars": ["error", {
"args": "none"
}],
"no-unused-vars": "off"
}
}
/packages/pg-connection-string @hjr3
......@@ -21,11 +21,11 @@ jobs:
- run: yarn install --frozen-lockfile
- run: yarn lint
build:
timeout-minutes: 10
timeout-minutes: 15
needs: lint
services:
postgres:
image: postgres:11
image: ghcr.io/railwayapp-templates/postgres-ssl
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
......@@ -44,8 +44,8 @@ jobs:
- '22'
os:
- ubuntu-latest
name: Node.js ${{ matrix.node }} (${{ matrix.os }})
runs-on: ${{ matrix.os }}
name: Node.js ${{ matrix.node }}
runs-on: ubuntu-latest
env:
PGUSER: postgres
PGPASSWORD: postgres
......@@ -71,5 +71,4 @@ jobs:
node-version: ${{ matrix.node }}
cache: yarn
- run: yarn install --frozen-lockfile
# TODO(bmc): get ssl tests working in ci
- run: yarn test
......@@ -4,6 +4,14 @@ For richer information consult the commit log on github with referenced pull req
We do not include break-fix version release in this file.
## pg@8.13.0
- Add ability to specify query timeout on [per-query basis](https://github.com/brianc/node-postgres/pull/3074).
## pg@8.12.0
- Add `queryMode` config option to [force use of the extended query protocol](https://github.com/brianc/node-postgres/pull/3214) on queries without any parameters.
## pg-pool@8.10.0
- Emit `release` event when client is returned to [the pool](https://github.com/brianc/node-postgres/pull/2845).
......@@ -64,7 +72,7 @@ We do not include break-fix version release in this file.
### pg@8.2.0
- Switch internal protocol parser & serializer to [pg-protocol](https://github.com/brianc/node-postgres/tree/master/packages/pg-protocol). The change is backwards compatible but results in a significant performance improvement across the board, with some queries as much as 50% faster. This is the first work to land in an on-going performance improvment initiative I'm working on. Stay tuned as things are set to get much faster still! :rocket:
- Switch internal protocol parser & serializer to [pg-protocol](https://github.com/brianc/node-postgres/tree/master/packages/pg-protocol). The change is backwards compatible but results in a significant performance improvement across the board, with some queries as much as 50% faster. This is the first work to land in an on-going performance improvement initiative I'm working on. Stay tuned as things are set to get much faster still! :rocket:
### pg-cursor@2.2.0
......
......@@ -12,6 +12,7 @@ This repo is a monorepo which contains the core [pg](https://github.com/brianc/n
- [pg](https://github.com/brianc/node-postgres/tree/master/packages/pg)
- [pg-pool](https://github.com/brianc/node-postgres/tree/master/packages/pg-pool)
- [pg-native](https://github.com/brianc/node-postgres/tree/master/packages/pg-native)
- [pg-cursor](https://github.com/brianc/node-postgres/tree/master/packages/pg-cursor)
- [pg-query-stream](https://github.com/brianc/node-postgres/tree/master/packages/pg-query-stream)
- [pg-connection-string](https://github.com/brianc/node-postgres/tree/master/packages/pg-connection-string)
......@@ -74,10 +75,11 @@ If your change involves breaking backwards compatibility please please point tha
### Setting up for local development
1. Clone the repo
2. From your workspace root run `yarn` and then `yarn lerna bootstrap`
3. Ensure you have a PostgreSQL instance running with SSL enabled and an empty database for tests
4. Ensure you have the proper environment variables configured for connecting to the instance
5. Run `yarn test` to run all the tests
2. Ensure you have installed libpq-dev in your system.
3. From your workspace root run `yarn` and then `yarn lerna bootstrap`
4. Ensure you have a PostgreSQL instance running with SSL enabled and an empty database for tests
5. Ensure you have the proper environment variables configured for connecting to the instance
6. Run `yarn test` to run all the tests
## Troubleshooting and FAQ
......
......@@ -47,11 +47,11 @@ new Client({
- drop support for versions of node older than 8.0
Node@6.0 has been out of LTS for quite some time now, and I've removed it from our test matrix. `pg@8.0` _may_ still work on older versions of node, but it isn't a goal of the project anymore. Node@8.0 is actually no longer in the LTS support line, but pg will continue to test against and support 8.0 until there is a compelling reason to drop support for it. Any security vulnerability issues which come up I will back-port fixes to the `pg@7.x` line and do a release, but any other fixes or improvments will not be back ported.
Node@6.0 has been out of LTS for quite some time now, and I've removed it from our test matrix. `pg@8.0` _may_ still work on older versions of node, but it isn't a goal of the project anymore. Node@8.0 is actually no longer in the LTS support line, but pg will continue to test against and support 8.0 until there is a compelling reason to drop support for it. Any security vulnerability issues which come up I will back-port fixes to the `pg@7.x` line and do a release, but any other fixes or improvements will not be back ported.
- prevent password from being logged accidentally
`pg@8.0` makes the password field on the pool and client non-enumerable. This means when you do `console.log(client)` you wont have your database password printed out unintenionally. You can still do `console.log(client.password)` if you really want to see it!
`pg@8.0` makes the password field on the pool and client non-enumerable. This means when you do `console.log(client)` you wont have your database password printed out unintentionally. You can still do `console.log(client.password)` if you really want to see it!
- make `pg.native` non-enumerable
......@@ -113,7 +113,7 @@ pg@7.1.2
### Example
To demonstrate the issue & see if you are vunerable execute the following in node:
To demonstrate the issue & see if you are vulnerable execute the following in node:
```js
import pg from 'pg'
......
......@@ -42,7 +42,7 @@ The command type last executed: `INSERT` `UPDATE` `CREATE` `SELECT` etc.
The number of rows processed by the last command. Can be `null` for commands that never affect rows, such as the `LOCK`-command. More specifically, some commands, including `LOCK`, only return a command tag of the form `COMMAND`, without any `[ROWS]`-field to parse. For such commands `rowCount` will be `null`.
_note: this does not reflect the number of rows __returned__ from a query. e.g. an update statement could update many rows (so high `result.rowCount` value) but `result.rows.length` would be zero. To check for an empty query reponse on a `SELECT` query use `result.rows.length === 0`_.
_note: this does not reflect the number of rows __returned__ from a query. e.g. an update statement could update many rows (so high `result.rowCount` value) but `result.rows.length` would be zero. To check for an empty query response on a `SELECT` query use `result.rows.length === 0`_.
[@sehrope](https://github.com/brianc/node-postgres/issues/2182#issuecomment-620553915) has a good explanation:
......
# pg-cloudflare
A socket implementation that can run on Cloudflare Workers using native TCP connections.
`pg-cloudflare` makes it easier to take an existing package that relies on `tls` and `net`, and make it work in environments where only `connect()` is supported, such as Cloudflare Workers.
## install
`pg-cloudflare` wraps `connect()`, the [TCP Socket API](https://github.com/wintercg/proposal-sockets-api) proposed within WinterCG, and implemented in [Cloudflare Workers](https://developers.cloudflare.com/workers/runtime-apis/tcp-sockets/), and exposes an interface with methods similar to what the `net` and `tls` modules in Node.js expose. (ex: `net.connect(path[, options][, callback])`). This minimizes the number of changes needed in order to make an existing package work across JavaScript runtimes.
## Installation
```
npm i --save-dev pg-cloudflare
```
## How to use conditionally, in non-Node.js environments
As implemented in `pg` [here](https://github.com/brianc/node-postgres/commit/07553428e9c0eacf761a5d4541a3300ff7859578#diff-34588ad868ebcb232660aba7ee6a99d1e02f4bc93f73497d2688c3f074e60533R5-R13), a typical use case might look as follows, where in a Node.js environment the `net` module is used, while in a non-Node.js environment, where `net` is unavailable, `pg-cloudflare` is used instead, providing an equivalent interface:
```js
module.exports.getStream = function getStream(ssl = false) {
const net = require('net')
if (typeof net.Socket === 'function') {
return net.Socket()
}
const { CloudflareSocket } = require('pg-cloudflare')
return new CloudflareSocket(ssl);
}
```
## Node.js implementation of the Socket API proposal
If you're looking for a way to rely on `connect()` as the interface you use to interact with raw sockets, but need this interface to be availble in a Node.js environment, [`@arrowood.dev/socket`](https://github.com/Ethan-Arrowood/socket) provides a Node.js implementation of the Socket API.
### license
The MIT License (MIT)
......
{
"name": "pg-connection-string",
"version": "2.6.4",
"version": "2.7.0",
"description": "Functions for dealing with a PostgresSQL connection string",
"main": "./index.js",
"types": "./index.d.ts",
......@@ -30,7 +30,7 @@
"chai": "^4.1.1",
"coveralls": "^3.0.4",
"istanbul": "^0.4.5",
"mocha": "^7.1.2"
"mocha": "^10.5.2"
},
"files": [
"index.js",
......
'use strict'
var chai = require('chai')
var expect = chai.expect
chai.should()
var parse = require('../').parse
......
{
"name": "pg-cursor",
"version": "2.11.0",
"version": "2.12.1",
"description": "Query cursor extension for node-postgres",
"main": "index.js",
"directories": {
......@@ -17,8 +17,8 @@
"author": "Brian M. Carlson",
"license": "MIT",
"devDependencies": {
"mocha": "^7.1.2",
"pg": "^8.12.0"
"mocha": "^10.5.2",
"pg": "^8.13.1"
},
"peerDependencies": {
"pg": "^8"
......
{
"name": "pg-native",
"version": "3.1.0",
"version": "3.2.0",
"description": "A slightly nicer interface to Postgres over node-libpq",
"main": "index.js",
"scripts": {
......@@ -23,15 +23,14 @@
"homepage": "https://github.com/brianc/node-pg-native",
"dependencies": {
"libpq": "1.8.13",
"pg-types": "^1.12.1",
"readable-stream": "1.0.31"
"pg-types": "^1.12.1"
},
"devDependencies": {
"async": "^0.9.0",
"concat-stream": "^1.4.6",
"generic-pool": "^2.1.1",
"lodash": "^2.4.1",
"mocha": "3.4.2",
"mocha": "10.5.2",
"node-gyp": ">=10.x",
"okay": "^0.3.0",
"semver": "^4.1.0"
......
......@@ -5,13 +5,15 @@ describe('cancel query', function () {
it('works', function (done) {
var client = new Client()
client.connectSync()
client.query('SELECT pg_sleep(100);', function (err) {
client.query('SELECT pg_sleep(1000);', function (err) {
assert(err instanceof Error)
client.end(done)
})
client.cancel(function (err) {
assert.ifError(err)
})
setTimeout(() => {
client.cancel(function (err) {
assert.ifError(err)
})
}, 100)
})
it('does not raise error if no active query', function (done) {
......
......@@ -6,7 +6,7 @@ var checkDomain = function (domain, when) {
assert.strictEqual(process.domain, domain, 'Domain switched after ' + when)
}
describe('domains', function (done) {
describe('domains', function () {
it('remains bound after a query', function (done) {
var domain = require('domain').create() // eslint-disable-line
domain.run(function () {
......
......@@ -6,7 +6,7 @@ var bytes = require('crypto').pseudoRandomBytes
describe('many connections', function () {
describe('async', function () {
var test = function (count, times) {
it('connecting ' + count + ' clients ' + times, function (done) {
it(`connecting ${count} clients ${times} times`, function (done) {
this.timeout(200000)
var connectClient = function (n, cb) {
......@@ -38,20 +38,9 @@ describe('many connections', function () {
}
test(1, 1)
test(1, 1)
test(1, 1)
test(5, 5)
test(5, 5)
test(5, 5)
test(5, 5)
test(10, 10)
test(10, 10)
test(10, 10)
test(20, 20)
test(20, 20)
test(20, 20)
test(30, 10)
test(30, 10)
test(30, 10)
})
})
var Client = require('../')
var assert = require('assert')
describe('query sync', function (done) {
describe('query sync', function () {
before(function () {
this.client = Client()
this.client.connectSync()
......
{
"name": "pg-pool",
"version": "3.6.2",
"version": "3.7.0",
"description": "Connection pool for node-postgres",
"main": "index.js",
"directories": {
......@@ -27,11 +27,11 @@
},
"homepage": "https://github.com/brianc/node-pg-pool#readme",
"devDependencies": {
"bluebird": "3.4.1",
"bluebird": "3.7.2",
"co": "4.6.0",
"expect.js": "0.3.1",
"lodash": "^4.17.11",
"mocha": "^7.1.2",
"mocha": "^10.5.2",
"pg-cursor": "^1.3.0"
},
"peerDependencies": {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment