Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: gajus/slonik
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v31.2.3
Choose a base ref
...
head repository: gajus/slonik
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v31.2.4
Choose a head ref
  • 2 commits
  • 4 files changed
  • 2 contributors

Commits on Sep 20, 2022

  1. fix: update dependencies

    gajus committed Sep 20, 2022
    Copy the full SHA
    bc115f4 View commit details
  2. Copy the full SHA
    caadafa View commit details
Showing with 120 additions and 91 deletions.
  1. +95 −81 package-lock.json
  2. +9 −9 package.json
  3. +3 −1 src/connectionMethods/stream.ts
  4. +13 −0 test/slonik/integration/pg.ts
176 changes: 95 additions & 81 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -24,33 +24,33 @@
"roarr": "^7.12.3",
"serialize-error": "^8.0.0",
"through2": "^4.0.2",
"zod": "^3.19.0"
"zod": "^3.19.1"
},
"description": "A Node.js PostgreSQL client with strict types, detailed logging and assertions.",
"devDependencies": {
"@semantic-release/commit-analyzer": "^9.0.2",
"@semantic-release/github": "^8.0.5",
"@semantic-release/github": "^8.0.6",
"@semantic-release/npm": "^9.0.1",
"@types/concat-stream": "^1.6.1",
"@types/concat-stream": "^2.0.0",
"@types/pg-copy-streams": "^1.2.1",
"@types/sinon": "^10.0.6",
"@types/sinon": "^10.0.13",
"@types/through2": "^2.0.36",
"ava": "^4.3.3",
"coveralls": "^3.1.1",
"delay": "^5.0.0",
"eslint": "^8.23.0",
"eslint": "^8.23.1",
"eslint-config-canonical": "^37.0.3",
"expect-type": "^0.14.0",
"expect-type": "^0.14.2",
"gitdown": "^3.1.5",
"husky": "^4.3.6",
"nyc": "^15.1.0",
"pg-native": "^3.0.0",
"pg-native": "^3.0.1",
"postgres": "^3.2.4",
"postgres-bridge": "^1.14.0",
"semantic-release": "^19.0.3",
"semantic-release": "^19.0.5",
"sinon": "^14.0.0",
"ts-node": "^10.9.1",
"typescript": "^4.8.2"
"typescript": "^4.8.3"
},
"engines": {
"node": ">=10.0"
4 changes: 3 additions & 1 deletion src/connectionMethods/stream.ts
Original file line number Diff line number Diff line change
@@ -85,7 +85,9 @@ export const stream: InternalStreamFunction = async (connectionLogger, connectio
queryStream.destroy(error);
});

streamHandler(transformedStream);
transformedStream.once('readable', () => {
streamHandler(transformedStream);
});
});
},
);
13 changes: 13 additions & 0 deletions test/slonik/integration/pg.ts
Original file line number Diff line number Diff line change
@@ -373,3 +373,16 @@ test('frees connection after destroying a stream with an error', async (t) => {

await pool.end();
});

test('throws error on syntax errors', async (t) => {
const pool = await createPool(t.context.dsn);

const error = await t.throwsAsync(pool.stream(sql`NONSENSE NOT REALLY SQL`, () => {
t.false('We should not have got this far!');
}));

t.true(error instanceof Error);
t.deepEqual(error?.message, 'syntax error at or near "NONSENSE"');

await pool.end();
});